()
| 461 | |
| 462 | |
| 463 | def 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 | |
| 482 | def test_post_gzip(): |
nothing calls this directly
no test coverage detected