Skip to content

Commit a1e9cfd

Browse files
sending notifications is task based only sinde 24.1
1 parent 31ed6ba commit a1e9cfd

File tree

1 file changed

+27
-5
lines changed

1 file changed

+27
-5
lines changed

bioblend/_tests/TestGalaxyNotifications.py

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
datetime,
33
timedelta,
44
)
5+
from packaging.version import Version
56
from typing import (
67
Any,
78
Dict,
@@ -34,7 +35,11 @@ def test_notification_status(self):
3435
if not self.gi.users.get_current_user()["is_admin"]:
3536
self.skipTest("This tests requires the current user to be an admin, which is not the case.")
3637

37-
task_based = self.gi.config.get_config()["enable_celery_tasks"]
38+
# sending notifications are handled by tasks since 24.1 if celery is enabled
39+
version = self.gi.config.get_config()["version_major"]
40+
task_based = self.gi.config.get_config()["enable_celery_tasks"] and (
41+
version == "dev" or Version(version) >= Version("24.1")
42+
)
3843

3944
# user creation for the test
4045
user1 = self._create_local_test_user(password="password")
@@ -150,7 +155,11 @@ def test_get_user_notifications(self):
150155
if not self.gi.users.get_current_user()["is_admin"]:
151156
self.skipTest("This tests requires the current user to be an admin, which is not the case.")
152157

153-
task_based = self.gi.config.get_config()["enable_celery_tasks"]
158+
# sending notifications are handled by tasks since 24.1 if celery is enabled
159+
version = self.gi.config.get_config()["version_major"]
160+
task_based = self.gi.config.get_config()["enable_celery_tasks"] and (
161+
version == "dev" or Version(version) >= Version("24.1")
162+
)
154163

155164
# send the notifications
156165
user_id = [self.gi.users.get_current_user()["id"]]
@@ -248,7 +257,12 @@ def test_show_notification(self):
248257
self.skipTest("This Galaxy instance is not configured to use notifications.")
249258
if not self.gi.users.get_current_user()["is_admin"]:
250259
self.skipTest("This tests requires the current user to be an admin, which is not the case.")
251-
task_based = self.gi.config.get_config()["enable_celery_tasks"]
260+
261+
# sending notifications are handled by tasks since 24.1 if celery is enabled
262+
version = self.gi.config.get_config()["version_major"]
263+
task_based = self.gi.config.get_config()["enable_celery_tasks"] and (
264+
version == "dev" or Version(version) >= Version("24.1")
265+
)
252266

253267
# user creation for the test
254268
user = self._create_local_test_user(password="password")
@@ -280,7 +294,11 @@ def test_update_notifications(self):
280294
self.skipTest("This Galaxy instance is not configured to use notifications.")
281295
if not self.gi.users.get_current_user()["is_admin"]:
282296
self.skipTest("This tests requires the current user to be an admin, which is not the case.")
283-
task_based = self.gi.config.get_config()["enable_celery_tasks"]
297+
# sending notifications are handled by tasks since 24.1 if celery is enabled
298+
version = self.gi.config.get_config()["version_major"]
299+
task_based = self.gi.config.get_config()["enable_celery_tasks"] and (
300+
version == "dev" or Version(version) >= Version("24.1")
301+
)
284302

285303
# user creation for the test
286304
user = self._create_local_test_user(password="password")
@@ -363,7 +381,11 @@ def test_delete_notifications(self):
363381
self.skipTest("This Galaxy instance is not configured to use notifications.")
364382
if not self.gi.users.get_current_user()["is_admin"]:
365383
self.skipTest("This tests requires the current user to be an admin, which is not the case.")
366-
task_based = self.gi.config.get_config()["enable_celery_tasks"]
384+
# sending notifications are handled by tasks since 24.1 if celery is enabled
385+
version = self.gi.config.get_config()["version_major"]
386+
task_based = self.gi.config.get_config()["enable_celery_tasks"] and (
387+
version == "dev" or Version(version) >= Version("24.1")
388+
)
367389

368390
# user creation for the test
369391
user = self._create_local_test_user(password="password")

0 commit comments

Comments
 (0)