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

Function test_post_gzip

test/test_shock.py:482–497  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

480
481
482def test_post_gzip():
483 TESTURL = "{SHOCK_URL}/node".format(SHOCK_URL=SHOCK_URL)
484 TESTHEADERS = {"Authorization": "OAuth {}".format(TOKEN)}
485# to get multipart-form correctly, data has to be specified in this strange way
486# and passed as the files= parameter to requests.put
487 TESTDATA = {"attributes_str": (None, '{"project_id":"TESTPROJECT"}')}
488 FILES = {'gzip': open(DATADIR + "10kb.fna.gz", 'rb')}
489 if DEBUG:
490 print("POST", TESTURL, TESTDATA, TESTHEADERS)
491 response = requests.post(TESTURL, headers=TESTHEADERS, files=FILES, data=TESTDATA)
492 data = json.loads(response.content.decode("utf-8"))
493 assert data["status"] == 200
494 NODE = data["data"]["id"]
495 assert data["data"]["file"]["name"] == "10kb.fna"
496 assert data["data"]["file"]["checksum"]["md5"] == "730c276ea1510e2b7ef6b682094dd889"
497 delete_nodes([NODE])
498
499
500def test_post_bzip():

Callers

nothing calls this directly

Calls 1

delete_nodesFunction · 0.85

Tested by

no test coverage detected