| 102 | |
| 103 | |
| 104 | def test_upload_emptyfile(): |
| 105 | TESTURL = "{SHOCK_URL}/node".format(SHOCK_URL=SHOCK_URL) |
| 106 | TESTHEADERS = {"Authorization": "OAuth {}".format(TOKEN)} |
| 107 | FILES = {'upload': open(DATADIR + 'emptyfile', 'rb')} |
| 108 | if DEBUG: |
| 109 | print(TESTURL, TESTHEADERS) |
| 110 | response = requests.post(TESTURL, headers=TESTHEADERS, files=FILES) |
| 111 | data = json.loads(response.content.decode("utf-8")) |
| 112 | print(response.content.decode("utf-8")) |
| 113 | assert data["status"] == 200 |
| 114 | assert data["data"]["file"]["checksum"]["md5"] == "d41d8cd98f00b204e9800998ecf8427e" |
| 115 | # cleanup |
| 116 | NODEID = data["data"]["id"] |
| 117 | NODEURL = SHOCK_URL + "/node/{}".format(NODEID) |
| 118 | response = requests.delete(NODEURL, headers=TESTHEADERS) |
| 119 | |
| 120 | |
| 121 | def test_upload_threefiles(): |