Commit Graph

59 Commits

Author SHA1 Message Date
Jean-Louis Fuchs
b9f0e4f9ae
Make tests order independent (#932)
* Reset the global registry after each test (teardown)

* Create a settings fixtures that returns graphene_settings and resets
  the graphene_settings after use (teardown)

* Convert test_mutation tests from unittests.TestCase to pytest

* Convert test_mutation PetType to a pet_type fixtures that reregisters
  the type
2020-04-20 13:23:20 +01:00
Amim Knabben
a12fc9299a
Exclude read_only fields from input (#882) 2020-02-23 09:48:33 +00:00
B4rtware
6a19ab5a4b
use to_representation in favor of get_attribute (#848)
* use `to_represenation` in favor of `get_attribute`

* fix datetime type does get converted to a string

to_representation will convert the datetime field into a string representation. However the to_representation on the method field will only call its underlying method.

* fix add missing import

* apply black formatter

* add test for serializer method field

* apply black format

* improve backward compatibility

by using date's class contructor instead of fromisostring

* apply black format

* fix black format issue
2020-02-21 17:42:47 +00:00
Leeward Bound
83bc32bc9d
Adding support for disabling enum creation on SerializerMutation (#851) 2020-02-07 10:17:56 +00:00
dan-klasson
7940a7b954 added support for partial updates in serializers (#731)
* added support for partial updates in serializers

* Add test to verify partial updates

Co-authored-by: Jonathan Kim <jkimbo@gmail.com>
2019-12-27 14:46:48 +00:00
Jason Kraus
a64ba65bef convert DRF ChoiceField to Enum (#537)
* convert DRF ChoiceField to Enum, also impacts FilePathField

* Pep8 fixes

* DRF multiple choices field converts to list of enum

* apply black formatting
2019-09-22 21:13:12 +01:00
Jonathan Kim
b7e4937775
Alias only_fields as fields and exclude_fields as exclude (#691)
* Create new fields and exclude options that are aliased to exclude_fields and only_fields

* Update docs

* Add some checking around fields and exclude definitions

* Add all fields option

* Update docs to include `__all__` option

* Actual order of fields is not stable

* Update docs/queries.rst

Co-Authored-By: Semyon Pupkov <semen.pupkov@gmail.com>

* Fix example code

* Format code

* Start raising PendingDeprecationWarnings for using only_fields and exclude_fields

* Update tests
2019-07-09 14:03:11 +01:00
Pablo Burgos
a2103c19f4 Fix error of multiple inputs with the same type. When using same serializer. (#530) 2019-07-09 09:14:04 +01:00
Jonathan Kim
0988e0798a
Adds documentation to CAMELCASE_ERRORS setting (#689)
* Rename setting and add documentation

* Add examples

* Use `cls`
2019-07-08 22:22:08 +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
Jonathan Kim
692540cc78
Update flake8 (#688)
* Include setup.py in black formatting

* Add new flake8 plugins and update errors to look for

* Fix duplicate test name

* Don't use mutable data structure

* Install all dev dependencies for flake8 and black tox envs
2019-06-24 18:55:44 +01:00
Jonathan Kim
775d2e3523
Update travis and tox (#667)
* Update travis and tox

* Use xenial distribution

* Don't install coveralls twice

* Add black and flake8 tox commands

* Remove Python 3.5 test for Django master

* Fix indent

* Ignore migrations

* Remove black for now

* Run black formatting (#668)

* Run black format

* Update makefile

* Add black to travis build
2019-06-10 20:54:30 -07:00
kamilkijak
c90c27f364 Add support for write_only fields in SerializerMutation (#555) 2019-06-09 16:25:34 -07:00
Patrick Arminio
923d8282c7 Fix duplicated ErrorType declaration (#539)
* Add failing test case

* Fix duplicated ErrorType declaration
2019-03-31 12:01:43 +01:00
Syrus Akbary
54ef52e1c6 Reformatted files using black 2018-07-19 16:52:24 -07:00
Syrus Akbary
a480a39713
Merge pull request #326 from pizzapanther/drf-serializer-update
DRF Serializer update
2018-03-29 23:22:14 -07:00
mbarrientos
3793ce17c0 Add support for ListSerializer fields in SerializerMutation 2018-02-13 12:12:50 +01:00
Syrus Akbary
adde400893
Merge pull request #335 from urbandove/master
models.DateField => graphene Date Scalar
2018-02-08 12:14:13 -08:00
Paul Bailey
91a99ee39c serializer update support 2018-02-06 13:37:28 -06:00
Syrus Akbary
c585982a1a
Merge pull request #382 from patrick91/patch-1
Improve ErrorType
2018-02-03 22:25:03 -08:00
Patrick Arminio
6a152820ca
Improve ErrorType
Marks some fields as required and non null, it also prevents to do useless checks on the frontend if using a typed language.
2018-02-01 09:52:16 +00:00
=
1352d4e02b Fix func names 2017-12-18 12:33:42 -05:00
=
65e63026a0 Add tests 2017-12-11 21:23:00 -05:00
=
62c0694901 models.DateField corresponds to graphene Date Scalar 2017-12-05 15:04:29 -05:00
Paul Bailey
6cfd5b2854 added line ending 2017-11-14 22:10:26 +00:00
Paul Bailey
345fe877c4 added ModelSerializer tests 2017-11-13 20:35:00 +00:00
Paul Bailey
c72e7e55eb added ModelSerializer tests 2017-11-13 20:33:12 +00:00
Paul Bailey
75e11a8195 add created field to test 2017-11-13 16:06:07 +00:00
Paul Bailey
e05f41af40 fixed indentation 2017-11-12 23:10:29 +00:00
Paul Bailey
e7391937dd fixes #322, fixed incorrect serializer instance usage 2017-11-10 21:49:48 +00:00
Syrus Akbary
2a73e5e479 Fixed flake 2017-09-01 00:52:57 -07:00
Andy Clayton
c130490b4f ensure SerializerMutation.errors is None on success in 2.x
Upon success the result was correct but also included:

"errors": [
  {
    "message": "User Error: expected iterable, but did not find one
for field <SerializerMutation_Subclass>Payload.errors."
  }
]

This seemed to be due to Payload.errors defaulting to graphene.List
rather than unset or None. Unsure what exactly changed with 2.x to break
this, so I welcome a better fix, but explicitly setting errors to None
also seems easy enough.
2017-08-31 12:37:54 -05:00
Andy Clayton
cc58b91e43 fix SerializerMutation regression for 2.x
72529b7 seems to break SerializerMutation by commenting out support for
input fields. As a result input only ever had a clientMutationId field.
2017-08-31 12:21:50 -05:00
Syrus Akbary
3d58148f03 Code adapted to new resolver API 2017-07-28 09:43:27 -07:00
Syrus Akbary
72529b70bb Fixed all tests and flake issues 2017-07-24 23:42:40 -07:00
Syrus Akbary
48bcccdac2 Improved integration with Graphene 2.0 2017-07-24 22:27:50 -07:00
Jacob Foster
afbe6c90b7 Add nested model mutation tests 2017-07-18 14:02:29 -05:00
Jacob Foster
81a6dff9d0 Update field converter tests 2017-07-18 14:02:28 -05:00
Jacob Foster
ee23638378 Add converters for datetime fields 2017-07-11 13:35:12 -05:00
Jacob Foster
302ea0d3cf Account for nested ModelSerializers 2017-07-11 13:29:30 -05:00
Patrick Arminio
93bbc194bf Add missing new line 2017-06-29 09:59:21 +01:00
Patrick Arminio
5c3306e78d Return empty errors when successful 2017-06-26 18:16:55 +01:00
Patrick Arminio
000ef6c42e Fix result from mutation 2017-06-26 18:03:01 +01:00
Patrick Arminio
1a04d608ed Add support for MultipleChoiceField 2017-06-26 14:32:57 +01:00
Patrick Arminio
510ee9383e Add support for JSONField 2017-06-26 14:28:03 +01:00
Patrick Arminio
0e2c736c74 Add test for image field 2017-06-26 14:26:26 +01:00
Patrick Arminio
66d1875eb7 Fix missing path 2017-06-26 14:25:57 +01:00
Patrick Arminio
b500ffb8b0 Add test for IPAddressField 2017-06-26 14:24:16 +01:00
Patrick Arminio
47c5dfcab7 Add test for FilePathField 2017-06-26 14:23:45 +01:00
Patrick Arminio
772e2d114a Add test for file field 2017-06-26 14:23:17 +01:00