diff options
| author | Dustin Farris | 2014-01-13 12:03:13 -0500 |
|---|---|---|
| committer | Dustin Farris | 2014-01-13 12:03:13 -0500 |
| commit | c4d77667cf80588a2195fdc025bda53a5b977105 (patch) | |
| tree | 12c684c6914b9e2264bb06a69bbc6085aba4c5b7 | |
| parent | b1b58762a3d84ac4cdc6553e8ed06983fd3502ca (diff) | |
| download | django-rest-framework-c4d77667cf80588a2195fdc025bda53a5b977105.tar.bz2 | |
Move ImportingModelSerializerTests and add comments.
| -rw-r--r-- | rest_framework/tests/test_serializer_import.py | 19 | ||||
| -rw-r--r-- | rest_framework/tests/test_serializer_nested.py | 6 |
2 files changed, 19 insertions, 6 deletions
diff --git a/rest_framework/tests/test_serializer_import.py b/rest_framework/tests/test_serializer_import.py new file mode 100644 index 00000000..9f30a7ff --- /dev/null +++ b/rest_framework/tests/test_serializer_import.py @@ -0,0 +1,19 @@ +from django.test import TestCase + +from rest_framework import serializers +from rest_framework.tests.accounts.serializers import AccountSerializer + + +class ImportingModelSerializerTests(TestCase): + """ + In some situations like, GH #1225, it is possible, especially in + testing, to import a serializer who's related models have not yet + been resolved by Django. `AccountSerializer` is an example of such + a serializer (imported at the top of this file). + """ + def test_import_model_serializer(self): + """ + The serializer at the top of this file should have been + imported successfully, and we should be able to instantiate it. + """ + self.assertIsInstance(AccountSerializer(), serializers.ModelSerializer) diff --git a/rest_framework/tests/test_serializer_nested.py b/rest_framework/tests/test_serializer_nested.py index d0a773fe..6d69ffbd 100644 --- a/rest_framework/tests/test_serializer_nested.py +++ b/rest_framework/tests/test_serializer_nested.py @@ -6,7 +6,6 @@ Doesn't cover model serializers. from __future__ import unicode_literals from django.test import TestCase from rest_framework import serializers -from rest_framework.tests.accounts.serializers import AccountSerializer from . import models @@ -346,8 +345,3 @@ class NestedModelSerializerUpdateTests(TestCase): result = deserialize.object result.save() self.assertEqual(result.id, john.id) - - -class ImportingModelSerializerWithStrForeignKeys(TestCase): - def test_import_model_serializer(self): - self.assertIsInstance(AccountSerializer(), serializers.ModelSerializer) |
