def test_with_missing_tipe(self): self.valid_data.pop('tipe') serializer = PhoneSerializer(data=self.valid_data) self.assertFalse(serializer.is_valid())
def test_with_valid_data(self): serializer = PhoneSerializer(data=self.valid_data) self.assertTrue(serializer.is_valid()) self.assertEqual(dict(serializer.validated_data), self.valid_data) self.assertEqual(dict(serializer.errors), {})