def test_get_original_fields_mapping(self): instance: ZoopObject = ZoopObjectFactory(id=1) expected = {"modificado": "original"} result = instance.get_original_different_fields_mapping() self.assertEqual(expected, result)
def test_validate_custom_fields(self): """ Dado que existe um zoopObject z1 Quando for chamado z1.custom_validate_fields() Então deve ser retornado uma lista vazia """ z1: ZoopObject = ZoopObjectFactory(id=1) expected = [] result = z1.validate_custom_fields() self.assertEqual(expected, result)
def test_validate_call_validate_custom_fields(self): """ Dado que existe um zoopObject z1 Quando for chamado z1.validate_fields() Então z1.validate_custom_fields() deve ter sido chamado """ z1: ZoopObject = ZoopObjectFactory(id=1) with patch("zoop_wrapper.models.base.ZoopObject.validate_custom_fields" ) as mocked_validate: z1.validate_fields() self.assertIsInstance(mocked_validate, MagicMock) mocked_validate.assert_called_once_with()
def test_create_allow_empty(self): instance = ZoopObjectFactory(allow_empty=True) self.assertIsInstance(instance, ZoopObject)
def test_create(self): instance = ZoopObjectFactory(id=1) self.assertIsInstance(instance, ZoopObject)
def test_init_call_init_custom_values(self, mocked_init_custom_fields): ZoopObjectFactory(id=1) mocked_init_custom_fields.assert_called_once()
def test_init_call_validate(self, mocked_validate): ZoopObjectFactory(id=1) mocked_validate.assert_called_once()
def test_validate_allow_empty(self): instance = ZoopObjectFactory(allow_empty=True) self.assertIsInstance(instance, ZoopObject) instance.validate_fields()