Commit Graph

480 Commits

Author SHA1 Message Date
Sebastián Sastoque H
fe66b48d38
Fix main branch tests failing due to wrong instancing of Missing class (#1135)
Co-authored-by: Sebastian Hernandez <sebastian@rhinoafrica.com>
2021-03-02 10:46:35 -08:00
Jason Kraus
e9f25ecf2d
enhancement: DjangoDebugContext captures exceptions and allows captured stack traces to be queried (#1122) 2021-03-02 10:45:46 -08:00
Thomas Leonard
6046a710c8
fix: declaration of required variable in filters v3 (#1137)
* fix: declaration of required variable

* Add unit test

* Fix formating

Co-authored-by: Thomas Leonard <thomas@loftorbital.com>
2021-02-26 14:44:43 -08:00
Sebastián Sastoque H
ea593b673f
Fix: Use resolver passed as an attribute (#1131)
Co-authored-by: Sebastian Hernandez <sebastian@rhinoafrica.com>
2021-02-23 09:50:19 -08: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
Thomas Leonard
2d4ca0ac7b
Add enum support to filters and fix filter typing (v3) (#1119)
* - Add filtering support for choice fields converted to graphql Enum (or not)
- Fix type of various filters (used to default to String)
- Fix bug with contains introduced in previous PR
- Fix bug with declared filters being overridden (see PR #1108)
- Fix support for ArrayField and add documentation

* Fix for v3

Co-authored-by: Thomas Leonard <thomas@loftorbital.com>
2021-02-22 20:21:32 -08:00
andrei-datcu
5ce4553244
Fix schema dump on windows (#1123)
Without explicitly setting the encoding to "utf-8" I get the following error on windows (python 3.9)

```
  File "D:\env\lib\site-packages\graphene_django\management\commands\graphql_schema.py", line 115, in handle
    self.get_schema(schema, out, indent)
  File "D:\env\lib\site-packages\graphene_django\management\commands\graphql_schema.py", line 72, in get_schema
    self.save_graphql_file(out, schema)                                                                                   
  File "D:\env\lib\site-packages\graphene_django\management\commands\graphql_schema.py", line 59, in save_graphql_file      
    outfile.write(print_schema(schema.graphql_schema))                                                                    
  File "C:\Users\u\AppData\Local\Programs\Python\Python39\lib\encodings\cp1252.py", line 19, in encode 
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
```
2021-02-22 20:20:59 -08:00
Yves-Gwenael Bourhis
007768b454
Fix subscriptions in JS (#1124) 2021-02-22 20:19:20 -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
Tonye Jack
52880166bd
Remove unused imports (#1127)
* Remove unused imports

* Update converter.py
2021-02-22 20:10:30 -08:00
Jason Kraus
4573d3db53
Fix test main (#1126)
Co-authored-by: Thomas Leonard <thomas@loftorbital.com>
2021-02-20 14:26:06 -08:00
Lucas
5dea6ffa41
Support "contains" and "overlap" filtering (v3) (#1101)
* Support contains/overlap filters

* Remove unused fixtures
2021-01-18 21:39:22 -08:00
Jason Kraus
bcc7f85dad
Add BlankField and mount enums using it v3 (#1096)
* Add BlankField and mount enums using it

* fix lint error from duplicate import

Co-authored-by: Jonathan Kim <jkimbo@gmail.com>
2021-01-11 16:34:50 -08:00
Thomas Leonard
10e48c27b7
Validate in and range filter inputs (#1090)
Co-authored-by: Thomas Leonard <thomas@loftorbital.com>
2021-01-09 19:15:21 -08:00
Ülgen Sarıkavak
ea84827ab8
Fix backward compability on GraphQLTestCase._client setter (#1094) 2021-01-09 19:14:54 -08:00
Lucas
fdeadf5ce5
Fix project setup (#1087)
* Fix project setup

* Fix test_should_query_postgres_fields
2021-01-02 09:46:00 -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
Thiago Bellini Ribeiro
8c48516093
Also convert BaseCSVFilter for custom fields (#1081) 2020-12-30 21:03:57 -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
Jason Kraus
2d0b9ddd42
improvement: convert decimal field to graphene decimal (#1083) 2020-12-30 08:25:41 -08:00
Jason Kraus
558288afce v2.14.0 2020-12-22 20:23:41 -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
a51c2bffd9
Allow to use camel case in order by field (#1054)
Fixes #1008
2020-12-22 20:15:38 -08:00
Leonardo Arroyo
0e12343853
Fix issue #1055 (#1056)
* Fix issue #1055

* Fix if to elif

* Use self.stdout.write instead of print when printing graphql schema

Co-authored-by: leonardo arroyo <[contato@leonardoarroyo.com](mailto:contato@leonardoarroyo.com)>
2020-12-22 20:13:34 -08:00
Semyon Pupkov
cc3bd05472
Replace Unidecode package with text_unidecode package #1014 (#1060)
Closes #1014
2020-12-22 20:12:22 -08:00
Thomas Leonard
99512c53a1
fix: in and range filters on DjangoFilterConnectionField (#1070)
Co-authored-by: Thomas Leonard <thomas@loftorbital.com>
2020-12-22 20:10:39 -08:00
Jason Kraus
7b35695067
Fix 1061: DjangoListField should not cache queries (#1063)
* fix( DjangoListField ): test that default functionality should resolve/call queryset at view time, first attempt at solution

* fix( DjangoListField ): DjangoListField defines get_manager just like DjangoConnectionField for a better variable name default_manager instead of default_queryset

* fix: apply specific black formatting
2020-12-22 20:10:28 -08:00
Thomas Leonard
454b74052e
Fix backward Relay pagination (#1046)
* Fix backward Relay pagination

* linting

Co-authored-by: Thomas Leonard <thomas@loftorbital.com>
2020-12-22 20:04:45 -08:00
Ülgen Sarıkavak
4c0c821b74
Register MultipleChoiceField as list type (#1033)
In general I welcome reviews even from non-maintainers to build confidence. I haven't seen any objections and this has sat with approval for a week so I am going to go ahead and merge.
2020-11-28 10:30:18 -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
Thomas Leonard
2140be5e6a
Add offset pagination (#1013)
* Add offset filtering

* Formatting

Co-authored-by: Thomas Leonard <thomas@loftorbital.com>
2020-10-26 09:09:21 -07:00
Roberto Barreda
8408c51bf9
fix variables key in body (#1050) 2020-10-26 09:09:49 +00:00
CBuiVNG
65f41c1a17
BUGFIX: don't filter out lookup_field as input (required for update) (#1029) 2020-10-19 17:25:35 +01:00
Andreas Hasenkopf
ee3d4f521f
Include tests and examples in source package, but don't install them (#1034)
..., but don't install them.
Also applied changes as suggested by `black`.
2020-10-19 17:23:41 +01:00
Josh Warwick
19e3eddddb
Allow passing of meta object in SerializerMutation options (#1028) 2020-08-26 16:03:08 +01:00
Ülgen Sarıkavak
26960359a2
Add msg params to testing class (#1032) 2020-08-26 15:58:48 +01:00
Jonathan Kim
b1b57d815a
v3.0.0b6 2020-08-12 07:18:02 +01:00
Jonathan Kim
53023423b6 Fix import 2020-08-12 07:14:48 +01:00
Jonathan Kim
5b1451132d
v2.13.0 2020-08-12 07:10:01 +01:00
Jonathan Kim
33c6a54414 Merge branch 'master' into v3 2020-08-12 07:06:35 +01:00
Jonathan Kim
bd553be10e
Fix JSONField import (#1021) 2020-08-12 07:03:23 +01:00
Nikolai Røed Kristiansen
67a0492c12
Add converter for django 3.1 JSONField (#1017) 2020-08-07 10:22:15 +01:00
Thomas Leonard
11dbde3bea
Fix Connection/Edge naming and add unit test (#1012)
Co-authored-by: Thomas Leonard <thomas@loftorbital.com>
2020-08-07 10:15:35 +01:00
Radosław Kowalski
55769e814f
Add headers support to GraphiQL (#1016)
Co-authored-by: Jonathan Kim <jkimbo@gmail.com>
2020-08-07 10:13:26 +01:00
Jonathan Kim
da9f41c295 Rename get_resolver -> wrap_resolve and fix tests 2020-08-06 20:45:30 +01:00
Jonathan Kim
62f95f2858
v3.0.0b5 2020-08-06 20:35:44 +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
Mel van Londen
b552dcac24 bump version number 2020-07-13 14:12:42 -07:00