Commit Graph

795 Commits

Author SHA1 Message Date
Sergey Petrunin
d4726dab81 Fix bug for not existent or ambiguous datetime during native to aware conversion in timezone with DST.
Ref: #4986
2017-03-18 23:13:26 -04:00
Sergey Petrunin
1ee54fb85c Added test for DateTimeField validation when server has timezone with DST and input is a native time in a DST shift interval.
Added pytz to requirements-testing.txt to reproduce the case.
2017-03-15 23:45:41 -04:00
Tom Christie
43b38964ea Support HEAD in viewsets 2017-03-13 12:51:03 +00:00
Asif Saifuddin Auvi
baea07c511 converted testing test asserts to pytest (#4949)
* converted testing test asserts to pytest

* moved 3rd arg from test_empty_post_uses_default_boolean_value test assert
2017-03-10 09:00:00 +00:00
Tom Christie
52db57a6e7 Version 3.6 (#4943) 2017-03-09 14:49:51 +00:00
Tibo Beijen
cf5d401a0e Allow required false and default (#4692)
* Default value will now be used when serializing if key or attribute is missing.
2017-03-07 13:19:19 +00:00
Tom Christie
68d2020112 Live API documentation (#4755) 2017-03-03 15:24:37 +00:00
Tim Watts
8df340908b Add failing tests and fix for dict that have a key items #4931 (#4932) 2017-03-03 09:23:09 +00:00
tdruez
d616c1591f Added a test to cover the DjangoModelPermissions #4927 issue
`DjangoObjectPermissions` and `DjangoModelPermissions` are now properly cover for the `METHOD_NOT_ALLOWED` issue
2017-03-01 09:50:21 +01:00
tdruez
c30ccac38e Added a failing test for #4927 2017-02-27 20:39:47 +01:00
Ran Benita
7a408f6cd2 Guard against the possible misspelling readonly_fields in model serializers
Fixes #4897.
2017-02-22 13:27:23 +02:00
Isaac Stone
289e1e440e Check for collection.Mapping instead of dict
issue #4901
2017-02-19 13:10:03 -08:00
Mariusz Felisiak
cd469f616a
Increased utils/encoders.py test coverage. 2017-02-15 07:17:33 +01:00
李扬
cbad236f6d Add max_length and min_length arguments for ListField (#4877) 2017-02-06 09:36:03 +00:00
Mariusz Felisiak
b99272c425
Fixed dedent for tab indent. 2017-01-31 20:57:52 +01:00
Artem Muterko
d610d150f1 Add test for pagination when limit not set 2017-01-31 16:51:09 +02:00
Mariusz Felisiak
3001b56e06 Fixed Django 2.0 compatibility due to django.conf.urls.include parameters change. (#4866) 2017-01-30 16:11:19 +00:00
Artem Muterko
31e9f7dfbb Add remaining tests for generics (#4865) 2017-01-30 11:08:03 +00:00
Artem Muterko
220be31791 Git add remaining tests for BaseSerializer (#4857) 2017-01-27 15:44:00 +00:00
Artem Muterko
d0eb2e6cae Add remaining tests for metadata (#4855) 2017-01-27 09:25:51 +00:00
Artem Muterko
21166a3ab6 Add couple of tests for filters (#4849) 2017-01-25 14:35:12 +00:00
Artem Muterko
48b5aa71f2 Refactor according to comments in PR (#4848) 2017-01-25 10:38:27 +00:00
Artem Muterko
9c8adb4812 Add couple of tests for compat module (#4845) 2017-01-24 12:50:35 +00:00
Mariusz Felisiak
6b399f1193 Fixed test_one_to_one_with_inheritance. Added required on_delete attribute to OneToOneField field. (#4838) 2017-01-24 09:56:46 +00:00
Mariusz Felisiak
5c0f9f147c Removed unnecessary utc wrapper. (#4839) 2017-01-23 16:22:32 +00:00
Artem Muterko
247954d497 Add tests for BasicAuthentication and TokenAuthentication (#4837)
* Add tests for BasicAuthentication

* Add tests for Token authentication

* Adjust test to pass on Django 1.8
2017-01-23 15:08:59 +00:00
José Padilla
d686b2cb15 Merge pull request #4834 from auvipy/slug
converted test asserts of relations slug to pytest
2017-01-20 15:42:20 -05:00
Asif Saifuddin Auvi
d2ae41529c fix wrong assert 2017-01-21 02:25:36 +06:00
Asif Saifuddin Auvi
63d8dc0b9b converted test asserts of relations slug to pytest 2017-01-21 02:14:33 +06:00
Artem Muterko
8043ff3fef Add test for urlquote_wrapper (#4832) 2017-01-20 20:09:47 +00:00
Asif Saifuddin Auvi
1ef334875f converted test asserts of hyperlin relations to pytest 2017-01-21 01:41:45 +06:00
Artem Muterko
0186b073bf Refactor router tests to pytest style 2017-01-19 18:00:07 +02:00
Artem Muterko
c2ce2fb3f0 Add tests for BaseContentNegotiation 2017-01-19 12:50:17 +02:00
Artem Muterko
076ca6e765 Add test for filter_renderers 2017-01-19 12:43:18 +02:00
Artem Muterko
46210205a4 Add tests for some template tags (#4815) 2017-01-18 20:41:32 +00:00
Artem Muterko
a8534baa41 Add remaining tests for validators (#4827) 2017-01-18 20:39:20 +00:00
Xavier Ordoquy
5e9249f429 Merge pull request #4824 from auvipy/newv
new matrix for python 3.6 and django 1.11
2017-01-18 17:24:44 +01:00
Asif Saifuddin Auvi
026a8d8707 make lint happy with isort --recursive 2017-01-18 22:15:44 +06:00
Asif Saifuddin Auvi
006ae46092 remove trailing comma 2017-01-18 21:40:07 +06:00
Asif Saifuddin Auvi
326e09dde9 added utc compat to tests of fields 2017-01-18 20:01:18 +06:00
Artem Muterko
0a496a423d Add tests for qs_exists (#4822) 2017-01-18 11:46:12 +00:00
Artem Muterko
06a5bcc88e Add mediatype tests (#4813) 2017-01-16 18:17:51 +00:00
Artem Muterko
e965270f51 Template html renderer tests (#4817) 2017-01-16 18:16:43 +00:00
Artem Muterko
41ac3565de Add test for delete field (#4819)
* Add test for delete field

* Remove unused import
2017-01-16 13:46:32 +00:00
Artem Muterko
514b5a6dd1 Add couple of test for AuthToken (#4816)
* Add couple of test for AuthToken

* PEP8 cleanup
2017-01-15 08:41:47 +00:00
José Padilla
5efbe17a86 Merge pull request #4808 from micgeronimo/pytest-cleanup
Refactor some tests to pytest style
2017-01-14 08:08:02 -05:00
Artem Muterko
ebd840c19f Revert several tests 2017-01-12 22:53:01 +02:00
Artem Muterko
c686749eef Throttle tests fix (#4810) 2017-01-12 17:53:48 +00:00
Artem Muterko
b4a9a1b9a3 Throttle tests (#4807) 2017-01-12 17:03:32 +00:00
Artem Muterko
9a6352789e Refactor request tests style 2017-01-12 18:41:27 +02:00
Artem Muterko
bd86104861 Refactor reverse tests style 2017-01-12 18:41:16 +02:00
Artem Muterko
401ab54275 Refactor schemas tests style 2017-01-12 18:33:24 +02:00
Asif Saifuddin Auvi
8fcb8d6350 converted metadata test asserts to pytest (#4806) 2017-01-12 08:21:15 +00:00
Artem Muterko
dd11bd42a2 Add remaining tests for SimpleRateThrottle (#4803) 2017-01-11 20:39:48 +00:00
Asif Saifuddin Auvi
14baf7eb7a converted serializer bulk update test asserts to pytest (#4805) 2017-01-11 20:38:32 +00:00
Artem Muterko
06afe6b1bf Convert tests to pytest style 2017-01-11 21:13:30 +02:00
Artem Muterko
66ffaaf5d3 Add more tests for Base and SimpleRate throttles (#4802) 2017-01-11 09:42:25 +00:00
Artem Muterko
e9d371f29a Add couple of basic tests for SimpleRateThrottle (#4800) 2017-01-09 20:43:54 +00:00
Artem Muterko
b6b2c4bb5b Renderer tests (#4791) 2017-01-08 16:33:43 +00:00
Artem Muterko
99d57df990 Convert encoders tests to pytest style (#4796) 2017-01-08 16:10:47 +00:00
Artem Muterko
a5fcf10c0e Raise RuntimeError when trying to encode coreapi objects (#4790) 2017-01-06 22:32:13 +00:00
José Padilla
559a0a89fc Merge pull request #4779 from auvipy/pyts0
converted throttling tests asserts to pytest
2017-01-04 10:31:44 -05:00
Asif Saifuddin Auvi
88a910ebc8 converted negotiation tests asserts to pytest 2017-01-04 18:58:01 +06:00
Asif Saifuddin Auvi
6ca7f76c67 Merge branch 'master' into pyts0 2017-01-04 18:43:55 +06:00
Asif Saifuddin Auvi
43677b8baf flake8 fix 2017-01-04 17:54:14 +06:00
Asif Saifuddin Auvi
8fa5846e51 conerted multi-table-inheritence test asserts to pytest 2017-01-04 17:46:55 +06:00
Asif Saifuddin Auvi
a7d33f4519 conerted throttling tests asserts to pytest 2017-01-04 15:59:21 +06:00
Asif Saifuddin Auvi
7874bcabe9 convert some more test asserts to pytest (#4778)
* converted urlpatterns test asserts to pytest

* converted test utils asserts to pytest

* removed extra newlines
2017-01-04 09:13:32 +00:00
Ryan P Kilby
11fd3bf108 Add disabling of declared fields on serializer subclasses (#4764)
* Add test for disabling declared fields on child
* Check that declared base field is not in attrs
* Update meta inheritance docs to include serializer
* Test that meta fields cannot be declared as None
* Add docs example for declarative field disabling
2017-01-03 21:14:19 +00:00
Matthew Medal
93fe531dea Breadcrumb view name suffix fix (#4750)
* add failing testcase for breadcrumb suffixes missing when using ModelViewSets

* fix get_breadcrumbs to honor overridden get_view_name and keep viewset suffixes

* ensure suffixes are appended in breadcrumb util
2016-12-20 22:19:00 +00:00
Asif Saifuddin Auvi
841a91e950 fix authentication_test pytest failure 2016-12-06 00:47:58 +06:00
Asif Saifuddin Auvi
85807e1958 converted authentication_test asserts to pytest 2016-12-06 00:33:13 +06:00
Asif Saifuddin Auvi
932d04a4be Browsable API tests asserts to pytest (#4725) 2016-12-01 16:17:36 +00:00
Asif Saifuddin Auvi
4f6c326a99 converted remaining unittes asserts of fields test to pytest (#4724) 2016-11-30 12:52:32 +00:00
Asif Saifuddin Auvi
1a741bb2a2 converted asserts of exceptions test to pytest (#4723) 2016-11-30 11:12:01 +00:00
Asif Saifuddin Auvi
7e8b01dbd2 converted asserts of encoders test to pytest 2016-11-30 16:45:48 +06:00
Asif Saifuddin Auvi
9a3f8d9a9c converted asserts of descriptions test to pytest 2016-11-30 16:42:43 +06:00
Asif Saifuddin Auvi
a9b6c97485 converted asserts of decorators test to pytest 2016-11-30 16:24:48 +06:00
Asif Saifuddin Auvi
504f4b44c6 converted asserts of atomic requests test to pytest 2016-11-30 16:17:30 +06:00
Asif Saifuddin Auvi
e03d88ced7 more pytest style assert (#4719) 2016-11-30 09:48:33 +00:00
Asif Saifuddin Auvi
10b5f36fec added fixes 2016-11-30 12:35:34 +06:00
Asif Saifuddin Auvi
f5a900a404 some reverts to fix test 2016-11-30 10:01:37 +06:00
Asif Saifuddin Auvi
a5bb9825f3 attempt to fix test again 2016-11-30 09:56:22 +06:00
Asif Saifuddin Auvi
4a0829d6ec attempt to fix test 2016-11-30 02:08:37 +06:00
Asif Saifuddin Auvi
27641e07b5 converted test asserts of generics-test to pytest 2016-11-30 01:13:21 +06:00
Ryan P Kilby
6498766749 Fix django deprecation warnings (#4712) 2016-11-29 09:49:18 +00:00
Asif Saifuddin Auvi
9f4c9691f4 converted filters tests asserts to pytest style (#4711) 2016-11-28 14:31:27 +00:00
Asif Saifuddin Auvi
42d6098c74 converted primary key relations test asserts to pytest (#4709) 2016-11-28 09:43:48 +00:00
Asif Saifuddin Auvi
cd3fd36d0e converted generic relations assert to pytest style 2016-11-27 23:55:09 +06:00
Asif Saifuddin Auvi
5ec223bca0 converted validators and write_only_fields test to pytest style (#4697) 2016-11-23 14:05:34 +00:00
Asif Saifuddin Auvi
4b59ec27fa convert tests asserts to pytest style (#4696) 2016-11-23 13:17:00 +00:00
Tom Christie
24791cb353 Invalidate any existing prefetch cache on PUT requests. (#4668) 2016-11-11 09:44:35 +00:00
Andrzej Pragacz
45e058d7ba Fix unhandled Http404, PermissionDenied in schema generation (#4645) (#4646) 2016-11-02 09:04:01 +00:00
Kennedy Mwenja
7038571157 Enable cursor pagination of value querysets. (#4569)
To do `GROUP_BY` queries in django requires one to use `.values()`
eg this groups posts by user getting a count of posts per user.

```
Posts.objects.order_by('user').values('user').annotate(post_count=Count('post'))
```

This would produce a value queryset which serializes its result
objects as dictionaries while `CursorPagination` requires a queryset
with result objects that are model instances.

This commit enables cursor pagination for value querysets.

- had to mangle the tests a bit to test it out. They might need
  some refactoring.
- tried the same for `.values_list()` but it turned out to be
  trickier than I expected since you have to use tuple indexes.
2016-11-01 10:42:01 +00:00
Nicolas Delaby
97d848413e Fix support of get_full_details() for Throttled exceptions (#4627)
Since `str` objects are immutable, appending to existing `str` creates
in fact a new `str` instance.

Thus `ErrorDetail.detail.code` attribute is lost after `str` concatenation operation.
2016-11-01 10:38:56 +00:00
Kieran Spear
98df932194 Fix FilterSet proxy (#4620) 2016-11-01 10:30:17 +00:00
Ryan P Kilby
d92b24a0b7 Make serializer fields import explicit (#4628) 2016-11-01 10:27:11 +00:00
Alex Kahan
895c67c9a2 Fixes #4532 (#4636) 2016-10-31 20:41:54 +00:00
Ryan P Kilby
eafc9a2393 Fix is_simple_callable with variable args, kwargs (#4622) 2016-10-25 20:47:24 +01:00
Tom Christie
0fe0e1e703 Fix schema base paths (#4611) 2016-10-21 16:59:34 +01:00
Tom Christie
f1bdce17b5 Fix for case of ListSerializer with single item (#4609) 2016-10-21 15:21:23 +01:00
Tom Christie
2395fb5386 Deprecate DjangoFilter backend (#4593)
Deprecate the built-in `rest_framework.filters.DjangoFilterBackend` in favour of the third-party `django_filters.rest_framework.DjangoFilterBackend`.
2016-10-20 10:47:09 +01:00
Tom Christie
de08f28a91 Test one to one with inheritance (#4575) 2016-10-13 14:21:23 +01:00
Tom Christie
8d0a91b002 Fix 3674 (#4571)
Handle ModelSerializer case for relationships to models with custom pk.
2016-10-13 12:43:43 +01:00
Alexey Evseev
2519ce9128 Fix schema generation with custom page_size pagination param (#4567) 2016-10-12 16:09:45 +01:00
Tom Christie
5677d063d8 Do not treat empty non-form input as HTML. (#4566) 2016-10-12 15:46:24 +01:00
Tom Christie
26e51ecd6c When HTML form input is used with JSONField, treat the input as a JSON encoded string, not a JSON primative. (#4565) 2016-10-12 14:04:10 +01:00
Tom Christie
b419970431 Handle empty data with serializer (#4564) 2016-10-12 10:47:17 +01:00
Tom Christie
7f29cfc931 Lazy hyperlink names (#4554) 2016-10-11 12:18:00 +01:00
Tom Christie
d0b3b6470a Fix prefetch_related updates. (#4553) 2016-10-11 11:07:40 +01:00
Tom Christie
a3802504a0 Error codes (#4550)
Add error codes to `APIException`
2016-10-11 10:25:21 +01:00
Tom Christie
0dec36eb41 Version 3.5 (#4525)
* Start test case

* Added 'requests' test client

* Address typos

* Graceful fallback if requests is not installed.

* Add cookie support

* Tests for auth and CSRF

* Py3 compat

* py3 compat

* py3 compat

* Add get_requests_client

* Added SchemaGenerator.should_include_link

* add settings for html cutoff on related fields

* Router doesn't work if prefix is blank, though project urls.py handles prefix

* Fix Django 1.10 to-many deprecation

* Add django.core.urlresolvers compatibility

* Update django-filter & django-guardian

* Check for empty router prefix; adjust URL accordingly

It's easiest to fix this issue after we have made the regex.  To try
to fix it before would require doing something different for List vs
Detail, which means we'd have to know which type of url we're
constructing before acting accordingly.

* Fix misc django deprecations

* Use TOC extension instead of header

* Fix deprecations for py3k

* Add py3k compatibility to is_simple_callable

* Add is_simple_callable tests

* Drop python 3.2 support (EOL, Dropped by Django)

* schema_renderers= should *set* the renderers, not append to them.

* API client (#4424)

* Fix release notes

* Add note about 'User account is disabled.' vs 'Unable to log in'

* Clean up schema generation (#4527)

* Handle multiple methods on custom action (#4529)

* RequestsClient, CoreAPIClient

* exclude_from_schema

* Added 'get_schema_view()' shortcut

* Added schema descriptions

* Better descriptions for schemas

* Add type annotation to schema generation

* Coerce schema 'pk' in path to actual field name

* Deprecations move into assertion errors

* Use get_schema_view in tests

* Updte CoreJSON media type

* Handle schema structure correctly when path prefixs exist. Closes #4401

* Add PendingDeprecation to Router schema generation.

* Added SCHEMA_COERCE_PATH_PK and SCHEMA_COERCE_METHOD_NAMES

* Renamed and documented 'get_schema_fields' interface.
2016-10-10 13:03:46 +01:00
Alex Kahan
4ff9e96b4c Adding tests to encoder.py (#4536) 2016-10-05 09:54:59 +01:00
Alex Kahan
915ac22aeb Adding tests for rest_framework.py (#4523) 2016-10-04 21:22:56 +01:00
Rowan Seymour
883efbc19f Case insensitive uniqueness validation (#4534) 2016-10-04 13:44:50 +01:00
Tom Christie
be74d11165 Fallback behavior for request parsing when request.POST already accessed. (#4500) 2016-09-21 11:49:09 +01:00
Tom Christie
4655501d51 Fix regression of RegexField. (#4490)
* Don't deepcopy 'regex' arguments, instead treat as immutable.
2016-09-15 12:44:45 +01:00
Mathieu Pillard
07efbdb45e Fix APIClient.get() when path contains unicode arguments (#4458) 2016-09-02 17:00:03 +01:00
José Padilla
d0ed482d70 Skip HiddenField from Schema fields (#4429) 2016-08-22 16:53:53 +01:00
Tom Christie
e3f8d06baf Include .action attribute on viewsets when generating schemas (#4408) 2016-08-15 17:10:55 +01:00
Tom Christie
101fd29039 Do not include uploads in request.POST (#4407) 2016-08-15 16:53:17 +01:00
Neil Parsons
7466b61e62 Don't strip empty query params when paginating (#4260) 2016-08-12 10:50:16 +01:00
Tom Christie
116917dbed Add form field descriptions to schemas (#4387) 2016-08-11 16:18:33 +01:00
Tom Christie
01b498ec51 Fix schema categories for custom list actions (#4386) 2016-08-11 14:07:40 +01:00
Tom Christie
b50d8950ee Pass request to schema generation (#4383)
Pass request to schema generation
2016-08-11 11:27:28 +01:00
Tom Christie
f16e880167 Stricter type validation for CharField. (#4380)
Stricter type validation for CharField
2016-08-10 17:22:19 +01:00
Tom Christie
f1a2eeb818 .choices property of RelatedField should preserve non-string values. (#4379)
Update RelatedField.choices to support non-string values
2016-08-10 16:38:59 +01:00
Tom Christie
9857cd9889 Add failing test for issue #3868 (#4378) 2016-08-10 16:04:32 +01:00
Daniel Hahler
378b04eeaa Fix handling of ALLOWED_VERSIONS and no DEFAULT_VERSION (#4370)
When only `ALLOWED_VERSIONS` but no `DEFAULT_VERSION` is specified, a
version should be enforced.
2016-08-10 15:19:56 +01:00
Tom Christie
48f3db36d6 Allow optional max_digits on DecimalField (#4377) 2016-08-10 14:39:26 +01:00
Tom Christie
8105a4ac5a Resolve form display with ChoiceField, MultipleChoiceField and non-string choices. (#4374)
* Add tests for html-form-rendering choice fields
* Resolve issues with ChoiceField, MultipleChoiceField and non-string options
* Ensure None template comparisons don't match string None
2016-08-10 12:02:33 +01:00
Dmitry Dygalo
e1768bdc16 Fixed various typos (#4366) 2016-08-08 09:32:22 +01:00
Tom Christie
d5178c9246 Include kwargs passed to 'as_view' when generating schemas (#4359) 2016-08-05 11:19:39 +01:00
Tom Christie
a9a097496e extra_kwargs takes precedence over uniqueness kwargs (#4349) 2016-08-02 14:33:15 +01:00
Tom Christie
5500b265bc Test cases for DictField with allow_null options (#4348) 2016-08-02 14:14:36 +01:00
Tom Christie
bda16a518a Dedent tabs. (#4347) 2016-08-02 13:33:14 +01:00
Tom Christie
e37619f741 Serializer defaults should not be included in partial updates. (#4346)
Serializer default values should not be included in partial updates
2016-08-02 13:05:12 +01:00
Tom Christie
3ef3fee926 Descriptive error from FileUploadParser when filename not included. (#4340)
* Descriptive error from FileUploadParser when filename not included.
* Consistent handling of upload filenames
2016-08-01 18:44:58 +01:00
Tom Christie
46a44e52aa Quantize incoming digitals (#4339) 2016-08-01 17:15:41 +01:00
Tom Christie
aa349fe767 Handle non-string input for IP fields (#4338) 2016-08-01 16:14:26 +01:00
Alexander Gaevsky
46a870c002 Fix schema generation for APIView, since it does not have get_serializer_class method. (#4285) 2016-07-27 15:36:36 +01:00
Tom Christie
351e0a4a99 Fix json indent parameter. Closes #4281 (#4313) 2016-07-27 11:49:01 +01:00
Tom Christie
5d3b56f957 Test case for #4272 (#4310)
* Test case for #4272
2016-07-26 16:28:10 +01:00
Sassan Haradji
f0f61aa077 use verbose_name instead of object_name in field_mapping (#4299)
* use verbose_name instead of object_name in error messages
2016-07-26 15:12:51 +01:00
Andi Albrecht
3ca0b15b17 Restore meta information for each search field. (#4298)
The meta information stored in opts needs to be restored for
each search field. Otherwise it references the wrong model
when an attribute of a related model comes before an attribute
of the original model in search fields. This doesn't apply to
m2m relations since must_call_distinct returns True in that
case.
2016-07-26 11:07:03 +01:00
Tom Christie
8385ae42c0 3.4.0 Release (#4258)
* 3.4.0 Release

* Version 3.4 release

* Full release notes

* Update translation files

* Update release documentation

* Update release notes

* Docs on supporting alternate schema formats

* Add schema_renderers to DefaultRouter
2016-07-13 16:30:41 +01:00
Mads Jensen
6defb8da47 lookup_type is deprecated in favor of lookup_expr (#4259)
* lookup_type is deprecated in favor of lookup_expr
* assertEquals is deprecated in favor of assertEqual
* app_name is a required keyword as of Django 1.10
2016-07-13 14:40:42 +01:00
kiyoqoko
6338ce80ab Add localize keyword argument to DecimalField (#4233)
Add `localize` keyword argument for DecimalField
2016-07-06 16:07:16 +01:00
Tom Christie
6ff9840bde Schemas & client libraries. (#4179)
* Added schema generation support.
* New tutorial section.
* API guide on schema generation.
* Topic guide on API clients.
2016-07-04 16:38:17 +01:00
Vadim
c752e9618f Fix test for py32-django18. 2016-06-29 10:21:28 +03:00