Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_upload_predictions(api, tmpdir):
api.token = ("", "")
# we need to mock 3 network calls: 1. auth 2. file upload and 3. submission
data = {"data": {"submission_upload_auth": {"url": "https://uploadurl",
"filename": "filename"}}}
responses.add(responses.POST, numerapi.numerapi.API_TOURNAMENT_URL,
json=data)
responses.add(responses.PUT, "https://uploadurl")
data = {"data": {"create_submission": {"id": "1234"}}}
responses.add(responses.POST, numerapi.numerapi.API_TOURNAMENT_URL,
json=data)
path = tmpdir.join("somefilepath")
path.write("content")
submission_id = api.upload_predictions(str(path))
assert submission_id == "1234"
assert len(responses.calls) == 3
def test_upload_predictions(api, tmpdir):
api.token = ("", "")
# we need to mock 3 network calls: 1. auth 2. file upload and 3. submission
data = {"data": {"submission_upload_auth": {"url": "https://uploadurl",
"filename": "filename"}}}
responses.add(responses.POST, numerapi.numerapi.API_TOURNAMENT_URL,
json=data)
responses.add(responses.PUT, "https://uploadurl")
data = {"data": {"create_submission": {"id": "1234"}}}
responses.add(responses.POST, numerapi.numerapi.API_TOURNAMENT_URL,
json=data)
path = tmpdir.join("somefilepath")
path.write("content")
submission_id = api.upload_predictions(str(path))
assert submission_id == "1234"
assert len(responses.calls) == 3