Use service model to look up service attributes

This is better than just keying into the JSON because it means you get
an exception straight away when looking up a key that doesn’t exist
(which via mocking you could ordinarily miss).
This commit is contained in:
Chris Hill-Scott
2018-07-20 08:42:01 +01:00
parent 036923c382
commit 1304561a70
14 changed files with 147 additions and 77 deletions

View File

@@ -49,7 +49,7 @@ def test_from_database_object_makes_request(
):
resp = Mock(content='a', status_code='b', headers={'c': 'd'})
request_mock = mocker.patch('app.template_previews.requests.post', return_value=resp)
mocker.patch('app.template_previews.current_service', __getitem__=Mock(return_value='123'))
mocker.patch('app.template_previews.current_service', dvla_organisation='123')
template = mock_get_service_letter_template('123', '456')['data']
ret = partial_call(template=template)