Esempio n. 1
0
 def test_exception(self):
     lb = Pyliquibase(
         defaultsFile=os.path.dirname(os.path.realpath(__file__)) +
         "/resources/liquibase-fail.properties")
     try:
         lb.status()
     except Exception as e:
         self.assertTrue("Liquibase execution failed" in str(e))
 def test_from_defaults_file(self):
     changeLogFile = os.path.dirname(os.path.realpath(__file__)) + '/resources/changelog-2.xml'
     lb = Pyliquibase.from_file(defaultsFile="./resources/liquibase.properties")
     lb.changeLogFile = changeLogFile
     rc = lb.status()
     self.assertTrue("2 change sets have not been applied" in rc)
     rc = lb.validate()
     self.assertTrue("No validation errors found" in rc)
     rc = lb.update()
     self.assertTrue("001_patch.sql" in rc)
     self.assertTrue("Custom SQL executed" in rc)
     rc = lb.update()
     self.assertTrue("Liquibase: Update has been successful" in rc)
    def test_nested_dir(self):
        self.tearDowndb()
        changeLogFile = os.path.dirname(os.path.realpath(__file__)) + '/resources/changelog-2.xml'
        lb = Pyliquibase(changeLogFile=changeLogFile, username="", password="", url='jdbc:sqlite:%s' % self.testdb,
                         driver="org.sqlite.JDBC", logLevel="info")

        rc = lb.status()
        self.assertTrue("2 change sets have not been applied" in rc)
        rc = lb.validate()
        self.assertTrue("No validation errors found" in rc)
        rc = lb.update()
        self.assertTrue("001_patch.sql" in rc)
        self.assertTrue("Custom SQL executed" in rc)
        rc = lb.update()
        self.assertTrue("Liquibase: Update has been successful" in rc)
Esempio n. 4
0
    def test_update(self):
        versions = ["4.9.0", "4.10.0", "4.11.0"]
        for version in versions:
            self.tearDown()
            lb = Pyliquibase(
                version=version,
                defaultsFile=os.path.dirname(os.path.realpath(__file__)) +
                "/resources/liquibase.properties")

            lb.addarg("--log-level", "info")
            lb.addarg("--log-file", self.testlogfile.as_posix())

            lb.status()
            lb.execute("validate")
            lb.execute("updateSQL")
            lb.execute("update")
            self.assertTrue(True)