revert 2688cdb980

This commit is contained in:
iElectric 2010-05-03 13:03:25 +02:00
parent dd756a512f
commit ec75b93b07
1 changed files with 7 additions and 9 deletions

View File

@ -19,8 +19,6 @@ from tests.fixture import Shell, DB, usedb
from tests.fixture import models
HERE = os.path.dirname(os.path.abspath(__file__))
class TestShellCommands(Shell):
"""Tests migrate.py commands"""
@ -473,24 +471,24 @@ class TestShellDatabase(Shell, DB):
# Model is defined but database is empty.
result = self.env.run('migrate compare_model_to_db %s %s --model=%s' \
% (self.url, repos_path, model_module), cwd=HERE)
% (self.url, repos_path, model_module))
self.assert_("tables missing in database: tmp_account_rundiffs" in result.stdout)
# Test Deprecation
result = self.env.run('migrate compare_model_to_db %s %s --model=%s' \
% (self.url, repos_path, model_module.replace(":", ".")), cwd=HERE, expect_error=True)
% (self.url, repos_path, model_module.replace(":", ".")), expect_error=True)
self.assertEqual(result.returncode, 0)
self.assertTrue("DeprecationWarning" in result.stderr)
self.assert_("tables missing in database: tmp_account_rundiffs" in result.stdout)
# Update db to latest model.
result = self.env.run('migrate update_db_from_model %s %s %s'\
% (self.url, repos_path, model_module), cwd=HERE)
% (self.url, repos_path, model_module))
self.assertEquals(self.run_version(repos_path), 0)
self.assertEquals(self.run_db_version(self.url, repos_path), 0) # version did not get bumped yet because new version not yet created
result = self.env.run('migrate compare_model_to_db %s %s %s'\
% (self.url, repos_path, model_module), cwd=HERE)
% (self.url, repos_path, model_module))
self.assert_("No schema diffs" in result.stdout)
result = self.env.run('migrate drop_version_control %s %s' % (self.url, repos_path), expect_error=True)
@ -508,11 +506,11 @@ class TestShellDatabase(Shell, DB):
#Column('passwd', String(length=None, convert_unicode=False, assert_unicode=None))""" in result.stdout)
# We're happy with db changes, make first db upgrade script to go from version 0 -> 1.
result = self.env.run('migrate make_update_script_for_model', expect_error=True, cwd=HERE)
result = self.env.run('migrate make_update_script_for_model', expect_error=True)
self.assertTrue('Not enough arguments' in result.stderr)
result_script = self.env.run('migrate make_update_script_for_model %s %s %s %s'\
% (self.url, repos_path, old_model_module, model_module), cwd=HERE)
% (self.url, repos_path, old_model_module, model_module))
self.assertEqualsIgnoreWhitespace(result_script.stdout,
'''from sqlalchemy import *
from migrate import *
@ -543,7 +541,7 @@ class TestShellDatabase(Shell, DB):
open(upgrade_script_path, 'w').write(result_script.stdout)
result = self.env.run('migrate compare_model_to_db %s %s %s'\
% (self.url, repos_path, model_module), cwd=HERE)
% (self.url, repos_path, model_module))
self.assert_("No schema diffs" in result.stdout)
self.meta.drop_all() # in case junk tables are lying around in the test database