Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-rest-framework
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
django-rest-framework
Commits
c2ce2fb3
Commit
c2ce2fb3
authored
Jan 19, 2017
by
Artem Muterko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for BaseContentNegotiation
parent
076ca6e7
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
1 deletions
+17
-1
tests/test_negotiation.py
+17
-1
No files found.
tests/test_negotiation.py
View file @
c2ce2fb3
...
@@ -4,7 +4,9 @@ import pytest
...
@@ -4,7 +4,9 @@ import pytest
from
django.http
import
Http404
from
django.http
import
Http404
from
django.test
import
TestCase
from
django.test
import
TestCase
from
rest_framework.negotiation
import
DefaultContentNegotiation
from
rest_framework.negotiation
import
(
BaseContentNegotiation
,
DefaultContentNegotiation
)
from
rest_framework.renderers
import
BaseRenderer
from
rest_framework.renderers
import
BaseRenderer
from
rest_framework.request
import
Request
from
rest_framework.request
import
Request
from
rest_framework.test
import
APIRequestFactory
from
rest_framework.test
import
APIRequestFactory
...
@@ -87,3 +89,17 @@ class TestAcceptedMediaType(TestCase):
...
@@ -87,3 +89,17 @@ class TestAcceptedMediaType(TestCase):
renderers
=
[
MockRenderer
()]
renderers
=
[
MockRenderer
()]
with
pytest
.
raises
(
Http404
):
with
pytest
.
raises
(
Http404
):
self
.
negotiator
.
filter_renderers
(
renderers
,
format
=
'json'
)
self
.
negotiator
.
filter_renderers
(
renderers
,
format
=
'json'
)
class
BaseContentNegotiationTests
(
TestCase
):
def
setUp
(
self
):
self
.
negotiator
=
BaseContentNegotiation
()
def
test_raise_error_for_abstract_select_parser_method
(
self
):
with
pytest
.
raises
(
NotImplementedError
):
self
.
negotiator
.
select_parser
(
None
,
None
)
def
test_raise_error_for_abstract_select_renderer_method
(
self
):
with
pytest
.
raises
(
NotImplementedError
):
self
.
negotiator
.
select_renderer
(
None
,
None
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment