Skip to content

Instantly share code, notes, and snippets.

@peterjpxie
Created August 8, 2019 05:47
Show Gist options
  • Save peterjpxie/7f86bea7ff3670babe1633e362247a1c to your computer and use it in GitHub Desktop.
Save peterjpxie/7f86bea7ff3670babe1633e362247a1c to your computer and use it in GitHub Desktop.
# Updated test function in perf_test_mock_service.py
def test_mock_service():
url = 'http://127.0.0.1:5000/json'
resp = requests.get(url)
if resp.status_code != 200:
print('Test failed with response status code %s.' % resp.status_code )
return 'fail', resp.elapsed.total_seconds()
elif resp.json()["code"] != 1:
print('Test failed with code %s != 1.' % resp.json()["code"] )
return 'fail', resp.elapsed.total_seconds()
else:
print('Test passed.')
return 'pass', resp.elapsed.total_seconds()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment