Commit Graph

39 Commits

Author SHA1 Message Date
Alexandre Detiste
269225085d
remove dead code: singledispatch has been in the standard library ... (#1534)
* remove dead code: singledispatch has been in the stard library for many years

(BTW this function does not seems to be used anywhere anymore)

* lint
2024-09-15 21:50:15 +07:00
Kien Dang
36cf100e8b
Use ruff format to replace black (#1473)
* Use ruff format to replace black

* Adjust ruff config to be compatible with ruff-format

https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules

* Format

* Replace black with ruff format in Makefile
2023-10-25 11:33:00 +03:00
Kien Dang
e8f36b018d
Fix test Client headers for Django 4.2 (#1465)
* Fix test Client headers for Django 4.2

* Lazy import pkg_resources

since it could be quite heavy

* Remove use of pkg_resources altogether
2023-09-18 23:23:53 +08:00
Kien Dang
9a773b9d7b
Use ruff in pre-commit (#1441)
* Use ruff in pre-commit

* Add pyupgrade

* Add isort

* Add bugbear

* Fix B015 Pointless comparison

* Fix B026

* B018 false positive

* Remove flake8 and isort config from setup.cfg

* Remove black and flake8 from dev dependencies

* Update black

* Show list of fixes applied with autofix on

* Fix typo

* Add C4 flake8-comprehensions

* Add ruff to dev dependencies

* Fix up
2023-08-06 01:47:00 +03:00
Tom Dror
b1abebdb97
Support base class relations and reverse for proxy models (#1380)
* support reverse relationship for proxy models

* support multi table inheritence

* update query test for multi table inheritance

* remove debugger

* support local many to many in model inheritance

* format and lint

---------

Co-authored-by: Firas K <3097061+firaskafri@users.noreply.github.com>
2023-07-18 20:17:45 +03:00
Laurent
0de35ca3b0
fix: fk resolver permissions leak (#1411)
* fix: fk resolver permissions leak

* fix: only one query for 1o1 relation

* tests: added queries count check

* fix: docstring

* fix: typo

* docs: added warning to authorization

* feat: added bypass_get_queryset decorator
2023-07-18 15:16:52 +03:00
Nikolai Røed Kristiansen
4517e32224
👷 Add pre-commit (#1336)
* 🔧 Add pre-commit config

Similar to graphene and graphene-sqlalchemy

* ⬆ Bump black

* 👷 Lint on CI

* ⬆ Bump flake8-black

* 🔧 Keep excluding migrations

* ⬆ Bump flake8

* 🔧 Remove black and flake8 from tox config

* ⬆ Update pre-commit versions

* Upgrade syntax to python 3.7+

* Format with pre-commit

dedent docs/schema.py to allow formatting

* Fix tests on python 3.7
2022-10-19 17:10:30 +03:00
Syberen van Munster
bb03306075
Move testing endpoint to settings (#1105)
* Import testing endpoint from graphene settings

* Add documentation for TESTING_ENDPOINT setting

* Remove empty lines

* Run formatter

Co-authored-by: Firas K <3097061+firaskafri@users.noreply.github.com>
2022-09-26 01:56:22 +03:00
Thomas Leonard
42a40b4df0
chore: update dev dependencies (#1345)
Co-authored-by: Thomas Leonard <thomas@loftorbital.com>
2022-09-22 10:26:21 +01:00
Aaron Forsander
f6ec0689c1
Fix documentation references: op_name -> operation_name (#1312) 2022-03-03 16:58:48 +03:00
Tim Schilling
5d5d7f1815
Django v4, python 3.10 support for graphene-django v3 (#1281)
Co-authored-by: Yair Silbermintz <MisterGlass@users.noreply.github.com>
2022-01-07 20:26:07 +00:00
Tonye Jack
5cee41407c
Added GraphQLTransactionTestCase (#1099)
* Added GraphQLTransactionTestCase

- Adds support for testing code that is executed within a transaction

Reference: https://docs.djangoproject.com/en/3.1/topics/testing/tools/#django.test.TransactionTestCase
```
 For instance, you cannot test that a block of code is executing within a transaction, as is required when using select_for_update(). In those cases, you should use TransactionTestCase.
```

* Update testing.py

* Update testing.py

* Fixed formatting.

* Updated docs.

* Updated test.

* Update testing.rst
2021-02-22 20:24:02 -08:00
Jiahao Li
beb2e4aae3
Doc clarification for headers arg in testing utils (#1117)
I think it might be helpful to add an explicit hint that HTTP headers should be prepended with `HTTP_` as required by `django.test.Client` (at least it was not super obvious to me when I tried to use it).
2021-02-22 20:13:49 -08:00
Ülgen Sarıkavak
ea84827ab8
Fix backward compability on GraphQLTestCase._client setter (#1094) 2021-01-09 19:14:54 -08:00
Jason Kraus
8324d47999 Merge branch 'v2' into main 2020-12-30 22:31:41 -08:00
Ülgen Sarıkavak
40e5252936
Use the Django TestCase's Client (#1084)
* Use the Django Client test utility instance that Django provides with its TestCase class. This allows GraphQL tests to make use of the stateful client methods like login()

* Add missing test case initializer call

* Don't break backward compability

* Add test for pending deprecation warning on GraphQLTestCase._client

Co-authored-by: Tom Nightingale <tom@tnightingale.com>
2020-12-30 21:12:24 -08:00
Jason Kraus
c049ab7470
WIP: Merge master into v3 (#1086)
* merge master into v3

* fix order_by snake casing by checking if value is None, switch executor to execution_context_class since schema.execute no longer supports executor

* fix linting by removing duplicate defintion and test of convert_form_field_to_string_list
2020-12-30 15:37:57 -08:00
Ignacio Orlandini
8f63199a63
Handle database transactions (#1039)
* Handle Django database atomic requests

* Create and handle database atomic mutations

* Make code compatible with Python 2.7

* Code style

* Define set_rollback instead of using the one in rest_framework.views because of backward compatibility

* Implement mock.patch.dict
2020-12-22 20:18:14 -08:00
Semyon Pupkov
cc3bd05472
Replace Unidecode package with text_unidecode package #1014 (#1060)
Closes #1014
2020-12-22 20:12:22 -08:00
Tonye Jack
4b7119d691
Add a default msg to show the response content. (#1064)
* Add a default msg to show the response content.

This seems like an issue with using assertResponseNoErrors and assertResponseHasErrors 

Which doesn't include any errors specific to the response and currently just shows.

```python
    self.assertNotIn("errors", list(content.keys()))
AssertionError: 'errors' unexpectedly found in ['errors', 'data']
```

* Update testing.py
2020-11-27 15:52:42 -08:00
Roberto Barreda
8408c51bf9
fix variables key in body (#1050) 2020-10-26 09:09:49 +00:00
Ülgen Sarıkavak
26960359a2
Add msg params to testing class (#1032) 2020-08-26 15:58:48 +01:00
Jonathan Kim
6cfcddac5a Merge branch 'master' into v3 2020-08-06 20:35:08 +01:00
Nikolai Røed Kristiansen
2308965658
Extract query function from GraphQLTestCase making it possible to use in a pytest fixture (#1015) 2020-08-05 20:24:16 +01:00
Jean-Louis Fuchs
08d0cce55a
Move to_const function from Graphene into Graphene-Django (#992) (#996)
Co-authored-by: Jonathan Kim <jkimbo@gmail.com>
2020-06-27 10:43:25 +01:00
Jonathan Kim
1bec8e44b7
Move to_const function from Graphene into Graphene-Django (#992) 2020-06-25 15:11:18 +01:00
Jonathan Kim
07c51092e1
Rename op_name to operation_name (#941) 2020-05-09 12:25:24 +01:00
Jonathan Kim
9bb0554c94 Merge branch 'master' into v3 2020-04-20 13:24:19 +01:00
Noelle Leigh
dc5c971498
Switch operation_name to operationName in GraphQLTestCase (#936)
* Add op_name test

* Replace "operation_name" with "operationName"

* Improve test comments

* Add method for Python 2.7
2020-04-19 21:11:33 +01:00
Ülgen Sarıkavak
dd0d6ef28f
Python 3 (#904)
* Remove Python 2 support

* Upgrade Python & Django versions

* Remove unsupported Django versions
* Remove unsupported Python versions
* Add Python 3.8

* Drop support for django-filter < 2

* Update LoginRequiredMixin doc link

* Remove redundant import

* Resolve RemovedInDjango40Warning warnings

* gql/graphene-django/graphene_django/tests/test_converter.py:175:
RemovedInDjango40Warning: django.utils.translation.ugettext_lazy() is
deprecated in favor of django.utils.translation.gettext_lazy().

* graphene-django/graphene_django/utils/utils.py:28:
RemovedInDjango40Warning: force_text() is deprecated in favor of
force_str().

* No need to use unicode strings with Python3

* Remove singledispatch dependency

singledispatch is inluded with Python >= 3.4, no need for external
package.
2020-04-06 13:21:07 +01:00
Chibuotu Amadi
b66a3f3479 Add headers arg to GraphQLTestCase.query (#827)
* Add headers arg to GraphQLTestCase.query

* fix headers NoneType case in GraphQLTestCase.query

* Run format

Co-authored-by: Jonathan Kim <jkimbo@gmail.com>
2019-12-26 11:45:18 +00:00
Misha K
b085b5922a add Django 3.0 to the test matrix (#793)
* add Django 3.0 to the test matrix

* fix six imports
2019-10-18 11:38:59 +01:00
Talley Lambert
254e59c36f Adds variables arg to GraphQLTestCase.query (#699)
* add variables arg in GraphQLTestCase.query

* update GraphQLTestCase.query docstring and remove type check
2019-09-07 11:49:29 -07:00
Semyon Pupkov
224725039b Asserting status code before decoding json in assertResponseNoEr… (#708) 2019-07-11 20:32:07 +01:00
Konstantin Alekseev
e2e496f505 Apply camel case converter to field names in DRF errors (#514)
* Apply camel case converter to field names in DRF errors

* Implement recursive error camelize, add setting.
2019-06-25 09:40:29 +01:00
Emil Goldsmith Olesen
3cde872e28 Stop enforcing csrf checks in GraphQLTestCase (#658) 2019-06-09 16:30:48 -07:00
José Roberto Meza Cabrera
ce6e6dd6e1 Fixes O2O relations 2019-06-09 14:15:46 -05:00
José Roberto Meza Cabrera
67b21cb36f Revert "Drop old Django compatibility code"
This reverts commit 6acd917cf7.
2019-06-09 14:08:31 -05:00
Paul Hallett
2bf7e7f66d
Fix importing error for GraphQLTestCase 2019-05-08 22:45:28 +01:00