File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change 1
1
ATOMIC_OPERATIONS = "atomic:operations"
2
2
ATOMIC_RESULTS = "atomic:results"
3
- ATOMIC_MEDIA_TYPE = 'vnd.api+json;ext="https://jsonapi.org/ext/atomic'
3
+ ATOMIC_MEDIA_TYPE = 'vnd.api+json;ext="https://jsonapi.org/ext/atomic" '
4
4
ATOMIC_CONTENT_TYPE = f'application/{ ATOMIC_MEDIA_TYPE } '
Original file line number Diff line number Diff line change @@ -21,6 +21,29 @@ def setUp(self):
21
21
22
22
self .maxDiff = None
23
23
24
+ def test_content_type_extension (self ):
25
+ """Test that the correct content type is accepted
26
+
27
+ The media type and parameters are defined at https://jsonapi.org/ext/atomic. This tests
28
+ hardcodes the value to separate the test from the library's constants.
29
+
30
+ """
31
+ operations = []
32
+
33
+ data = {
34
+ ATOMIC_OPERATIONS : operations
35
+ }
36
+
37
+ response = self .client .post (
38
+ path = "/" ,
39
+ data = data ,
40
+ content_type = 'application/vnd.api+json; ext="https://jsonapi.org/ext/atomic"' ,
41
+
42
+ ** {"HTTP_ACCEPT" : 'application/vnd.api+json; ext="https://jsonapi.org/ext/atomic"' }
43
+ )
44
+
45
+ self .assertNotEqual (406 , response .status_code ) # 406 Not Acceptable
46
+
24
47
def test_view_processing_with_valid_request (self ):
25
48
operations = [
26
49
{
You can’t perform that action at this time.
0 commit comments