Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-graphene-django for 
openSUSE:Factory checked in at 2024-11-13 15:29:07
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-graphene-django (Old)
 and      /work/SRC/openSUSE:Factory/.python-graphene-django.new.2017 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-graphene-django"

Wed Nov 13 15:29:07 2024 rev:10 rq:1223831 version:3.2.2

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/python-graphene-django/python-graphene-django.changes
    2024-01-15 22:19:06.178566095 +0100
+++ 
/work/SRC/openSUSE:Factory/.python-graphene-django.new.2017/python-graphene-django.changes
  2024-11-13 15:29:38.436668954 +0100
@@ -1,0 +2,11 @@
+Wed Nov 13 05:05:17 UTC 2024 - Steve Kowalik <steven.kowa...@suse.com>
+
+- Update to 3.2.2:
+  * Make use of http.HTTPStatus for response status code checks
+  * Not require explicitly set ordering in DjangoConnectionField
+  * fix: same type list
+  * feat!: check Django model has a default ordering when used in a
+    Relay Connection
+- Switch to pyproject macros.
+
+-------------------------------------------------------------------

Old:
----
  graphene-django-3.2.0.tar.gz

New:
----
  graphene-django-3.2.2.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-graphene-django.spec ++++++
--- /var/tmp/diff_new_pack.CNjHzY/_old  2024-11-13 15:29:38.952690508 +0100
+++ /var/tmp/diff_new_pack.CNjHzY/_new  2024-11-13 15:29:38.952690508 +0100
@@ -16,37 +16,34 @@
 #
 
 
-%{?!python_module:%define python_module() python-%{**} python3-%{**}}
-%define skip_python2 1
 Name:           python-graphene-django
-Version:        3.2.0
+Version:        3.2.2
 Release:        0
 Summary:        Graphene Django integration
 License:        MIT
-Group:          Development/Languages/Python
 URL:            https://github.com/graphql-python/graphene-django
 Source:         
https://github.com/graphql-python/graphene-django/archive/v%{version}.tar.gz#/graphene-django-%{version}.tar.gz
+BuildRequires:  %{python_module pip}
 BuildRequires:  %{python_module setuptools}
+BuildRequires:  %{python_module wheel}
 BuildRequires:  fdupes
 BuildRequires:  python-rpm-macros
 BuildRequires:  tree
 Requires:       python-Django >= 3.2
-Requires:       python-graphene >= 2.9.9
+Requires:       python-graphene >= 3.0
 Requires:       python-graphql-core >= 3.1.0
-Requires:       python-graphql-relay
+Requires:       python-graphql-relay >= 3.1
 Requires:       python-promise >= 2.1
-Requires:       python-six
 Requires:       python-text-unidecode
-Suggests:       python-django-filter >= 2
 Suggests:       python-djangorestframework >= 3.6.3
 BuildArch:      noarch
 # SECTION test requirements
 BuildRequires:  %{python_module Django >= 2.2}
 BuildRequires:  %{python_module django-filter >= 2}
 BuildRequires:  %{python_module djangorestframework >= 3.6.3}
-BuildRequires:  %{python_module graphene >= 2.9.9}
+BuildRequires:  %{python_module graphene >= 3.0}
 BuildRequires:  %{python_module graphql-core >= 3.1.0}
-BuildRequires:  %{python_module graphql-relay}
+BuildRequires:  %{python_module graphql-relay >= 3.1}
 BuildRequires:  %{python_module promise >= 2.1}
 BuildRequires:  %{python_module psycopg2}
 BuildRequires:  %{python_module pytest-django >= 3.3.2}
@@ -69,10 +66,10 @@
 sed -i '/pytest-runner/d' setup.py
 
 %build
-%python_build
+%pyproject_wheel
 
 %install
-%python_install
+%pyproject_install
 %python_expand find %{buildroot}%{$python_sitelib}/graphene_django -name tests 
| xargs rm -r
 %python_expand %fdupes %{buildroot}%{$python_sitelib}
 
@@ -90,5 +87,6 @@
 %files %{python_files}
 %doc README.md
 %license LICENSE
-%{python_sitelib}/graphene[_-]django*/
+%{python_sitelib}/graphene_django
+%{python_sitelib}/graphene_django-%{version}.dist-info
 

