mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-11 09:28:27 -04:00
fix service settings letter branding tests
some tests are now expanded to handle the fact that letter branding can be null
This commit is contained in:
@@ -1,11 +1,38 @@
|
||||
from app.notify_client.letter_branding_client import LetterBrandingClient
|
||||
|
||||
|
||||
def test_get_letter_branding(mocker):
|
||||
mock_get = mocker.patch('app.notify_client.letter_branding_client.LetterBrandingClient.get')
|
||||
LetterBrandingClient().get_letter_branding()
|
||||
mock_get.assert_called_once_with(
|
||||
url='/dvla_organisations'
|
||||
def test_get_letter_branding(mocker, fake_uuid):
|
||||
mock_get = mocker.patch(
|
||||
'app.notify_client.letter_branding_client.LetterBrandingClient.get',
|
||||
return_value={'foo': 'bar'}
|
||||
)
|
||||
mock_redis_get = mocker.patch('app.notify_client.RedisClient.get', return_value=None)
|
||||
mock_redis_set = mocker.patch('app.notify_client.RedisClient.set')
|
||||
|
||||
LetterBrandingClient().get_letter_branding(fake_uuid)
|
||||
|
||||
mock_get.assert_called_once_with(url='/letter-branding/{}'.format(fake_uuid))
|
||||
mock_redis_get.assert_called_once_with('letter_branding-{}'.format(fake_uuid))
|
||||
mock_redis_set.assert_called_once_with(
|
||||
'letter_branding-{}'.format(fake_uuid),
|
||||
'{"foo": "bar"}',
|
||||
ex=604800,
|
||||
)
|
||||
|
||||
|
||||
def test_get_all_letter_branding(mocker):
|
||||
mock_get = mocker.patch('app.notify_client.letter_branding_client.LetterBrandingClient.get', return_value=[1, 2, 3])
|
||||
mock_redis_get = mocker.patch('app.notify_client.RedisClient.get', return_value=None)
|
||||
mock_redis_set = mocker.patch('app.notify_client.RedisClient.set')
|
||||
|
||||
LetterBrandingClient().get_all_letter_branding()
|
||||
|
||||
mock_get.assert_called_once_with(url='/letter-branding')
|
||||
mock_redis_get.assert_called_once_with('letter_branding')
|
||||
mock_redis_set.assert_called_once_with(
|
||||
'letter_branding',
|
||||
'[1, 2, 3]',
|
||||
ex=604800,
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user