/usr/lib/python2.7/dist-packages/migrate/tests/versioning/test_runchangeset.py is in python-migrate 0.8.2-3ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os,shutil
from migrate.tests import fixture
from migrate.versioning.schema import *
from migrate.versioning import script
class TestRunChangeset(fixture.Pathed,fixture.DB):
level=fixture.DB.CONNECT
def _setup(self, url):
super(TestRunChangeset, self)._setup(url)
Repository.clear()
self.path_repos=self.tmp_repos()
# Create repository, script
Repository.create(self.path_repos,'repository_name')
@fixture.usedb()
def test_changeset_run(self):
"""Running a changeset against a repository gives expected results"""
repos=Repository(self.path_repos)
for i in range(10):
repos.create_script('')
try:
ControlledSchema(self.engine,repos).drop()
except:
pass
db=ControlledSchema.create(self.engine,repos)
# Scripts are empty; we'll check version # correctness.
# (Correct application of their content is checked elsewhere)
self.assertEqual(db.version,0)
db.upgrade(1)
self.assertEqual(db.version,1)
db.upgrade(5)
self.assertEqual(db.version,5)
db.upgrade(5)
self.assertEqual(db.version,5)
db.upgrade(None) # Latest is implied
self.assertEqual(db.version,10)
self.assertRaises(Exception,db.upgrade,11)
self.assertEqual(db.version,10)
db.upgrade(9)
self.assertEqual(db.version,9)
db.upgrade(0)
self.assertEqual(db.version,0)
self.assertRaises(Exception,db.upgrade,-1)
self.assertEqual(db.version,0)
#changeset = repos.changeset(self.url,0)
db.drop()
|