++++++ graphene-django-3.2.0.tar.gz -> graphene-django-3.2.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/graphene-django-3.2.0/.readthedocs.yaml 
new/graphene-django-3.2.2/.readthedocs.yaml
--- old/graphene-django-3.2.0/.readthedocs.yaml 1970-01-01 01:00:00.000000000 
+0100
+++ new/graphene-django-3.2.2/.readthedocs.yaml 2024-06-12 04:52:45.000000000 
+0200
@@ -0,0 +1,18 @@
+# .readthedocs.yaml
+# Read the Docs configuration file
+# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
+
+version: 2
+build:
+  os: ubuntu-22.04
+  tools:
+    python: "3.12"
+
+# Build documentation in the "docs/" directory with Sphinx
+sphinx:
+  configuration: docs/conf.py
+
+# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
+python:
+   install:
+      - requirements: docs/requirements.txt
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/graphene-django-3.2.0/CONTRIBUTING.md 
new/graphene-django-3.2.2/CONTRIBUTING.md
--- old/graphene-django-3.2.0/CONTRIBUTING.md   2023-12-20 11:22:33.000000000 
+0100
+++ new/graphene-django-3.2.2/CONTRIBUTING.md   2024-06-12 04:52:45.000000000 
+0200
@@ -33,7 +33,7 @@
 
 ## Opening Pull Requests
 
-Please fork the project and open a pull request against the master branch.
+Please fork the project and open a pull request against the `main` branch.
 
 This will trigger a series of test and lint checks.
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/graphene-django-3.2.0/README.md 
new/graphene-django-3.2.2/README.md
--- old/graphene-django-3.2.0/README.md 2023-12-20 11:22:33.000000000 +0100
+++ new/graphene-django-3.2.2/README.md 2024-06-12 04:52:45.000000000 +0200
@@ -30,7 +30,7 @@
 
 To install Graphene-Django, run the following command:
 
-```
+```sh
 pip install graphene-django
 ```
 
@@ -114,11 +114,11 @@
 
 ## Contributing
 
-Contributions to Graphene-Django are always welcome! To get started, check the 
repository's [issue 
tracker](https://github.com/graphql-python/graphene-django/issues) and 
[contribution 
guidelines](https://github.com/graphql-python/graphene-django/blob/master/CONTRIBUTING.md).
+Contributions to Graphene-Django are always welcome! To get started, check the 
repository's [issue 
tracker](https://github.com/graphql-python/graphene-django/issues) and 
[contribution 
guidelines](https://github.com/graphql-python/graphene-django/blob/main/CONTRIBUTING.md).
 
 ## License
 
-Graphene-Django is released under the [MIT 
License](https://github.com/graphql-python/graphene-django/blob/master/LICENSE).
+Graphene-Django is released under the [MIT 
License](https://github.com/graphql-python/graphene-django/blob/main/LICENSE).
 
 ## Resources
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/graphene-django-3.2.0/docs/tutorial-plain.rst 
new/graphene-django-3.2.2/docs/tutorial-plain.rst
--- old/graphene-django-3.2.0/docs/tutorial-plain.rst   2023-12-20 
11:22:33.000000000 +0100
+++ new/graphene-django-3.2.2/docs/tutorial-plain.rst   2024-06-12 
04:52:45.000000000 +0200
@@ -104,7 +104,7 @@
 
 Now is a good time to load up some test data. The easiest option will be
 to `download the
-ingredients.json 
<https://raw.githubusercontent.com/graphql-python/graphene-django/master/examples/cookbook/cookbook/ingredients/fixtures/ingredients.json>`__
+ingredients.json 
<https://raw.githubusercontent.com/graphql-python/graphene-django/main/examples/cookbook/cookbook/ingredients/fixtures/ingredients.json>`__
 fixture and place it in
 ``cookbook/ingredients/fixtures/ingredients.json``. You can then run the
 following:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/graphene-django-3.2.0/docs/tutorial-relay.rst 
