mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 18:01:08 -05:00
fix notifications
This commit is contained in:
@@ -307,7 +307,6 @@ def get_notifications_for_service(
|
|||||||
print(f"QUERIE IS {querie}")
|
print(f"QUERIE IS {querie}")
|
||||||
results = db.session.execute(querie).scalars().all()
|
results = db.session.execute(querie).scalars().all()
|
||||||
print(f"RESULTS ARE {results}")
|
print(f"RESULTS ARE {results}")
|
||||||
page_size = current_app.config["PAGE_SIZE"]
|
|
||||||
offset = (page - 1) * page_size
|
offset = (page - 1) * page_size
|
||||||
paginated_results = results[offset : offset + page_size]
|
paginated_results = results[offset : offset + page_size]
|
||||||
pagination = Pagination(paginated_results, page, page_size, len(results))
|
pagination = Pagination(paginated_results, page, page_size, len(results))
|
||||||
|
|||||||
@@ -952,6 +952,11 @@ def test_should_return_notifications_including_one_offs_by_default(
|
|||||||
assert len(include_one_offs_by_default) == 2
|
assert len(include_one_offs_by_default) == 2
|
||||||
|
|
||||||
|
|
||||||
|
# TODO this test fails with the sqlalchemy 2.0 upgrade, but
|
||||||
|
# it seems like it was wrong to begin with. Clearly 2 notifications
|
||||||
|
# are created, so it seems like the count should be 2, and there is
|
||||||
|
# no reason to null out or override the pagination object just because
|
||||||
|
# a flag is being passed.
|
||||||
def test_should_not_count_pages_when_given_a_flag(sample_user, sample_template):
|
def test_should_not_count_pages_when_given_a_flag(sample_user, sample_template):
|
||||||
create_notification(sample_template)
|
create_notification(sample_template)
|
||||||
notification = create_notification(sample_template)
|
notification = create_notification(sample_template)
|
||||||
@@ -959,7 +964,7 @@ def test_should_not_count_pages_when_given_a_flag(sample_user, sample_template):
|
|||||||
pagination = get_notifications_for_service(
|
pagination = get_notifications_for_service(
|
||||||
sample_template.service_id, count_pages=False, page_size=1
|
sample_template.service_id, count_pages=False, page_size=1
|
||||||
)
|
)
|
||||||
assert len(pagination.items) == 2
|
assert len(pagination.items) == 1
|
||||||
assert pagination.total is None
|
assert pagination.total is None
|
||||||
assert pagination.items[0].id == notification.id
|
assert pagination.items[0].id == notification.id
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user