

@responses.activate
def test_cli_upload_unknown_error(monkeypatch):
    monkeypatch.setattr(mapbox.services.uploads, 'boto3_session', MockSession)
    query_body = '\n       {{"key": "_pending/{username}/key.test",\n         "accessKeyId": "ak.test",\n         "bucket": "tilestream-tilesets-production",\n         "url": "https://tilestream-tilesets-production.s3.amazonaws.com/_pending/{username}/key.test",\n         "secretAccessKey": "sak.test",\n         "sessionToken": "st.test"}}'.format(username=username)
    responses.add(responses.GET, 'https://api.mapbox.com/uploads/v1/{0}/credentials?access_token={1}'.format(username, access_token), match_querystring=True, body=query_body, status=200, content_type='application/json')
    responses.add(responses.POST, 'https://api.mapbox.com/uploads/v1/{0}?access_token={1}'.format(username, access_token), match_querystring=True, body='{"message":"Something went wrong"}', status=500, content_type='application/json')
    runner = CliRunner()
    result = runner.invoke(main_group, ['--access-token', access_token, 'upload', 'test-data', 'tests/twopoints.geojson'])
    assert (result.exit_code == 1)
    assert (result.output == 'Error: {"message":"Something went wrong"}\n')

dataset/ETHPy150Open mapbox/mapbox-cli-py/tests/test_uploads.py test_cli_upload_unknown_error/original