mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-20 22:40:31 -04:00
Remove separate function for live service check
When we get a support ticket we need to check whether a user has any live services. We have a method for this on the user model now, so we don’t need a separate function in the feedback code. It wasn’t very well tested so I’ve adapted the old tests from the feedback view to work against the method on the user model too.
This commit is contained in:
@@ -70,3 +70,39 @@ def test_platform_admin_flag_set_in_session(client, mocker, is_platform_admin, v
|
||||
mocker.patch.dict('app.models.user.session', values=session_dict, clear=True)
|
||||
|
||||
assert User({'platform_admin': is_platform_admin}).platform_admin == expected_result
|
||||
|
||||
|
||||
def test_has_live_services(
|
||||
client_request,
|
||||
mock_get_non_empty_organisations_and_services_for_user,
|
||||
fake_uuid,
|
||||
):
|
||||
user = User({
|
||||
'id': fake_uuid,
|
||||
'platform_admin': False,
|
||||
})
|
||||
assert len(user.live_services) == 5
|
||||
for service in user.live_services:
|
||||
assert service.live
|
||||
|
||||
|
||||
def test_has_live_services_when_there_are_no_services(
|
||||
client_request,
|
||||
mock_get_organisations_and_services_for_user,
|
||||
fake_uuid,
|
||||
):
|
||||
assert User({
|
||||
'id': fake_uuid,
|
||||
'platform_admin': False,
|
||||
}).live_services == []
|
||||
|
||||
|
||||
def test_has_live_services_when_service_is_not_live(
|
||||
client_request,
|
||||
mock_get_empty_organisations_and_one_service_for_user,
|
||||
fake_uuid,
|
||||
):
|
||||
assert User({
|
||||
'id': fake_uuid,
|
||||
'platform_admin': False,
|
||||
}).live_services == []
|
||||
|
||||
Reference in New Issue
Block a user