mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-21 07:51:13 -05:00
Renamed inbound_sms_list key name to received_text_messages
This commit is contained in:
@@ -34,7 +34,7 @@ def get_inbound_sms_by_number(user_number):
|
|||||||
)
|
)
|
||||||
|
|
||||||
return jsonify(
|
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(
|
links=_build_links(
|
||||||
paginated_inbound_sms,
|
paginated_inbound_sms,
|
||||||
endpoint='get_inbound_sms_by_number',
|
endpoint='get_inbound_sms_by_number',
|
||||||
@@ -58,7 +58,7 @@ def get_all_inbound_sms():
|
|||||||
)
|
)
|
||||||
|
|
||||||
return jsonify(
|
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')
|
links=_build_links(paginated_inbound_sms, endpoint='get_all_inbound_sms')
|
||||||
), 200
|
), 200
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ get_inbound_sms_response = {
|
|||||||
"description": "GET list of inbound sms response schema",
|
"description": "GET list of inbound sms response schema",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"inbound_sms_list": {
|
"received_text_messages": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
@@ -57,7 +57,7 @@ get_inbound_sms_response = {
|
|||||||
"required": ["current"]
|
"required": ["current"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": ["inbound_sms_list", "links"],
|
"required": ["received_text_messages", "links"],
|
||||||
"definitions": {
|
"definitions": {
|
||||||
"inbound_sms": get_inbound_sms_single_response
|
"inbound_sms": get_inbound_sms_single_response
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ def test_get_all_inbound_sms_returns_200(
|
|||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
assert response.headers['Content-type'] == 'application/json'
|
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)
|
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))
|
json_response = json.loads(response.get_data(as_text=True))
|
||||||
expected_inbound_sms_list = [i.serialize() for i in reversed_inbound_sms[:2]]
|
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(
|
assert url_for(
|
||||||
inbound_sms_path,
|
inbound_sms_path,
|
||||||
user_number=user_number,
|
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))
|
json_response = json.loads(response.get_data(as_text=True))
|
||||||
expected_inbound_sms_list = [i.serialize() for i in reversed_inbound_sms[2:]]
|
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(
|
assert url_for(
|
||||||
inbound_sms_path,
|
inbound_sms_path,
|
||||||
user_number=user_number,
|
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))
|
json_response = json.loads(response.get_data(as_text=True))
|
||||||
expected_inbound_sms_list = []
|
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(
|
assert url_for(
|
||||||
inbound_sms_path,
|
inbound_sms_path,
|
||||||
user_number=user_number,
|
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.status_code == 200
|
||||||
assert response.headers['Content-type'] == 'application/json'
|
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 = []
|
expected_response = []
|
||||||
|
|
||||||
@@ -184,7 +184,7 @@ def test_get_inbound_sms_by_number_returns_200(
|
|||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
assert response.headers['Content-type'] == 'application/json'
|
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()]
|
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.status_code == 200
|
||||||
assert response.headers['Content-type'] == 'application/json'
|
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 = []
|
expected_response = []
|
||||||
|
|
||||||
@@ -218,7 +218,7 @@ def test_get_inbound_sms_by_nonexistent_number(client, sample_service):
|
|||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
assert response.headers['Content-type'] == 'application/json'
|
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 = []
|
expected_response = []
|
||||||
|
|
||||||
assert json_response == expected_response
|
assert json_response == expected_response
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ valid_inbound_sms = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
valid_inbound_sms_list = {
|
valid_inbound_sms_list = {
|
||||||
"inbound_sms_list": [valid_inbound_sms],
|
"received_text_messages": [valid_inbound_sms],
|
||||||
"links": {
|
"links": {
|
||||||
"current": valid_inbound_sms["id"]
|
"current": valid_inbound_sms["id"]
|
||||||
}
|
}
|
||||||
@@ -38,7 +38,7 @@ invalid_inbound_sms = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
invalid_inbound_sms_list = {
|
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 = 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))
|
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()
|
== sample_inbound_sms.serialize()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user