Skip to content

Commit e3ead57

Browse files
test: GitHub handle changed after first login
1 parent 8b1a3de commit e3ead57

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
from collections.abc import Callable
2+
3+
from django.contrib.auth.models import User
4+
5+
from shared.models.nix_evaluation import (
6+
NixDerivation,
7+
NixMaintainer,
8+
)
9+
from webview.models import Notification
10+
11+
12+
def test_github_username_changed(
13+
user: User,
14+
make_maintainer_from_user: Callable[..., NixMaintainer],
15+
make_drv: Callable[..., NixDerivation],
16+
make_package_notification: Callable[..., list[Notification]],
17+
) -> None:
18+
"""
19+
Check that notifications get sent even if the user's GitHub handle changed after first login.
20+
"""
21+
maintainer = make_maintainer_from_user(user)
22+
drv = make_drv(maintainer=maintainer)
23+
# GitHub username could have changed between evaluations.
24+
maintainer.github = maintainer.github + "-new"
25+
maintainer.save()
26+
notifications = make_package_notification(drv)
27+
assert notifications

0 commit comments

Comments
 (0)