Package: djangorestframework / 3.9.0-1

0001-Disable-Postgresql-tests.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
From: Brian May <bam@debian.org>
Date: Thu, 3 May 2018 08:12:42 +1000
Subject: Disable Postgresql tests

These tests fail unless we actually have a postgresql database to
connect to.
---
 tests/test_model_serializer.py | 50 +-----------------------------------------
 1 file changed, 1 insertion(+), 49 deletions(-)

diff --git a/tests/test_model_serializer.py b/tests/test_model_serializer.py
index e9ed995..3013c97 100644
--- a/tests/test_model_serializer.py
+++ b/tests/test_model_serializer.py
@@ -23,7 +23,7 @@ from django.test import TestCase
 from django.utils import six
 
 from rest_framework import serializers
-from rest_framework.compat import postgres_fields, unicode_repr
+from rest_framework.compat import unicode_repr
 
 from .models import NestedForeignKeySource
 
@@ -427,54 +427,6 @@ class TestGenericIPAddressFieldValidation(TestCase):
                          '{0}'.format(s.errors))
 
 
-@pytest.mark.skipif('not postgres_fields')
-class TestPosgresFieldsMapping(TestCase):
-    def test_hstore_field(self):
-        class HStoreFieldModel(models.Model):
-            hstore_field = postgres_fields.HStoreField()
-
-        class TestSerializer(serializers.ModelSerializer):
-            class Meta:
-                model = HStoreFieldModel
-                fields = ['hstore_field']
-
-        expected = dedent("""
-            TestSerializer():
-                hstore_field = HStoreField()
-        """)
-        self.assertEqual(unicode_repr(TestSerializer()), expected)
-
-    def test_array_field(self):
-        class ArrayFieldModel(models.Model):
-            array_field = postgres_fields.ArrayField(base_field=models.CharField())
-
-        class TestSerializer(serializers.ModelSerializer):
-            class Meta:
-                model = ArrayFieldModel
-                fields = ['array_field']
-
-        expected = dedent("""
-            TestSerializer():
-                array_field = ListField(child=CharField(label='Array field', validators=[<django.core.validators.MaxLengthValidator object>]))
-        """)
-        self.assertEqual(unicode_repr(TestSerializer()), expected)
-
-    def test_json_field(self):
-        class JSONFieldModel(models.Model):
-            json_field = postgres_fields.JSONField()
-
-        class TestSerializer(serializers.ModelSerializer):
-            class Meta:
-                model = JSONFieldModel
-                fields = ['json_field']
-
-        expected = dedent("""
-            TestSerializer():
-                json_field = JSONField(style={'base_template': 'textarea.html'})
-        """)
-        self.assertEqual(unicode_repr(TestSerializer()), expected)
-
-
 # Tests for relational field mappings.
 # ------------------------------------