new/graphene-django-3.2.2/docs/tutorial-relay.rst
--- old/graphene-django-3.2.0/docs/tutorial-relay.rst   2023-12-20 
11:22:33.000000000 +0100
+++ new/graphene-django-3.2.2/docs/tutorial-relay.rst   2024-06-12 
04:52:45.000000000 +0200
@@ -7,7 +7,7 @@
 working with Django *really simple*.
 
 Note: The code in this quickstart is pulled from the `cookbook example
-app 
<https://github.com/graphql-python/graphene-django/tree/master/examples/cookbook>`__.
+app 
<https://github.com/graphql-python/graphene-django/tree/main/examples/cookbook>`__.
 
 A good idea is to check the following things first:
 
@@ -87,7 +87,7 @@
 
 Now is a good time to load up some test data. The easiest option will be
 to `download the
-ingredients.json 
<https://raw.githubusercontent.com/graphql-python/graphene-django/master/examples/cookbook/cookbook/ingredients/fixtures/ingredients.json>`__
+ingredients.json 
<https://raw.githubusercontent.com/graphql-python/graphene-django/main/examples/cookbook/cookbook/ingredients/fixtures/ingredients.json>`__
 fixture and place it in
 ``cookbook/ingredients/fixtures/ingredients.json``. You can then run the
 following:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/graphene-django-3.2.0/examples/cookbook/requirements.txt 
new/graphene-django-3.2.2/examples/cookbook/requirements.txt
--- old/graphene-django-3.2.0/examples/cookbook/requirements.txt        
2023-12-20 11:22:33.000000000 +0100
+++ new/graphene-django-3.2.2/examples/cookbook/requirements.txt        
2024-06-12 04:52:45.000000000 +0200
@@ -1,5 +1,5 @@
 graphene>=2.1,<3
 graphene-django>=2.1,<3
 graphql-core>=2.1,<3
-django==3.1.14
+django==3.2.25
 django-filter>=2
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/graphene-django-3.2.0/graphene_django/__init__.py 
new/graphene-django-3.2.2/graphene_django/__init__.py
--- old/graphene-django-3.2.0/graphene_django/__init__.py       2023-12-20 
11:22:33.000000000 +0100
+++ new/graphene-django-3.2.2/graphene_django/__init__.py       2024-06-12 
04:52:45.000000000 +0200
@@ -2,7 +2,7 @@
 from .types import DjangoObjectType
 from .utils import bypass_get_queryset
 
-__version__ = "3.2.0"
+__version__ = "3.2.2"
 
 __all__ = [
     "__version__",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/graphene-django-3.2.0/graphene_django/converter.py 
new/graphene-django-3.2.2/graphene_django/converter.py
--- old/graphene-django-3.2.0/graphene_django/converter.py      2023-12-20 
11:22:33.000000000 +0100
+++ new/graphene-django-3.2.2/graphene_django/converter.py      2024-06-12 
04:52:45.000000000 +0200
@@ -1,5 +1,5 @@
 import inspect
-from collections import OrderedDict
+from collections.abc import Callable
 from functools import partial, singledispatch, wraps
 
 from django.db import models
@@ -72,8 +72,15 @@
 
 def get_choices(choices):
     converted_names = []
-    if isinstance(choices, OrderedDict):
+    if isinstance(choices, Callable):
+        choices = choices()
+
+    # In restframework==3.15.0, choices are not passed
+    # as OrderedDict anymore, so it's safer to check
+    # for a dict
+    if isinstance(choices, dict):
         choices = choices.items()
+
     for value, help_text in choices:
         if isinstance(help_text, (tuple, list)):
             yield from get_choices(help_text)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/graphene-django-3.2.0/graphene_django/fields.py 
new/graphene-django-3.2.2/graphene_django/fields.py
--- old/graphene-django-3.2.0/graphene_django/fields.py 2023-12-20 
11:22:33.000000000 +0100
+++ new/graphene-django-3.2.2/graphene_django/fields.py 2024-06-12 
04:52:45.000000000 +0200
@@ -20,17 +20,20 @@
 
 class DjangoListField(Field):
     def __init__(self, _type, *args, **kwargs):
-        from .types import DjangoObjectType
-
         if isinstance(_type, NonNull):
             _type = _type.of_type
 
         # Django would never return a Set of None  vvvvvvv
         super().__init__(List(NonNull(_type)), *args, **kwargs)
 
+    @property
+    def type(self):
+        from .types import DjangoObjectType
+
         assert issubclass(
             self._underlying_type, DjangoObjectType
-        ), "DjangoListField only accepts DjangoObjectType types"
+        ), "DjangoListField only accepts DjangoObjectType types as underlying 
type"
+        return super().type
 
     @property
     def _underlying_type(self):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/graphene-django-3.2.0/graphene_django/tests/models.py 
