コード例 #1
0
 def test_it_should_create_migration_file(self, strftime_mock):
     self.assertFalse(
         os.path.exists(
             '20120303194030_create_a_file_test_migration.migration'))
     Migration.create('create_a_file_test_migration', '.')
     self.assertTrue(
         os.path.exists(
             '20120303194030_create_a_file_test_migration.migration'))
コード例 #2
0
 def test_it_should_raise_exception_if_an_error_hapens_when_writing_the_file(
         self, open_mock, strftime_mock):
     try:
         Migration.create('test_migration')
         self.fail('it should not pass here')
     except Exception as e:
         self.assertEqual(
             "could not create file ('./20120303194030_test_migration.migration')",
             str(e))
コード例 #3
0
 def test_it_should_use_local_time_when_asked_to_not_use_utc(self, localtime_mock):
     Migration.create('test_migration', utc_timestamp=False)
     localtime_mock.assert_called_once()
コード例 #4
0
 def test_it_should_use_gmt_time_when_asked_to_use_utc(self, gmtime_mock):
     Migration.create('test_migration', utc_timestamp=True)
     gmtime_mock.assert_called_once()
コード例 #5
0
 def test_it_should_raise_exception_if_an_error_hapens_when_writing_the_file(self, open_mock, strftime_mock):
     try:
         Migration.create('test_migration')
         self.fail('it should not pass here')
     except Exception as e:
         self.assertEqual("could not create file ('./20120303194030_test_migration.migration')", str(e))
コード例 #6
0
 def test_it_should_create_migration_file(self, strftime_mock):
     self.assertFalse(os.path.exists('20120303194030_create_a_file_test_migration.migration'))
     Migration.create('create_a_file_test_migration', '.')
     self.assertTrue(os.path.exists('20120303194030_create_a_file_test_migration.migration'))
コード例 #7
0
 def test_it_should_use_local_time_when_asked_to_not_use_utc(
         self, localtime_mock):
     Migration.create('test_migration', utc_timestamp=False)
     localtime_mock.assert_called_once()
コード例 #8
0
 def test_it_should_use_gmt_time_when_asked_to_use_utc(self, gmtime_mock):
     Migration.create('test_migration', utc_timestamp=True)
     gmtime_mock.assert_called_once()