MCPcopy Create free account
hub / github.com/MG-RAST/Shock / test_post_attributes

Function test_post_attributes

test/test_shock.py:463–479  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

461
462
463def test_post_attributes():
464 TESTURL = "{SHOCK_URL}/node".format(SHOCK_URL=SHOCK_URL)
465 TESTHEADERS = {"Authorization": "OAuth {}".format(TOKEN)}
466# to get multipart-form correctly, data has to be specified in this strange way
467# and passed as the files= parameter to requests.put
468 TESTDATA = {}
469 FILES = {'attributes': open(DATADIR + "attr.json", 'rb'),
470 'upload' : open(DATADIR + "AAA.txt", 'rb')}
471 if DEBUG:
472 print("POST", TESTURL, TESTDATA, TESTHEADERS)
473 response = requests.post(TESTURL, headers=TESTHEADERS, files=FILES, data=TESTDATA)
474 data = json.loads(response.content.decode("utf-8"))
475 assert data["status"] == 200
476 NODE = data["data"]["id"]
477 assert data["data"]["file"]["name"] == "AAA.txt"
478 assert data["data"]["attributes"]["format"] == "replace_format"
479 delete_nodes([NODE])
480
481
482def test_post_gzip():

Callers

nothing calls this directly

Calls 1

delete_nodesFunction · 0.85

Tested by

no test coverage detected