diff options
| author | Tom Christie | 2013-01-04 13:05:31 +0000 |
|---|---|---|
| committer | Tom Christie | 2013-01-04 13:05:31 +0000 |
| commit | 4c86fd46d772e1fd3789d9ed2a76b9b92cce0872 (patch) | |
| tree | f18c68752a0bcebf92dc8d642e16ff07ad759005 /rest_framework/tests/relations.py | |
| parent | 6e9865cb71ff45e90020d3d0dc7c40f20c760d2e (diff) | |
| download | django-rest-framework-4c86fd46d772e1fd3789d9ed2a76b9b92cce0872.tar.bz2 | |
Rename module for basic relational field tests
Diffstat (limited to 'rest_framework/tests/relations.py')
| -rw-r--r-- | rest_framework/tests/relations.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/rest_framework/tests/relations.py b/rest_framework/tests/relations.py new file mode 100644 index 00000000..108ec473 --- /dev/null +++ b/rest_framework/tests/relations.py @@ -0,0 +1,22 @@ +""" +General tests for relational fields. +""" + +from django.db import models +from django.test import TestCase +from rest_framework import serializers + + +class NullModel(models.Model): + pass + + +class FieldTests(TestCase): + def test_pk_related_field_with_empty_string(self): + """ + Regression test for #446 + + https://github.com/tomchristie/django-rest-framework/issues/446 + """ + field = serializers.PrimaryKeyRelatedField(queryset=NullModel.objects.all()) + self.assertRaises(serializers.ValidationError, field.from_native, ('',)) |
