File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -124,6 +124,29 @@ def test_relationship_view_errors_format(self):
124
124
assert "data" not in result
125
125
assert "errors" in result
126
126
127
+ def test_relationship_view_errors_has_correct_pointers (self ):
128
+ url = "/comments"
129
+ request_data = {
130
+ "data" : {
131
+ "type" : "comments" ,
132
+ "attributes" : {"text" : "comment text" },
133
+ "relationships" : {
134
+ "author" : {"data" : {"id" : "INVALID_ID" , "type" : "authors" }}
135
+ },
136
+ }
137
+ }
138
+ response = self .client .post (url , data = request_data )
139
+ assert response .status_code == 400
140
+
141
+ result = json .loads (response .content .decode ("utf-8" ))
142
+ errors_source_pointer = list (
143
+ map (lambda i : i ["source" ]["pointer" ], result ["errors" ])
144
+ )
145
+
146
+ assert "/data/attributes/body" in errors_source_pointer
147
+ assert "/data/relationships/author" in errors_source_pointer
148
+ assert "/data/relationships/entry" in errors_source_pointer
149
+
127
150
def test_get_empty_to_one_relationship (self ):
128
151
url = "/comments/{}/relationships/author" .format (self .first_entry .id )
129
152
response = self .client .get (url )
You can’t perform that action at this time.
0 commit comments