Refactor:

* Filter inbound by service_id
* Refactor to return 404 instead of 400 for consistency
This commit is contained in:
Imdad Ahad
2017-06-07 14:23:31 +01:00
parent ee488d416a
commit 5b4ceda1c6
4 changed files with 23 additions and 18 deletions

View File

@@ -92,6 +92,6 @@ def test_should_not_delete_inbound_sms_before_seven_days(sample_service):
def test_get_inbound_sms_by_id_returns(sample_service):
inbound = create_inbound_sms(sample_service)
inbound_from_db = dao_get_inbound_sms_by_id(inbound.id)
inbound_from_db = dao_get_inbound_sms_by_id(sample_service.id, inbound.id)
assert inbound == inbound_from_db

View File

@@ -129,12 +129,23 @@ def test_get_inbound_sms_by_id_returns_200(admin_request, sample_service):
assert response['service_id'] == str(sample_service.id)
def test_get_inbound_sms_by_id_invalid_id_returns_400(admin_request, sample_service):
def test_get_inbound_sms_by_id_invalid_id_returns_404(admin_request, sample_service):
assert admin_request.get(
'inbound_sms.get_inbound_by_id',
endpoint_kwargs={
'service_id': sample_service.id,
'inbound_sms_id': 'dsadsda'
'inbound_sms_id': 'bar'
},
expected_status=400
expected_status=404
)
def test_get_inbound_sms_by_id_with_invalid_service_id_returns_404(admin_request, sample_service):
assert admin_request.get(
'inbound_sms.get_inbound_by_id',
endpoint_kwargs={
'service_id': 'foo',
'inbound_sms_id': '2cfbd6a1-1575-4664-8969-f27be0ea40d9'
},
expected_status=404
)