new/graphene-django-3.2.2/graphene_django/tests/models.py
--- old/graphene-django-3.2.0/graphene_django/tests/models.py   2023-12-20 
11:22:33.000000000 +0100
+++ new/graphene-django-3.2.2/graphene_django/tests/models.py   2024-06-12 
04:52:45.000000000 +0200
@@ -6,6 +6,9 @@
 
 class Person(models.Model):
     name = models.CharField(max_length=30)
+    parent = models.ForeignKey(
+        "self", on_delete=models.CASCADE, null=True, blank=True, 
related_name="children"
+    )
 
 
 class Pet(models.Model):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/graphene-django-3.2.0/graphene_django/tests/test_converter.py 
new/graphene-django-3.2.2/graphene_django/tests/test_converter.py
--- old/graphene-django-3.2.0/graphene_django/tests/test_converter.py   
2023-12-20 11:22:33.000000000 +0100
+++ new/graphene-django-3.2.2/graphene_django/tests/test_converter.py   
2024-06-12 04:52:45.000000000 +0200
@@ -180,6 +180,26 @@
     assert graphene_type._meta.enum.__members__["EN"].description == "English"
 
 
+def test_field_with_callable_choices_convert_enum():
+    def get_choices():
+        return ("es", "Spanish"), ("en", "English")
+
+    field = models.CharField(help_text="Language", choices=get_choices)
+
+    class TranslatedModel(models.Model):
+        language = field
+
+        class Meta:
+            app_label = "test"
+
+    graphene_type = convert_django_field_with_choices(field).type.of_type
+    assert graphene_type._meta.name == "TestTranslatedModelLanguageChoices"
+    assert graphene_type._meta.enum.__members__["ES"].value == "es"
+    assert graphene_type._meta.enum.__members__["ES"].description == "Spanish"
+    assert graphene_type._meta.enum.__members__["EN"].value == "en"
+    assert graphene_type._meta.enum.__members__["EN"].description == "English"
+
+
 def test_field_with_grouped_choices():
     field = models.CharField(
         help_text="Language",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/graphene-django-3.2.0/graphene_django/tests/test_fields.py 
new/graphene-django-3.2.2/graphene_django/tests/test_fields.py
--- old/graphene-django-3.2.0/graphene_django/tests/test_fields.py      
2023-12-20 11:22:33.000000000 +0100
+++ new/graphene-django-3.2.2/graphene_django/tests/test_fields.py      
2024-06-12 04:52:45.000000000 +0200
@@ -12,17 +12,23 @@
     Article as ArticleModel,
     Film as FilmModel,
     FilmDetails as FilmDetailsModel,
+    Person as PersonModel,
     Reporter as ReporterModel,
 )
 
 
 class TestDjangoListField:
     def test_only_django_object_types(self):
-        class TestType(ObjectType):
-            foo = String()
+        class Query(ObjectType):
+            something = DjangoListField(String)
+
+        with pytest.raises(TypeError) as excinfo:
+            Schema(query=Query)
 
-        with pytest.raises(AssertionError):
-            DjangoListField(TestType)
+        assert (
+            "Query fields cannot be resolved. DjangoListField only accepts 
DjangoObjectType types as underlying type"
+            in str(excinfo.value)
+        )
 
     def test_only_import_paths(self):
         list_field = DjangoListField("graphene_django.tests.schema.Human")
@@ -262,6 +268,69 @@
             ]
         }
 
