Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix relying on implicit ordering of Notification in test #3707

Merged
merged 2 commits into from
Nov 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions app/tests/core_tests/test_permission_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,8 @@ def test_permission_request_notifications_flow_for_manual_review(

# check that status update results in notification for follower of request object,
# and removal of the notification for the editor
assert Notification.objects.count() == 1
assert Notification.objects.all()[0].user == user
user_notification = Notification.objects.get()
assert user_notification.user == user
assert (
f"Your registration request for {base_obj_str} was accepted"
in Notification.objects.all()[0].print_notification(user=user)
Expand All @@ -341,7 +341,10 @@ def test_permission_request_notifications_flow_for_manual_review(
pr.refresh_from_db()
assert pr.status == request_model.REJECTED
assert Notification.objects.count() == 2
assert Notification.objects.all()[1].user == user
new_user_notification = Notification.objects.exclude(
id=user_notification.id
).get()
assert new_user_notification.user == user
assert (
f"Your registration request for {base_obj_str} was rejected"
in Notification.objects.all()[1].print_notification(user=user)
Expand Down