mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
fix(test): MariaDB 11 upgrade, query result order
Fix order of recipients for "FlagNotification" test. Apply sorting to the recipients query. (only relevant for tests, but who knows when they change things again) MariaDB 11 includes some changes related to the query optimizer. Turns out that this might have effects on how records are ordered for certain queries. (in case no ORDER BY clause was specified) https://mariadb.com/kb/en/mariadb-11-0-0-release-notes/ Signed-off-by: moson <moson@archlinux.org>
This commit is contained in:
parent
814ccf6b04
commit
9fe8d524ff
2 changed files with 7 additions and 6 deletions
|
@ -334,6 +334,7 @@ class FlagNotification(Notification):
|
|||
.filter(and_(PackageBase.ID == pkgbase_id, User.Suspended == 0))
|
||||
.with_entities(User.Email, User.LangPreference)
|
||||
.distinct()
|
||||
.order_by(User.Email)
|
||||
)
|
||||
self._recipients = [(u.Email, u.LangPreference) for u in query]
|
||||
|
||||
|
|
|
@ -127,20 +127,20 @@ def test_out_of_date(user: User, user1: User, user2: User, pkgbases: list[Packag
|
|||
# Should've gotten three emails: maintainer + the two comaintainers.
|
||||
assert Email.count() == 3
|
||||
|
||||
# Comaintainer 1.
|
||||
# Maintainer.
|
||||
first = Email(1).parse()
|
||||
assert first.headers.get("To") == user1.Email
|
||||
assert first.headers.get("To") == user.Email
|
||||
|
||||
expected = f"AUR Out-of-date Notification for {pkgbase.Name}"
|
||||
assert first.headers.get("Subject") == expected
|
||||
|
||||
# Comaintainer 2.
|
||||
# Comaintainer 1.
|
||||
second = Email(2).parse()
|
||||
assert second.headers.get("To") == user2.Email
|
||||
assert second.headers.get("To") == user1.Email
|
||||
|
||||
# Maintainer.
|
||||
# Comaintainer 2.
|
||||
third = Email(3).parse()
|
||||
assert third.headers.get("To") == user.Email
|
||||
assert third.headers.get("To") == user2.Email
|
||||
|
||||
|
||||
def test_reset(user: User):
|
||||
|
|
Loading…
Add table
Reference in a new issue