Beispiel #1
0
    def test_should_format_a_message_up(self):
        migration = MigrationWrapper(migration_file=hello_world)
        message = FormatterMessage(migration).message(method="down")
        expected_message = """
0.0.1           - hello_world.py
                  migrate all the world of test
                  greetings world
                  down - roolback the world
"""
        self.assertTextEqual(expected_message.strip(), message.strip())
    def test_should_format_a_message_up(self):
        migration = MigrationWrapper(migration_file=hello_world)
        message = FormatterMessage(migration).message(method="down")
        expected_message = """
0.0.1           - hello_world.py
                  migrate all the world of test
                  greetings world
                  down - roolback the world
"""
        self.assertTextEqual(expected_message.strip(), message.strip())
    def test_should_format_message_of_error(self):
        migration = MigrationWrapper(migration_file=exception)
        message = FormatterMessage(migration).message_error(method="down", error="integer division or modulo by zero")
        expected_message = """
\x1b[31m\n0.0.4           - exception.py
                  Test for raise a exception
                  down - Rollback and raise exception

integer division or modulo by zero\x1b[0m
"""
        self.assertTextEqual(expected_message.strip(), message.strip())
Beispiel #4
0
    def test_should_format_message_of_error(self):
        migration = MigrationWrapper(migration_file=exception)
        message = FormatterMessage(migration).message_error(
            method="down", error="integer division or modulo by zero")
        expected_message = """
\x1b[31m\n0.0.4           - exception.py
                  Test for raise a exception
                  down - Rollback and raise exception

integer division or modulo by zero\x1b[0m
"""
        self.assertTextEqual(expected_message.strip(), message.strip())
Beispiel #5
0
 def test_should_ident_message(self):
     migration = MigrationWrapper(migration_file=hello_world)
     message = FormatterMessage(migration).ident(migration.header())
     self.assertEqual(
         "                  migrate all the world of test\n                  greetings world",
         message)