mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-04-29 05:30:48 -04:00
add in test and fix isort
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import pytest
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
from app.utils.pagination import get_page_from_request
|
||||
@@ -211,3 +212,35 @@ def test_all_activity_pagination(client_request, mocker):
|
||||
assert (
|
||||
pagination_texts == expected_pagination_texts
|
||||
), f"Expected pagination controls {expected_pagination_texts}, but got {pagination_texts}"
|
||||
|
||||
|
||||
@pytest.mark.parametrize("filter_type,expected_limit_days", [
|
||||
("24hours", 1),
|
||||
("3days", 3),
|
||||
("7days", 7),
|
||||
(None, None),
|
||||
])
|
||||
def test_all_activity_filters(client_request, mocker, filter_type, expected_limit_days):
|
||||
current_page = get_page_from_request()
|
||||
mock_get_page_of_jobs = mocker.patch(
|
||||
"app.job_api_client.get_page_of_jobs", return_value=MOCK_JOBS
|
||||
)
|
||||
mocker.patch("app.job_api_client.get_immediate_jobs", return_value=[])
|
||||
|
||||
kwargs = {"filter": filter_type} if filter_type else {}
|
||||
response = client_request.get_response(
|
||||
"main.all_jobs_activity",
|
||||
service_id=SERVICE_ONE_ID,
|
||||
page=current_page,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
assert response.status_code == 200
|
||||
assert "All activity" in response.text
|
||||
|
||||
if expected_limit_days:
|
||||
mock_get_page_of_jobs.assert_any_call(
|
||||
SERVICE_ONE_ID, page=current_page, limit_days=expected_limit_days
|
||||
)
|
||||
else:
|
||||
mock_get_page_of_jobs.assert_any_call(SERVICE_ONE_ID, page=current_page)
|
||||
|
||||
Reference in New Issue
Block a user