File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -174,14 +174,22 @@ def test_token_right_create_dataset_rights(self):
174174 )
175175 )
176176 resp = api_su .create_dataset (":root" , ds .json ())
177- pid = resp .json ()["data" ]["persistentId" ]
178- assert resp .json ()["status" ] == "OK"
177+ resp .raise_for_status ()
178+
179+ resp = resp .json ()
180+ pid = resp ["data" ]["persistentId" ]
181+
182+ if resp ["status" ] != "OK" :
183+ raise Exception (resp ["message" ])
179184
180185 # with pytest.raises(ApiAuthorizationError):
181186 # resp = api_nru.get_dataset(pid)
182187
183188 resp = api_su .delete_dataset (pid )
184- assert resp .json ()["status" ] == "OK"
189+ resp .raise_for_status ()
190+ resp = resp .json ()
191+ if resp ["status" ] != "OK" :
192+ raise Exception (resp ["message" ])
185193
186194 def test_token_should_not_be_exposed_on_error (self ):
187195 BASE_URL = os .getenv ("BASE_URL" )
Original file line number Diff line number Diff line change @@ -184,7 +184,8 @@ def test_file_replacement_wo_metadata(self):
184184 is_filepid = False ,
185185 )
186186
187- response .raise_for_status ()
187+ if not response .ok :
188+ raise Exception (response .json ()["message" ])
188189
189190 # Assert
190191 file_id = response .json ()["data" ]["files" ][0 ]["dataFile" ]["id" ]
@@ -222,6 +223,9 @@ def test_file_replacement_w_metadata(self):
222223 json_str = df .json (),
223224 )
224225
226+ if not response .ok :
227+ raise Exception (response .json ()["message" ])
228+
225229 # Retrieve file ID
226230 file_id = response .json ()["data" ]["files" ][0 ]["dataFile" ]["id" ]
227231
@@ -248,6 +252,9 @@ def test_file_replacement_w_metadata(self):
248252 is_filepid = False ,
249253 )
250254
255+ if not response .ok :
256+ raise Exception (response .json ()["message" ])
257+
251258 # Assert
252259 file_id = response .json ()["data" ]["files" ][0 ]["dataFile" ]["id" ]
253260 data_file = api .get_dataset (pid ).json ()["data" ]["latestVersion" ]["files" ][0 ]
You can’t perform that action at this time.
0 commit comments