change dashboard test to reflect demo changes to uploads view

This commit is contained in:
jimmoffet
2022-09-09 17:02:48 -07:00
parent 740470f6bd
commit 69abec0bb3
28 changed files with 127 additions and 183 deletions

View File

@@ -1,5 +1,3 @@
import pytest
from app.notify_client.broadcast_message_api_client import (
BroadcastMessageAPIClient,
)
@@ -39,7 +37,6 @@ def test_get_broadcast_messages(mocker):
)
@pytest.mark.skip(reason='@cache decorator disabled until caching is fixed')
def test_get_broadcast_message(mocker):
client = BroadcastMessageAPIClient()
mocker.patch('app.notify_client.current_user', id='1')
@@ -59,7 +56,6 @@ def test_get_broadcast_message(mocker):
)
@pytest.mark.skip(reason='@cache decorator disabled until caching is fixed')
def test_update_broadcast_message(mocker):
client = BroadcastMessageAPIClient()
mocker.patch('app.notify_client.current_user', id='1')
@@ -79,7 +75,6 @@ def test_update_broadcast_message(mocker):
mock_redis_delete.assert_called_once_with('service-12345-broadcast-message-67890')
@pytest.mark.skip(reason='@cache decorator disabled until caching is fixed')
def test_update_broadcast_message_status(mocker):
client = BroadcastMessageAPIClient()
mocker.patch('app.notify_client.current_user', id='1')

View File

@@ -1,11 +1,8 @@
from unittest.mock import call
import pytest
from app.notify_client.email_branding_client import EmailBrandingClient
@pytest.mark.skip(reason='@cache decorator disabled until caching is fixed')
def test_get_email_branding(mocker, fake_uuid):
mock_get = mocker.patch(
'app.notify_client.email_branding_client.EmailBrandingClient.get',
@@ -30,7 +27,6 @@ def test_get_email_branding(mocker, fake_uuid):
)
@pytest.mark.skip(reason='@cache decorator disabled until caching is fixed')
def test_get_all_email_branding(mocker):
mock_get = mocker.patch(
'app.notify_client.email_branding_client.EmailBrandingClient.get',
@@ -55,7 +51,6 @@ def test_get_all_email_branding(mocker):
)
@pytest.mark.skip(reason='@cache decorator disabled until caching is fixed')
def test_create_email_branding(mocker):
org_data = {'logo': 'test.png', 'name': 'test name', 'text': 'test name', 'colour': 'red',
'brand_type': 'org'}
@@ -75,7 +70,6 @@ def test_create_email_branding(mocker):
mock_redis_delete.assert_called_once_with('email_branding')
@pytest.mark.skip(reason='@cache decorator disabled until caching is fixed')
def test_update_email_branding(mocker, fake_uuid):
org_data = {'logo': 'test.png', 'name': 'test name', 'text': 'test name', 'colour': 'red',
'brand_type': 'org'}

View File

@@ -7,7 +7,6 @@ from app.models.job import Job, PaginatedJobs
from app.notify_client.job_api_client import JobApiClient
@pytest.mark.skip(reason='@cache decorator disabled until caching is fixed')
def test_client_creates_job_data_correctly(mocker, fake_uuid):
job_id = fake_uuid
service_id = fake_uuid
@@ -333,7 +332,6 @@ def test_cancel_job(mocker):
'false',
),
])
@pytest.mark.skip(reason='@cache decorator disabled until caching is fixed')
def test_has_jobs_sets_cache(
mocker,
fake_uuid,
@@ -363,7 +361,6 @@ def test_has_jobs_sets_cache(
(b'true', True),
(b'false', False),
])
@pytest.mark.skip(reason='@cache decorator disabled until caching is fixed')
def test_has_jobs_returns_from_cache(
mocker,
fake_uuid,

View File

@@ -1,11 +1,8 @@
from unittest.mock import call
import pytest
from app.notify_client.letter_branding_client import LetterBrandingClient
@pytest.mark.skip(reason='@cache decorator disabled until caching is fixed')
def test_get_letter_branding(mocker, fake_uuid):
mock_get = mocker.patch(
'app.notify_client.letter_branding_client.LetterBrandingClient.get',
@@ -25,7 +22,6 @@ def test_get_letter_branding(mocker, fake_uuid):
)
@pytest.mark.skip(reason='@cache decorator disabled until caching is fixed')
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.extensions.RedisClient.get', return_value=None)
@@ -42,7 +38,6 @@ def test_get_all_letter_branding(mocker):
)
@pytest.mark.skip(reason='@cache decorator disabled until caching is fixed')
def test_create_letter_branding(mocker):
new_branding = {'filename': 'uuid-test', 'name': 'my letters'}
@@ -60,7 +55,6 @@ def test_create_letter_branding(mocker):
mock_redis_delete.assert_called_once_with('letter_branding')
@pytest.mark.skip(reason='@cache decorator disabled until caching is fixed')
def test_update_letter_branding(mocker, fake_uuid):
branding = {'filename': 'uuid-test', 'name': 'my letters'}

View File

@@ -92,7 +92,6 @@ from app import organisations_client
),
]
)
@pytest.mark.skip(reason='@cache decorator disabled until caching is fixed')
def test_returns_value_from_cache(
notify_admin,
mocker,
@@ -125,7 +124,6 @@ def test_returns_value_from_cache(
assert mock_redis_set.call_args_list == expected_cache_set_calls
@pytest.mark.skip(reason='@cache decorator disabled until caching is fixed')
def test_deletes_domain_cache(
notify_admin,
mock_get_user,
@@ -153,7 +151,6 @@ def test_deletes_domain_cache(
call('domains'),
]),
))
@pytest.mark.skip(reason='@cache decorator disabled until caching is fixed')
def test_update_organisation_when_not_updating_org_type(
mocker,
fake_uuid,
@@ -173,7 +170,6 @@ def test_update_organisation_when_not_updating_org_type(
assert mock_redis_delete.call_args_list == expected_cache_delete_calls
@pytest.mark.skip(reason='@cache decorator disabled until caching is fixed')
def test_update_organisation_when_updating_org_type_and_org_has_services(mocker, fake_uuid):
mock_redis_delete = mocker.patch('app.extensions.RedisClient.delete')
mock_post = mocker.patch('app.notify_client.organisations_api_client.OrganisationsClient.post')
@@ -195,7 +191,6 @@ def test_update_organisation_when_updating_org_type_and_org_has_services(mocker,
]
@pytest.mark.skip(reason='@cache decorator disabled until caching is fixed')
def test_update_organisation_when_updating_org_type_but_org_has_no_services(mocker, fake_uuid):
mock_redis_delete = mocker.patch('app.extensions.RedisClient.delete')
mock_post = mocker.patch('app.notify_client.organisations_api_client.OrganisationsClient.post')
@@ -216,7 +211,6 @@ def test_update_organisation_when_updating_org_type_but_org_has_no_services(mock
]
@pytest.mark.skip(reason='@cache decorator disabled until caching is fixed')
def test_update_service_organisation_deletes_cache(mocker, fake_uuid):
mock_redis_delete = mocker.patch('app.extensions.RedisClient.delete')
mock_post = mocker.patch('app.notify_client.organisations_api_client.OrganisationsClient.post')
@@ -237,7 +231,6 @@ def test_update_service_organisation_deletes_cache(mocker, fake_uuid):
)
@pytest.mark.skip(reason='@cache decorator disabled until caching is fixed')
def test_remove_user_from_organisation_deletes_user_cache(mocker):
mock_redis_delete = mocker.patch('app.extensions.RedisClient.delete')
mock_delete = mocker.patch('app.notify_client.organisations_api_client.OrganisationsClient.delete')

View File

@@ -1,13 +1,10 @@
from datetime import date
import pytest
from app.notify_client.performance_dashboard_api_client import (
PerformanceDashboardAPIClient,
)
@pytest.mark.skip(reason='@cache decorator disabled until caching is fixed')
def test_get_aggregate_platform_stats(mocker):
mocker.patch('app.extensions.RedisClient.get', return_value=None)
client = PerformanceDashboardAPIClient()
@@ -24,7 +21,6 @@ def test_get_aggregate_platform_stats(mocker):
})
@pytest.mark.skip(reason='@cache decorator disabled until caching is fixed')
def test_sets_value_in_cache(mocker):
client = PerformanceDashboardAPIClient()
@@ -56,7 +52,6 @@ def test_sets_value_in_cache(mocker):
)
@pytest.mark.skip(reason='@cache decorator disabled until caching is fixed')
def test_returns_value_from_cache(mocker):
client = PerformanceDashboardAPIClient()

