def test_upload_pif(): """ Tests that a PIF can be created, serialized, uploaded then downloaded and deserialized """ pif = System() pif.id = 0 uid = random_string() pif.uid = uid with open("tmp.json", "w") as fp: dump(pif, fp) assert client.upload(dataset_id, "tmp.json").successful() tries = 0 while True: try: pif = client.get_pif(dataset_id, uid) break except ResourceNotFoundException: if tries < 10: tries += 1 time.sleep(1) else: raise status = client.get_ingest_status(dataset_id) assert status == "Finished" with open("tmp.json", "r") as fp: assert json.loads(fp.read())["uid"] == pif.uid
def test_upload_pif(): client = CitrinationClient(environ['CITRINATION_API_KEY'], environ['CITRINATION_SITE']) dataset = loads(client.create_data_set(name="Tutorial dataset", description="Dataset for tutorial", share=0).content.decode('utf-8'))['id'] pif = System() pif.id = 0 with open("tmp.json", "w") as fp: dump(pif, fp) response = loads(client.upload_file("tmp.json", dataset)) assert response["message"] == "Upload is complete."
def test_upload_pif(): client = CitrinationClient(environ['CITRINATION_API_KEY'], 'https://stage.citrination.com') dataset = loads(client.create_data_set(name="Tutorial dataset", description="Dataset for tutorial", share=0).content.decode('utf-8'))['id'] pif = System() pif.id = 0 with TemporaryDirectory() as tmpdir: tempname = join(tmpdir, "pif.json") with open(tempname, "w") as fp: dump(pif, fp) response = loads(client.upload_file(tempname, dataset)) assert response["message"] == "Upload is complete."
def test_upload_pif(): client = CitrinationClient(environ['CITRINATION_API_KEY'], environ['CITRINATION_SITE']) dataset = loads( client.create_data_set(name="Tutorial dataset", description="Dataset for tutorial", share=0).content.decode('utf-8'))['id'] pif = System() pif.id = 0 with open("tmp.json", "w") as fp: dump(pif, fp) response = loads(client.upload_file("tmp.json", dataset)) assert response["message"] == "Upload is complete."