|
2 | 2 | import re |
3 | 3 |
|
4 | 4 | import pytest |
5 | | -from django.db.models import Count, Model, Prefetch |
| 5 | +from django.db.models import Count, Prefetch |
6 | 6 |
|
7 | 7 | from graphene import List, NonNull, ObjectType, Schema, String |
8 | | -from graphene.relay import Node |
9 | 8 |
|
10 | | -from ..fields import DjangoConnectionField, DjangoListField |
| 9 | +from ..fields import DjangoListField |
11 | 10 | from ..types import DjangoObjectType |
12 | 11 | from .models import ( |
13 | 12 | Article as ArticleModel, |
@@ -717,34 +716,3 @@ def resolve_articles(root, info): |
717 | 716 | r'SELECT .* FROM "tests_film" INNER JOIN "tests_film_reporters" .* LEFT OUTER JOIN "tests_filmdetails"', |
718 | 717 | captured.captured_queries[1]["sql"], |
719 | 718 | ) |
720 | | - |
721 | | - |
722 | | -class TestDjangoConnectionField: |
723 | | - def test_model_ordering_assertion(self): |
724 | | - class Chaos(Model): |
725 | | - class Meta: |
726 | | - app_label = "test" |
727 | | - |
728 | | - class ChaosType(DjangoObjectType): |
729 | | - class Meta: |
730 | | - model = Chaos |
731 | | - interfaces = (Node,) |
732 | | - |
733 | | - class Query(ObjectType): |
734 | | - chaos = DjangoConnectionField(ChaosType) |
735 | | - |
736 | | - with pytest.raises( |
737 | | - TypeError, |
738 | | - match=r"Django model test\.Chaos has to have a default ordering to be used in a Connection\.", |
739 | | - ): |
740 | | - Schema(query=Query) |
741 | | - |
742 | | - def test_only_django_object_types(self): |
743 | | - class Query(ObjectType): |
744 | | - something = DjangoConnectionField(String) |
745 | | - |
746 | | - with pytest.raises( |
747 | | - TypeError, |
748 | | - match="DjangoConnectionField only accepts DjangoObjectType types as underlying type", |
749 | | - ): |
750 | | - Schema(query=Query) |
0 commit comments