View File

@@ -10,7 +10,6 @@ from tests.conftest import SERVICE_ONE_ID
FAKE_TEMPLATE_ID = uuid4()
@pytest.mark.skip(reason='@cache decorator disabled until caching is fixed')
def test_client_posts_archived_true_when_deleting_template(mocker):
mocker.patch('app.notify_client.current_user', id='1')
mock_redis_delete_by_pattern = mocker.patch('app.extensions.RedisClient.delete_by_pattern')
@@ -354,7 +353,6 @@ def test_client_returns_count_of_service_templates(
),
]
)
@pytest.mark.skip(reason='@cache decorator disabled until caching is fixed')
def test_returns_value_from_cache(
mocker,
client_method,
@@ -410,7 +408,6 @@ def test_returns_value_from_cache(
(user_api_client, 'add_user_to_service', [SERVICE_ONE_ID, uuid4(), [], []], {}),
(invite_api_client, 'accept_invite', [SERVICE_ONE_ID, uuid4()], {}),
])
@pytest.mark.skip(reason='@cache decorator disabled until caching is fixed')
def test_deletes_service_cache(
notify_admin,
mock_get_user,
@@ -455,7 +452,6 @@ def test_deletes_service_cache(
'service-{}'.format(SERVICE_ONE_ID),
]),
])
@pytest.mark.skip(reason='@cache decorator disabled until caching is fixed')
def test_deletes_caches_when_modifying_templates(
notify_admin,
mock_get_user,
@@ -479,7 +475,6 @@ def test_deletes_caches_when_modifying_templates(
assert mock_redis_delete_by_pattern.call_args_list[0] == call(f'service-{SERVICE_ONE_ID}-template-*')
@pytest.mark.skip(reason='@cache decorator disabled until caching is fixed')
def test_deletes_cached_users_when_archiving_service(mocker, mock_get_service_templates):
mock_redis_delete = mocker.patch('app.extensions.RedisClient.delete')
mock_redis_delete_by_pattern = mocker.patch('app.extensions.RedisClient.delete_by_pattern')
@@ -492,7 +487,6 @@ def test_deletes_cached_users_when_archiving_service(mocker, mock_get_service_te
assert call(f'service-{SERVICE_ONE_ID}-template-*') in mock_redis_delete_by_pattern.call_args_list
@pytest.mark.skip(reason='@cache decorator disabled until caching is fixed')
def test_deletes_cached_users_when_changing_broadcast_service_settings(mocker):
mock_redis_delete = mocker.patch('app.extensions.RedisClient.delete')
@@ -534,7 +528,6 @@ def test_client_updates_guest_list(mocker):
)
@pytest.mark.skip(reason='@cache decorator disabled until caching is fixed')
def test_client_doesnt_delete_service_template_cache_when_none_exist(
notify_admin,
mock_get_user,
@@ -554,7 +547,6 @@ def test_client_doesnt_delete_service_template_cache_when_none_exist(
assert len(mock_redis_delete_by_pattern.call_args_list) == 1
@pytest.mark.skip(reason='@cache decorator disabled until caching is fixed')
def test_client_deletes_service_template_cache_when_service_is_updated(
notify_admin,
mock_get_user,

View File

@@ -1,9 +1,6 @@
import pytest
from app.notify_client.status_api_client import StatusApiClient
@pytest.mark.skip(reason='@cache decorator disabled until caching is fixed')
def test_get_count_of_live_services_and_organisations(mocker):
mocker.patch('app.extensions.RedisClient.get', return_value=None)
client = StatusApiClient()
@@ -14,7 +11,6 @@ def test_get_count_of_live_services_and_organisations(mocker):
mock.assert_called_once_with(url='/_status/live-service-and-organisation-counts')
@pytest.mark.skip(reason='@cache decorator disabled until caching is fixed')
def test_sets_value_in_cache(mocker):
client = StatusApiClient()
@@ -41,7 +37,6 @@ def test_sets_value_in_cache(mocker):
)
@pytest.mark.skip(reason='@cache decorator disabled until caching is fixed')
def test_returns_value_from_cache(mocker):
client = StatusApiClient()

View File

@@ -8,7 +8,6 @@ from app.notify_client.template_folder_api_client import TemplateFolderAPIClient
@pytest.mark.parametrize('parent_id', [uuid.uuid4(), None])
@pytest.mark.skip(reason='@cache decorator disabled until caching is fixed')
def test_create_template_folder_calls_correct_api_endpoint(mocker, parent_id):
mock_redis_delete = mocker.patch('app.extensions.RedisClient.delete')
@@ -26,7 +25,6 @@ def test_create_template_folder_calls_correct_api_endpoint(mocker, parent_id):
mock_redis_delete.assert_called_once_with('service-{}-template-folders'.format(some_service_id))
@pytest.mark.skip(reason='@cache decorator disabled until caching is fixed')
def test_get_template_folders_calls_correct_api_endpoint(mocker):
mock_redis_get = mocker.patch('app.extensions.RedisClient.get', return_value=None)
mock_redis_set = mocker.patch('app.extensions.RedisClient.set')
@@ -50,7 +48,6 @@ def test_get_template_folders_calls_correct_api_endpoint(mocker):
mock_redis_set.assert_called_once_with(redis_key, '{"a": "b"}', ex=604800)
@pytest.mark.skip(reason='@cache decorator disabled until caching is fixed')
def test_move_templates_and_folders(mocker):
mock_redis_delete = mocker.patch('app.extensions.RedisClient.delete')
@@ -108,7 +105,6 @@ def test_move_templates_and_folders_to_root(mocker):
)
@pytest.mark.skip(reason='@cache decorator disabled until caching is fixed')
def test_update_template_folder_calls_correct_api_endpoint(mocker):
mock_redis_delete = mocker.patch('app.extensions.RedisClient.delete')
@@ -127,7 +123,6 @@ def test_update_template_folder_calls_correct_api_endpoint(mocker):
mock_redis_delete.assert_called_once_with('service-{}-template-folders'.format(some_service_id))
@pytest.mark.skip(reason='@cache decorator disabled until caching is fixed')
def test_delete_template_folder_calls_correct_api_endpoint(mocker):
mock_redis_delete = mocker.patch('app.extensions.RedisClient.delete')

View File

@@ -155,7 +155,6 @@ def test_client_converts_admin_permissions_to_db_permissions_on_add_to_service(n
),
]
)
@pytest.mark.skip(reason='@cache decorator disabled until caching is fixed')
def test_returns_value_from_cache(
notify_admin,
mocker,
@@ -203,7 +202,6 @@ def test_returns_value_from_cache(
(service_api_client, 'create_service', ['', '', 0, False, user_id, sample_uuid()], {}),
(invite_api_client, 'accept_invite', [SERVICE_ONE_ID, user_id], {}),
])
@pytest.mark.skip(reason='@cache decorator disabled until caching is fixed')
def test_deletes_user_cache(
notify_admin,
mock_get_user,
@@ -223,7 +221,6 @@ def test_deletes_user_cache(
assert len(mock_request.call_args_list) == 1
@pytest.mark.skip(reason='@cache decorator disabled until caching is fixed')
def test_add_user_to_service_calls_correct_endpoint_and_deletes_keys_from_cache(mocker):
mock_redis_delete = mocker.patch('app.extensions.RedisClient.delete')