diff options
| author | Marko Tibold | 2012-12-10 23:10:04 +0100 |
|---|---|---|
| committer | Marko Tibold | 2012-12-10 23:10:04 +0100 |
| commit | d0935d1fbb87711b0ffda8655c44ede29ee4208a (patch) | |
| tree | 794c55ca1406b3cef65e20a18399cbbc26707898 /rest_framework/tests | |
| parent | ff01ae3571298b9da67f9b9583f0cb264676ed2b (diff) | |
| download | django-rest-framework-d0935d1fbb87711b0ffda8655c44ede29ee4208a.tar.bz2 | |
get_excluded_fieldnames() should respect Meta options' ability to be either a tuple or list. Fixes #490.
Refactored `if self.opt.fields` out of the for loop.
Updated and cleaned up the validation-tests.
Diffstat (limited to 'rest_framework/tests')
| -rw-r--r-- | rest_framework/tests/serializer.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/rest_framework/tests/serializer.py b/rest_framework/tests/serializer.py index 455fa270..a16f6abd 100644 --- a/rest_framework/tests/serializer.py +++ b/rest_framework/tests/serializer.py @@ -66,6 +66,7 @@ class AlbumsSerializer(serializers.ModelSerializer): class Meta: model = Album + fields = ['title'] # lists are also valid options class BasicTests(TestCase): @@ -282,9 +283,11 @@ class ValidationTests(TestCase): self.assertEquals(serializer.is_valid(), False) self.assertEquals(serializer.errors, {'info': [u'Ensure this value has at most 12 characters (it has 13).']}) + +class ModelValidationTests(TestCase): def test_validate_unique(self): """ - Just check if serializers.ModelSerializer.perform_model_validation() handles unique checks via .full_clean() + Just check if serializers.ModelSerializer handles unique checks via .full_clean() """ serializer = AlbumsSerializer(data={'title': 'a'}) serializer.is_valid() |