+    def test_same_type_nested_list_field(self):
+        class Person(DjangoObjectType):
+            class Meta:
+                model = PersonModel
+                fields = ("name", "parent")
+
+            children = DjangoListField(lambda: Person)
+
+        class Query(ObjectType):
+            persons = DjangoListField(Person)
+
+        schema = Schema(query=Query)
+
+        query = """
+            query {
+                persons {
+                    name
+                    children {
+                        name
+                    }
+                }
+            }
+        """
+
+        p1 = PersonModel.objects.create(name="Tara")
+        PersonModel.objects.create(name="Debra")
+
+        PersonModel.objects.create(
+            name="Toto",
+            parent=p1,
+        )
+        PersonModel.objects.create(
+            name="Tata",
+            parent=p1,
+        )
+
+        result = schema.execute(query)
+
+        assert not result.errors
+        assert result.data == {
+            "persons": [
+                {
+                    "name": "Tara",
+                    "children": [
+                        {"name": "Toto"},
+                        {"name": "Tata"},
+                    ],
+                },
+                {
+                    "name": "Debra",
+                    "children": [],
+                },
+                {
+                    "name": "Toto",
+                    "children": [],
+                },
+                {
+                    "name": "Tata",
+                    "children": [],
+                },
+            ]
+        }
+
     def test_get_queryset_filter(self):
         class Reporter(DjangoObjectType):
             class Meta:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/graphene-django-3.2.0/graphene_django/tests/test_types.py 
new/graphene-django-3.2.2/graphene_django/tests/test_types.py
--- old/graphene-django-3.2.0/graphene_django/tests/test_types.py       
2023-12-20 11:22:33.000000000 +0100
+++ new/graphene-django-3.2.2/graphene_django/tests/test_types.py       
2024-06-12 04:52:45.000000000 +0200
@@ -1,3 +1,4 @@
+import warnings
 from collections import OrderedDict, defaultdict
 from textwrap import dedent
 from unittest.mock import patch
@@ -399,7 +400,7 @@
     with pytest.warns(
         UserWarning,
         match=r"Field name .* matches an attribute on Django model .* but it's 
not a model field",
-    ) as record:
+    ):
 
         class Reporter2(DjangoObjectType):
             class Meta:
@@ -407,7 +408,8 @@
                 fields = ["first_name", "some_method", "email"]
 
     # Don't warn if selecting a custom field
-    with pytest.warns(None) as record:
+    with warnings.catch_warnings():
+        warnings.simplefilter("error")
 
         class Reporter3(DjangoObjectType):
             custom_field = String()
@@ -416,8 +418,6 @@
                 model = ReporterModel
                 fields = ["first_name", "custom_field", "email"]
 
-    assert len(record) == 0
-
 
 @with_local_registry
 def test_django_objecttype_exclude_fields_exist_on_model():
@@ -445,15 +445,14 @@
                 exclude = ["custom_field"]
 
     # Don't warn on exclude fields
-    with pytest.warns(None) as record:
+    with warnings.catch_warnings():
+        warnings.simplefilter("error")
 
         class Reporter4(DjangoObjectType):
             class Meta:
                 model = ReporterModel
                 exclude = ["email", "first_name"]
 
-    assert len(record) == 0
-
 
 @with_local_registry
 def test_django_objecttype_neither_fields_nor_exclude():
@@ -467,24 +466,22 @@
             class Meta:
                 model = ReporterModel
 
-    with pytest.warns(None) as record:
+    with warnings.catch_warnings():
+        warnings.simplefilter("error")
 
         class Reporter2(DjangoObjectType):
             class Meta:
                 model = ReporterModel
                 fields = ["email"]
 
-    assert len(record) == 0
-
-    with pytest.warns(None) as record:
+    with warnings.catch_warnings():
+        warnings.simplefilter("error")
 
         class Reporter3(DjangoObjectType):
             class Meta:
                 model = ReporterModel
                 exclude = ["email"]
 
-    assert len(record) == 0
-
 
 def custom_enum_name(field):
     return f"CustomEnum{field.name.title()}"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/graphene-django-3.2.0/graphene_django/tests/test_views.py 
new/graphene-django-3.2.2/graphene_django/tests/test_views.py
--- old/graphene-django-3.2.0/graphene_django/tests/test_views.py       
2023-12-20 11:22:33.000000000 +0100
+++ new/graphene-django-3.2.2/graphene_django/tests/test_views.py       
2024-06-12 04:52:45.000000000 +0200
@@ -1,4 +1,5 @@
 import json
+from http import HTTPStatus
 from unittest.mock import patch
 
 import pytest
@@ -37,7 +38,7 @@
 
 def test_graphiql_is_enabled(client):
     response = client.get(url_string(), HTTP_ACCEPT="text/html")
-    assert response.status_code == 200
+    assert response.status_code == HTTPStatus.OK
     assert response["Content-Type"].split(";")[0] == "text/html"
 
 
