mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-25 19:14:01 +03:00
update test case
This commit is contained in:
parent
ef8092ba2f
commit
d66304abe6
|
@ -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.']}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user