update test case

This commit is contained in:
Ekluv 2017-03-28 12:02:03 +05:30
parent ef8092ba2f
commit d66304abe6

View File

@ -1100,11 +1100,5 @@ class Test5004UniqueChoiceField(TestCase):
UniqueChoiceModel.objects.create(name='choice1') UniqueChoiceModel.objects.create(name='choice1')
serializer = TestUniqueChoiceSerializer(data={'name': 'choice1'}) serializer = TestUniqueChoiceSerializer(data={'name': 'choice1'})
expected = dedent("""
TestUniqueChoiceSerializer():
id = IntegerField(label='ID', read_only=True)
name = ChoiceField(choices=(('choice1', 'choice 1'), ('choice2', 'choice 1')), validators=[<UniqueValidator(queryset=UniqueChoiceModel.objects.all())>])
""")
self.assertEqual(unicode_repr(TestUniqueChoiceSerializer()), expected)
assert not serializer.is_valid() assert not serializer.is_valid()
assert serializer.errors == {'name': ['unique choice model with this name already exists.']} assert serializer.errors == {'name': ['unique choice model with this name already exists.']}