@@ -46,7 +47,7 @@
         url_string(query="{test}"),
         HTTP_ACCEPT="application/json;q=0.8, text/html;q=0.9",
     )
-    assert response.status_code == 200
+    assert response.status_code == HTTPStatus.OK
     assert response["Content-Type"].split(";")[0] == "text/html"
 
 
@@ -55,7 +56,7 @@
         url_string(query="{test}"),
         HTTP_ACCEPT="text/html;q=0.8, application/json;q=0.9",
     )
-    assert response.status_code == 200
+    assert response.status_code == HTTPStatus.OK
     assert response["Content-Type"].split(";")[0] == "application/json"
     assert response_json(response) == {"data": {"test": "Hello World"}}
 
@@ -63,7 +64,7 @@
 def test_allows_get_with_query_param(client):
     response = client.get(url_string(query="{test}"))
 
-    assert response.status_code == 200
+    assert response.status_code == HTTPStatus.OK
     assert response_json(response) == {"data": {"test": "Hello World"}}
 
 
@@ -75,7 +76,7 @@
         )
     )
 
-    assert response.status_code == 200
+    assert response.status_code == HTTPStatus.OK
     assert response_json(response) == {"data": {"test": "Hello Dolly"}}
 
 
@@ -94,7 +95,7 @@
         )
     )
 
-    assert response.status_code == 200
+    assert response.status_code == HTTPStatus.OK
     assert response_json(response) == {
         "data": {"test": "Hello World", "shared": "Hello Everyone"}
     }
@@ -103,7 +104,7 @@
 def test_reports_validation_errors(client):
     response = client.get(url_string(query="{ test, unknownOne, unknownTwo }"))
 
