File tree Expand file tree Collapse file tree 2 files changed +19
-9
lines changed Expand file tree Collapse file tree 2 files changed +19
-9
lines changed Original file line number Diff line number Diff line change @@ -427,7 +427,6 @@ def create_record(
427427 urls = []
428428 json = {
429429 "urls" : urls ,
430- "form" : "object" ,
431430 "hashes" : hashes ,
432431 "size" : size ,
433432 "file_name" : file_name ,
@@ -443,15 +442,9 @@ def create_record(
443442 }
444443 if did :
445444 json ["did" ] = did
446- resp = self .client ._post (
447- "index/" ,
448- headers = {"content-type" : "application/json" },
449- data = client .json_dumps (json ),
450- auth = self .client .auth ,
451- )
452- raise_for_status_and_print_error (resp )
445+ rec = self .client .create (** json )
453446
454- return resp . json ()
447+ return rec . to_json ()
455448
456449 @backoff .on_exception (backoff .expo , Exception , ** DEFAULT_BACKOFF_SETTINGS )
457450 async def async_create_record (
Original file line number Diff line number Diff line change @@ -278,3 +278,20 @@ def test_desc_and_content_dates(gen3_index):
278278 assert version_record ["description" ] == new_version ["description" ]
279279 assert version_record ["content_created_date" ] == new_version ["content_created_date" ]
280280 assert version_record ["content_updated_date" ] == new_version ["content_updated_date" ]
281+
282+ def test_create_record_response (gen3_index ):
283+ """
284+ Verifies the return value for create_record echoes back the parameters for the record that was created.
285+ """
286+ to_create = {
287+ "hashes" : {
288+ "md5" : "374c12456782738abcfe387492837483"
289+ },
290+ "size" : 10 ,
291+ "urls" : ['s3://foo/bar' ],
292+ "file_name" : 'new_file' ,
293+ "acl" : ['*' ]
294+ }
295+ record = gen3_index .create_record (** to_create )
296+ for field , expected_value in to_create .items ():
297+ assert expected_value == record [field ]
You can’t perform that action at this time.
0 commit comments