def test_check_mandatory_migrate_raise_exception_if_not_contain_target(self): # given data = self.get_migration_config(target_key="noTarget") # when with self.assertRaises(Exception) as e: migration_utils.check_mandatory_migrate(data["migration"]) # then self.assertTrue("check yours parameters in file, no attribute [target] for [migration]" in e.exception)
def test_check_mandatory_migrate_check_mandatory_source_target_if_contain_source_target(self, mock_check_mandatory_source, mock_check_mandatory_target): # given data = self.get_migration_config() # when migration_utils.check_mandatory_migrate(data["migration"]) # then mock_check_mandatory_source.assert_called_with(data["migration"]["source"]) mock_check_mandatory_target.assert_called_with(data["migration"]["target"])
def test_check_mandatory_migrate_raise_exception_if_os_value_not_valid(self): # given data = self.get_migration_config(os_value="Windows") # when with self.assertRaises(Exception) as e: migration_utils.check_mandatory_migrate(data["migration"]) # then self.assertTrue("check yours parameters in file, attribute [os] for [migration] is not correct. Only 'linux' is supported" in e.exception)