Renamed inbound_sms_list key name to received_text_messages

This commit is contained in:
Ken Tsang
2017-11-07 12:19:44 +00:00
parent 425d66bf29
commit ac15e7fd8b
4 changed files with 15 additions and 15 deletions

View File

@@ -34,7 +34,7 @@ def get_inbound_sms_by_number(user_number):
)
return jsonify(
inbound_sms_list=[i.serialize() for i in paginated_inbound_sms],
received_text_messages=[i.serialize() for i in paginated_inbound_sms],
links=_build_links(
paginated_inbound_sms,
endpoint='get_inbound_sms_by_number',
@@ -58,7 +58,7 @@ def get_all_inbound_sms():
)
return jsonify(
inbound_sms_list=[i.serialize() for i in paginated_inbound_sms],
received_text_messages=[i.serialize() for i in paginated_inbound_sms],
links=_build_links(paginated_inbound_sms, endpoint='get_all_inbound_sms')
), 200

View File

@@ -36,7 +36,7 @@ get_inbound_sms_response = {
"description": "GET list of inbound sms response schema",
"type": "object",
"properties": {
"inbound_sms_list": {
"received_text_messages": {
"type": "array",
"items": {
"type": "object",
@@ -57,7 +57,7 @@ get_inbound_sms_response = {
"required": ["current"]
}
},
"required": ["inbound_sms_list", "links"],
"required": ["received_text_messages", "links"],
"definitions": {
"inbound_sms": get_inbound_sms_single_response
}

View File

@@ -25,7 +25,7 @@ def test_get_all_inbound_sms_returns_200(
assert response.status_code == 200
assert response.headers['Content-type'] == 'application/json'
json_response = json.loads(response.get_data(as_text=True))['inbound_sms_list']
json_response = json.loads(response.get_data(as_text=True))['received_text_messages']
reversed_all_inbound_sms = sorted(all_inbound_sms, key=lambda sms: sms.created_at, reverse=True)
@@ -63,7 +63,7 @@ def test_get_inbound_sms_generate_page_links(
json_response = json.loads(response.get_data(as_text=True))
expected_inbound_sms_list = [i.serialize() for i in reversed_inbound_sms[:2]]
assert json_response['inbound_sms_list'] == expected_inbound_sms_list
assert json_response['received_text_messages'] == expected_inbound_sms_list
assert url_for(
inbound_sms_path,
user_number=user_number,
@@ -104,7 +104,7 @@ def test_get_next_inbound_sms_will_get_correct_inbound_sms_list(
json_response = json.loads(response.get_data(as_text=True))
expected_inbound_sms_list = [i.serialize() for i in reversed_inbound_sms[2:]]
assert json_response['inbound_sms_list'] == expected_inbound_sms_list
assert json_response['received_text_messages'] == expected_inbound_sms_list
assert url_for(
inbound_sms_path,
user_number=user_number,
@@ -137,7 +137,7 @@ def test_get_next_inbound_sms_at_end_will_return_empty_inbound_sms_list(
json_response = json.loads(response.get_data(as_text=True))
expected_inbound_sms_list = []
assert json_response['inbound_sms_list'] == expected_inbound_sms_list
assert json_response['received_text_messages'] == expected_inbound_sms_list
assert url_for(
inbound_sms_path,
user_number=user_number,
@@ -156,7 +156,7 @@ def test_get_all_inbound_sms_for_no_inbound_sms_returns_200(
assert response.status_code == 200
assert response.headers['Content-type'] == 'application/json'
json_response = json.loads(response.get_data(as_text=True))['inbound_sms_list']
json_response = json.loads(response.get_data(as_text=True))['received_text_messages']
expected_response = []
@@ -184,7 +184,7 @@ def test_get_inbound_sms_by_number_returns_200(
assert response.status_code == 200
assert response.headers['Content-type'] == 'application/json'
json_response = json.loads(response.get_data(as_text=True))['inbound_sms_list']
json_response = json.loads(response.get_data(as_text=True))['received_text_messages']
expected_response = [sample_inbound_sms2.serialize(), sample_inbound_sms1.serialize()]
@@ -202,7 +202,7 @@ def test_get_inbound_sms_for_no_inbound_sms_returns_200(
assert response.status_code == 200
assert response.headers['Content-type'] == 'application/json'
json_response = json.loads(response.get_data(as_text=True))['inbound_sms_list']
json_response = json.loads(response.get_data(as_text=True))['received_text_messages']
expected_response = []
@@ -218,7 +218,7 @@ def test_get_inbound_sms_by_nonexistent_number(client, sample_service):
assert response.status_code == 200
assert response.headers['Content-type'] == 'application/json'
json_response = json.loads(response.get_data(as_text=True))['inbound_sms_list']
json_response = json.loads(response.get_data(as_text=True))['received_text_messages']
expected_response = []
assert json_response == expected_response

View File

@@ -20,7 +20,7 @@ valid_inbound_sms = {
}
valid_inbound_sms_list = {
"inbound_sms_list": [valid_inbound_sms],
"received_text_messages": [valid_inbound_sms],
"links": {
"current": valid_inbound_sms["id"]
}
@@ -38,7 +38,7 @@ invalid_inbound_sms = {
}
invalid_inbound_sms_list = {
"inbound_sms_list": [invalid_inbound_sms]
"received_text_messages": [invalid_inbound_sms]
}
@@ -47,7 +47,7 @@ def test_get_inbound_sms_contract(client, sample_inbound_sms):
response = client.get('/v2/received-text-messages/{}'.format(sample_inbound_sms.user_number), headers=[auth_header])
response_json = json.loads(response.get_data(as_text=True))
assert validate(response_json, get_inbound_sms_response)['inbound_sms_list'][0] \
assert validate(response_json, get_inbound_sms_response)['received_text_messages'][0] \
== sample_inbound_sms.serialize()