def test_should_return_true_if_there_is_no_backups(self, _): # given predicate = DefaultBackupPredicate() # when result = predicate.test(self.big_query_table_metadata, self.table) # then self.assertTrue(result, "ShouldBackupPredicate should return TRUE " "if there is no backups")
def test_should_return_false_if_table_is_external_or_view_type(self, _): # given predicate = DefaultBackupPredicate() # when result = predicate.test(self.big_query_table_metadata, self.table) # then self.assertFalse(result, "ShouldBackupPredicate should return FALSE " "if object is table or external type")
def test_should_return_false_if_table_not_exist_anymore(self, _): # given predicate = DefaultBackupPredicate() # when result = predicate.test(self.big_query_table_metadata, self.table) # then self.assertFalse(result, "ShouldBackupPredicate should return FALSE " "if table not exists")
def test_should_return_false_if_schema_is_not_defined(self, _): # given predicate = DefaultBackupPredicate() # when result = predicate.test(self.big_query_table_metadata, self.table) # then self.assertFalse(result, "ShouldBackupPredicate should return FALSE " "if table has no schema")
def test_should_return_true_if_table_was_changed_after_last_backup( self, _): # given backup = Backup(parent=self.table.key, last_modified=datetime(2016, 11, 13, 15, 00)) backup.put() predicate = DefaultBackupPredicate() # when result = predicate.test(self.big_query_table_metadata, self.table) # then self.assertTrue( result, "ShouldBackupPredicate should return TRUE " "if table was changed after last backup")
def test_should_return_false_if_table_was_changed_before_last_backup( self, _1, _2): # nopep8 pylint: disable=C0301 # given backup = Backup(parent=self.table.key, last_modified=datetime(2016, 11, 13, 15, 00), numBytes=123) backup.put() predicate = DefaultBackupPredicate() # when result = predicate.test(self.big_query_table_metadata, self.table) # then self.assertFalse( result, "ShouldBackupPredicate should return FALSE " "if table was changed before " "last backup was made")
def test_should_return_true_if_changed_table_is_empty_and_last_backup_is_also_empty( self, _1, _2): # nopep8 pylint: disable=C0301 # given backup = Backup(parent=self.table.key, last_modified=datetime(2016, 11, 13, 15, 00), numBytes=0) backup.put() predicate = DefaultBackupPredicate() # when result = predicate.test(self.big_query_table_metadata, self.table) # then self.assertTrue( result, "ShouldBackupPredicate should return True " "if table was changed after last backup was made," "but source table is empty and bbq has also empty last backup")
def test_should_return_true_if_table_was_changed_before_last_backup_but_table_size_is_different( self, _1, _2): # nopep8 pylint: disable=C0301 # given backup = Backup(parent=self.table.key, last_modified=datetime(2016, 11, 13, 15, 00), numBytes=123) backup.put() predicate = DefaultBackupPredicate() # when result = predicate.test(self.big_query_table_metadata, self.table) # then self.assertTrue( result, "ShouldBackupPredicate should return TRUE " "if table was changed before " "last backup was made but " "backup has different size than source table")