-    assert response.status_code == 400
+    assert response.status_code == HTTPStatus.BAD_REQUEST
     assert response_json(response) == {
         "errors": [
             {
@@ -128,7 +129,7 @@
         )
     )
 
-    assert response.status_code == 400
+    assert response.status_code == HTTPStatus.BAD_REQUEST
     assert response_json(response) == {
         "errors": [
             {
@@ -146,7 +147,7 @@
         """
         )
     )
-    assert response.status_code == 405
+    assert response.status_code == HTTPStatus.METHOD_NOT_ALLOWED
     assert response_json(response) == {
         "errors": [
             {"message": "Can only perform a mutation operation from a POST 
request."}
@@ -165,7 +166,7 @@
         )
     )
 
-    assert response.status_code == 405
+    assert response.status_code == HTTPStatus.METHOD_NOT_ALLOWED
     assert response_json(response) == {
         "errors": [
             {"message": "Can only perform a mutation operation from a POST 
request."}
@@ -184,14 +185,14 @@
         )
     )
 
-    assert response.status_code == 200
+    assert response.status_code == HTTPStatus.OK
     assert response_json(response) == {"data": {"test": "Hello World"}}
 
 
 def test_allows_post_with_json_encoding(client):
     response = client.post(url_string(), j(query="{test}"), "application/json")
 
-    assert response.status_code == 200
+    assert response.status_code == HTTPStatus.OK
     assert response_json(response) == {"data": {"test": "Hello World"}}
 
 
@@ -200,7 +201,7 @@
         batch_url_string(), jl(id=1, query="{test}"), "application/json"
     )
 
-    assert response.status_code == 200
+    assert response.status_code == HTTPStatus.OK
     assert response_json(response) == [
         {"id": 1, "data": {"test": "Hello World"}, "status": 200}
     ]
@@ -209,7 +210,7 @@
 def test_batch_fails_if_is_empty(client):
     response = client.post(batch_url_string(), "[]", "application/json")
 
-    assert response.status_code == 400
+    assert response.status_code == HTTPStatus.BAD_REQUEST
     assert response_json(response) == {
         "errors": [{"message": "Received an empty list in the batch request."}]
     }
@@ -222,7 +223,7 @@
         "application/json",
     )
 
-    assert response.status_code == 200
+    assert response.status_code == HTTPStatus.OK
     assert response_json(response) == {"data": {"writeTest": {"test": "Hello 
World"}}}
 
 
@@ -233,7 +234,7 @@
         "application/x-www-form-urlencoded",
     )
 
-    assert response.status_code == 200
+    assert response.status_code == HTTPStatus.OK
     assert response_json(response) == {"data": {"test": "Hello World"}}
 
 
@@ -247,7 +248,7 @@
         "application/json",
     )
 
-    assert response.status_code == 200
+    assert response.status_code == HTTPStatus.OK
     assert response_json(response) == {"data": {"test": "Hello Dolly"}}
 
 
@@ -262,7 +263,7 @@
         "application/json",
     )
 
-    assert response.status_code == 200
+    assert response.status_code == HTTPStatus.OK
     assert response_json(response) == [
         {"id": 1, "data": {"test": "Hello Dolly"}, "status": 200}
     ]
@@ -278,7 +279,7 @@
         "application/json",
     )
 
-    assert response.status_code == 200
+    assert response.status_code == HTTPStatus.OK
     assert response_json(response) == {"data": {"test": "Hello Dolly"}}
 
 
@@ -293,7 +294,7 @@
         "application/json",
     )
 
-    assert response.status_code == 200
+    assert response.status_code == HTTPStatus.OK
     assert response_json(response) == [
         {"id": 1, "data": {"test": "Hello Dolly"}, "status": 200}
     ]
@@ -311,7 +312,7 @@
         "application/x-www-form-urlencoded",
     )
 
-    assert response.status_code == 200
+    assert response.status_code == HTTPStatus.OK
     assert response_json(response) == {"data": {"test": "Hello Dolly"}}
 
 
@@ -322,7 +323,7 @@
         "application/json",
     )
 
-    assert response.status_code == 200
+    assert response.status_code == HTTPStatus.OK
     assert response_json(response) == {"data": {"test": "Hello Dolly"}}
 
 
@@ -333,7 +334,7 @@
         "application/x-www-form-urlencoded",
     )
 
-    assert response.status_code == 200
+    assert response.status_code == HTTPStatus.OK
     assert response_json(response) == {"data": {"test": "Hello Dolly"}}
 
 
@@ -344,7 +345,7 @@
         "application/graphql",
     )
 
-    assert response.status_code == 200
+    assert response.status_code == HTTPStatus.OK
     assert response_json(response) == {"data": {"test": "Hello Dolly"}}
 
 
@@ -365,7 +366,7 @@
         "application/json",
     )
 
-    assert response.status_code == 200
+    assert response.status_code == HTTPStatus.OK
     assert response_json(response) == {
         "data": {"test": "Hello World", "shared": "Hello Everyone"}
     }
@@ -389,7 +390,7 @@
         "application/json",
     )
 
-    assert response.status_code == 200
+    assert response.status_code == HTTPStatus.OK
     assert response_json(response) == [
         {
             "id": 1,
@@ -413,7 +414,7 @@
         "application/graphql",
     )
 
-    assert response.status_code == 200
+    assert response.status_code == HTTPStatus.OK
     assert response_json(response) == {
         "data": {"test": "Hello World", "shared": "Hello Everyone"}
     }
@@ -430,7 +431,7 @@
 
     # Check graphiql works
     response = client.get(url_string(inherited_url), HTTP_ACCEPT="text/html")
-    assert response.status_code == 200
+    assert response.status_code == HTTPStatus.OK
 
 
 @pytest.mark.urls("graphene_django.tests.urls_pretty")
@@ -452,7 +453,7 @@
 
 def test_handles_field_errors_caught_by_graphql(client):
     response = client.get(url_string(query="{thrower}"))
-    assert response.status_code == 200
+    assert response.status_code == HTTPStatus.OK
     assert response_json(response) == {
         "data": None,
         "errors": [
@@ -467,7 +468,7 @@
 
 def test_handles_syntax_errors_caught_by_graphql(client):
     response = client.get(url_string(query="syntaxerror"))
-    assert response.status_code == 400
+    assert response.status_code == HTTPStatus.BAD_REQUEST
     assert response_json(response) == {
         "errors": [
             {
@@ -481,7 +482,7 @@
 def test_handles_errors_caused_by_a_lack_of_query(client):
     response = client.get(url_string())
 
-    assert response.status_code == 400
+    assert response.status_code == HTTPStatus.BAD_REQUEST
     assert response_json(response) == {
         "errors": [{"message": "Must provide query string."}]
     }
@@ -490,7 +491,7 @@
 def test_handles_not_expected_json_bodies(client):
     response = client.post(url_string(), "[]", "application/json")
 
-    assert response.status_code == 400
+    assert response.status_code == HTTPStatus.BAD_REQUEST
     assert response_json(response) == {
         "errors": [{"message": "The received data is not a valid JSON query."}]
     }
@@ -499,7 +500,7 @@
 def test_handles_invalid_json_bodies(client):
     response = client.post(url_string(), "[oh}", "application/json")
 
-    assert response.status_code == 400
+    assert response.status_code == HTTPStatus.BAD_REQUEST
     assert response_json(response) == {
         "errors": [{"message": "POST body sent invalid JSON."}]
     }
@@ -514,14 +515,14 @@
     valid_json = json.dumps({"foo": "bar"})
     response = client.post(url_string(), valid_json, "application/json")
 
-    assert response.status_code == 400
+    assert response.status_code == HTTPStatus.BAD_REQUEST
     assert response_json(response) == {"errors": [{"message": "foo-bar"}]}
 
 
 def test_handles_incomplete_json_bodies(client):
     response = client.post(url_string(), '{"query":', "application/json")
 
-    assert response.status_code == 400
+    assert response.status_code == HTTPStatus.BAD_REQUEST
     assert response_json(response) == {
         "errors": [{"message": "POST body sent invalid JSON."}]
     }
@@ -533,7 +534,7 @@
         "query helloWho($who: String){ test(who: $who) }",
         "text/plain",
     )
-    assert response.status_code == 400
+    assert response.status_code == HTTPStatus.BAD_REQUEST
     assert response_json(response) == {
         "errors": [{"message": "Must provide query string."}]
     }
@@ -545,7 +546,7 @@
             query="query helloWho($who: String){ test(who: $who) }", 
variables="who:You"
         )
     )
-    assert response.status_code == 400
+    assert response.status_code == HTTPStatus.BAD_REQUEST
     assert response_json(response) == {
         "errors": [{"message": "Variables are invalid JSON."}]
     }
@@ -553,7 +554,7 @@
 
 def test_handles_unsupported_http_methods(client):
     response = client.put(url_string(query="{test}"))
-    assert response.status_code == 405
+    assert response.status_code == HTTPStatus.METHOD_NOT_ALLOWED
     assert response["Allow"] == "GET, POST"
     assert response_json(response) == {
         "errors": [{"message": "GraphQL only supports GET and POST requests."}]
@@ -563,7 +564,7 @@
 def test_passes_request_into_context_request(client):
     response = client.get(url_string(query="{request}", q="testing"))
 
-    assert response.status_code == 200
+    assert response.status_code == HTTPStatus.OK
     assert response_json(response) == {"data": {"request": "testing"}}
 
 
@@ -857,7 +858,7 @@
     response = client.post(
         url_string("/graphql/", query="{__schema {queryType {name}}}")
     )
-    assert response.status_code == 200
+    assert response.status_code == HTTPStatus.OK
 
     assert response_json(response) == {
         "data": {"__schema": {"queryType": {"name": "QueryRoot"}}}
@@ -869,7 +870,7 @@
 def test_validation_disallow_introspection(client, url):
     response = client.post(url_string(url, query="{__schema {queryType 
{name}}}"))
 
-    assert response.status_code == 400
+    assert response.status_code == HTTPStatus.BAD_REQUEST
 
     json_response = response_json(response)
     assert "data" not in json_response
@@ -888,7 +889,7 @@
 def test_within_max_validation_errors(client, url):
     response = client.post(url_string(url, 
query=QUERY_WITH_TWO_INTROSPECTIONS))
 
-    assert response.status_code == 400
+    assert response.status_code == HTTPStatus.BAD_REQUEST
 
     json_response = response_json(response)
     assert "data" not in json_response
@@ -913,7 +914,7 @@
 def test_exceeds_max_validation_errors(client, url):
     response = client.post(url_string(url, 
query=QUERY_WITH_TWO_INTROSPECTIONS))
 
-    assert response.status_code == 400
+    assert response.status_code == HTTPStatus.BAD_REQUEST
 
     json_response = response_json(response)
     assert "data" not in json_response

Reply via email to