aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/tests/test_relations_pk.py
diff options
context:
space:
mode:
authorTom Christie2013-09-25 09:44:26 +0100
committerTom Christie2013-09-25 09:44:26 +0100
commit21cd6386593aea0b122abec1c5cc3bd5c544aa87 (patch)
treeb7d197c9c04f56448bee36c4789c93c66fb541a8 /rest_framework/tests/test_relations_pk.py
parent9a5b2eefa92dede844ab94d049093e91ac98af5b (diff)
parente8c6cd5622f62fcf2d4cf2b28b504fe5ff5228f9 (diff)
downloaddjango-rest-framework-21cd6386593aea0b122abec1c5cc3bd5c544aa87.tar.bz2
Merge master
Diffstat (limited to 'rest_framework/tests/test_relations_pk.py')
-rw-r--r--rest_framework/tests/test_relations_pk.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/rest_framework/tests/test_relations_pk.py b/rest_framework/tests/test_relations_pk.py
index e2a1b815..3815afdd 100644
--- a/rest_framework/tests/test_relations_pk.py
+++ b/rest_framework/tests/test_relations_pk.py
@@ -283,6 +283,15 @@ class PKForeignKeyTests(TestCase):
self.assertFalse(serializer.is_valid())
self.assertEqual(serializer.errors, {'target': ['This field is required.']})
+ def test_foreign_key_with_empty(self):
+ """
+ Regression test for #1072
+
+ https://github.com/tomchristie/django-rest-framework/issues/1072
+ """
+ serializer = NullableForeignKeySourceSerializer()
+ self.assertEqual(serializer.data['target'], None)
+
class PKNullableForeignKeyTests(TestCase):
def setUp(self):