mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-05 21:10:13 +03:00
drop test_write_only_fields.py (not found by autodiscover), analogical tests in tests/fields/common/test_field_kwargs - TestWriteOnly
This commit is contained in:
parent
9ec7c8cd13
commit
8744849564
|
@ -1,32 +0,0 @@
|
|||
from django.test import TestCase
|
||||
|
||||
from rest_framework import serializers
|
||||
|
||||
|
||||
class WriteOnlyFieldTests(TestCase):
|
||||
def setUp(self):
|
||||
class ExampleSerializer(serializers.Serializer):
|
||||
email = serializers.EmailField()
|
||||
password = serializers.CharField(write_only=True)
|
||||
|
||||
def create(self, attrs):
|
||||
return attrs
|
||||
|
||||
self.Serializer = ExampleSerializer
|
||||
|
||||
def write_only_fields_are_present_on_input(self):
|
||||
data = {
|
||||
'email': 'foo@example.com',
|
||||
'password': '123'
|
||||
}
|
||||
serializer = self.Serializer(data=data)
|
||||
self.assertTrue(serializer.is_valid())
|
||||
self.assertEqual(serializer.validated_data, data)
|
||||
|
||||
def write_only_fields_are_not_present_on_output(self):
|
||||
instance = {
|
||||
'email': 'foo@example.com',
|
||||
'password': '123'
|
||||
}
|
||||
serializer = self.Serializer(instance)
|
||||
self.assertEqual(serializer.data, {'email': 'foo@example.com'})
|
Loading…
Reference in New Issue
Block a user