-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow include/exclude query parameters and delimiter to be conf…
…igurable in settings (#33) * feat: allow include/exclude query parameters and delimiter to be configurable in settings * add tests/docs * tweak FAQ --------- Co-authored-by: wim glenn <[email protected]>
- Loading branch information
Showing
6 changed files
with
60 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,5 @@ | |
) | ||
|
||
ROOT_URLCONF = 'tests.app.urls' | ||
|
||
USE_TZ = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from django.test import override_settings | ||
from rest_framework.test import APIClient | ||
|
||
from tests.utils import decode_content | ||
|
||
|
||
@override_settings(DRF_QUERYFIELDS_EXCLUDE_ARG_NAME="omit") | ||
def test_list_response_filtered_excludes(): | ||
response = APIClient().get('/quotes/?omit=line') | ||
expected = [ | ||
{ | ||
'character': 'Customer', | ||
'sketch': 'CHEESE SHOP', | ||
}, | ||
{ | ||
'character': 'The Black Knight', | ||
'sketch': 'HOLY GRAIL', | ||
}, | ||
] | ||
content = decode_content(response) | ||
assert content == expected |