Exemplo n.º 1
0
    def test_workflow(self):
        self.assertEqual(api.db_version(self.url, self.repo), 0)
        api.script('First Version', self.repo)
        self.assertEqual(api.db_version(self.url, self.repo), 0)
        api.upgrade(self.url, self.repo, 1)
        self.assertEqual(api.db_version(self.url, self.repo), 1)
        api.downgrade(self.url, self.repo, 0)
        self.assertEqual(api.db_version(self.url, self.repo), 0)
        api.test(self.url, self.repo)
        self.assertEqual(api.db_version(self.url, self.repo), 0)

        # preview
        # TODO: test output
        out = api.upgrade(self.url, self.repo, preview_py=True)
        out = api.upgrade(self.url, self.repo, preview_sql=True)

        api.upgrade(self.url, self.repo, 1)
        api.script_sql('default', 'desc', self.repo)
        self.assertRaises(UsageError,
                          api.upgrade,
                          self.url,
                          self.repo,
                          2,
                          preview_py=True)
        out = api.upgrade(self.url, self.repo, 2, preview_sql=True)

        # cant upgrade to version 1, already at version 1
        self.assertEqual(api.db_version(self.url, self.repo), 1)
        self.assertRaises(KnownError, api.upgrade, self.url, self.repo, 0)
Exemplo n.º 2
0
    def test_workflow(self):
        self.assertEqual(api.db_version(self.url, self.repo), 0)
        api.script('First Version', self.repo)
        self.assertEqual(api.db_version(self.url, self.repo), 0)
        api.upgrade(self.url, self.repo, 1)
        self.assertEqual(api.db_version(self.url, self.repo), 1)
        api.downgrade(self.url, self.repo, 0)
        self.assertEqual(api.db_version(self.url, self.repo), 0)
        api.test(self.url, self.repo)
        self.assertEqual(api.db_version(self.url, self.repo), 0)

        # preview
        # TODO: test output
        out = api.upgrade(self.url, self.repo, preview_py=True)
        out = api.upgrade(self.url, self.repo, preview_sql=True)

        api.upgrade(self.url, self.repo, 1)
        api.script_sql('default', self.repo)
        self.assertRaises(UsageError, api.upgrade, self.url, self.repo, 2, preview_py=True)
        out = api.upgrade(self.url, self.repo, 2, preview_sql=True)

        # cant upgrade to version 1, already at version 1
        self.assertEqual(api.db_version(self.url, self.repo), 1)
        self.assertRaises(KnownError, api.upgrade, self.url, self.repo, 0)
Exemplo n.º 3
0
 def test_migration():
     migrate_api.test(self.config.TEST_DB_URL, self.config.REPOSITORY)
Exemplo n.º 4
0
 def test(self):
     return test(
         url=self.db_url,
         repository=self.repository,
     )
Exemplo n.º 5
0
 def manage_test():
     api.test(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO)