Update python client to version 1.0.0.

This version of the client removed the request method, path and body from the encode and decode methods.
The biggest changes here is to the unit tests.
This commit is contained in:
Rebecca Law
2016-05-04 16:08:23 +01:00
parent a92532d6d4
commit b53fdf1f3f
16 changed files with 183 additions and 863 deletions

View File

@@ -25,11 +25,7 @@ def test_create_invited_user(notify_api, sample_service, mocker):
data = json.dumps(data)
auth_header = create_authorization_header(
path='/service/{}/invite'.format(sample_service.id),
method='POST',
request_body=data
)
auth_header = create_authorization_header()
response = client.post(
'/service/{}/invite'.format(sample_service.id),
@@ -76,11 +72,7 @@ def test_create_invited_user_invalid_email(notify_api, sample_service, mocker):
data = json.dumps(data)
auth_header = create_authorization_header(
path='/service/{}/invite'.format(sample_service.id),
method='POST',
request_body=data
)
auth_header = create_authorization_header()
response = client.post(
'/service/{}/invite'.format(sample_service.id),
@@ -112,10 +104,7 @@ def test_get_all_invited_users_by_service(notify_api, notify_db, notify_db_sessi
url = '/service/{}/invite'.format(sample_service.id)
auth_header = create_authorization_header(
path=url,
method='GET'
)
auth_header = create_authorization_header()
response = client.get(
url,
@@ -139,10 +128,7 @@ def test_get_invited_users_by_service_with_no_invites(notify_api, notify_db, not
url = '/service/{}/invite'.format(sample_service.id)
auth_header = create_authorization_header(
path=url,
method='GET'
)
auth_header = create_authorization_header()
response = client.get(
url,
@@ -159,10 +145,7 @@ def test_get_invited_user_by_service_and_id(notify_api, sample_service, sample_i
url = '/service/{}/invite/{}'.format(sample_service.id, sample_invited_user.id)
auth_header = create_authorization_header(
path=url,
method='GET'
)
auth_header = create_authorization_header()
response = client.get(
url,
@@ -186,10 +169,7 @@ def test_get_invited_user_by_service_but_unknown_invite_id_returns_404(notify_ap
unknown_id = uuid.uuid4()
url = '/service/{}/invite/{}'.format(sample_service.id, unknown_id)
auth_header = create_authorization_header(
path=url,
method='GET'
)
auth_header = create_authorization_header()
response = client.get(
url,
@@ -204,11 +184,7 @@ def test_update_invited_user_set_status_to_cancelled(notify_api, sample_invited_
data = {'status': 'cancelled'}
url = '/service/{0}/invite/{1}'.format(sample_invited_user.service_id, sample_invited_user.id)
auth_header = create_authorization_header(
path=url,
method='POST',
request_body=json.dumps(data)
)
auth_header = create_authorization_header()
response = client.post(url,
data=json.dumps(data),
headers=[('Content-Type', 'application/json'), auth_header])
@@ -223,11 +199,7 @@ def test_update_invited_user_for_wrong_service_returns_404(notify_api, sample_in
with notify_api.test_client() as client:
data = {'status': 'cancelled'}
url = '/service/{0}/invite/{1}'.format(fake_uuid, sample_invited_user.id)
auth_header = create_authorization_header(
path=url,
method='POST',
request_body=json.dumps(data)
)
auth_header = create_authorization_header()
response = client.post(url, data=json.dumps(data),
headers=[('Content-Type', 'application/json'), auth_header])
assert response.status_code == 404
@@ -240,11 +212,7 @@ def test_update_invited_user_for_invalid_data_returns_400(notify_api, sample_inv
with notify_api.test_client() as client:
data = {'status': 'garbage'}
url = '/service/{0}/invite/{1}'.format(sample_invited_user.service_id, sample_invited_user.id)
auth_header = create_authorization_header(
path=url,
method='POST',
request_body=json.dumps(data)
)
auth_header = create_authorization_header()
response = client.post(url, data=json.dumps(data),
headers=[('Content-Type', 'application/json'), auth_header])
assert response.status_code == 400