Try to flush old messages in tests

This commit is contained in:
Tom Hubrecht 2022-06-30 09:39:05 +02:00 committed by thubrecht
parent 3fee014384
commit 7d8926e459
2 changed files with 7 additions and 1 deletions

View file

@ -283,8 +283,10 @@ class OpenKfetScenarioTest(TestCase):
cls.r_c.login(username="team", password="team")
def setUp(self):
# Create a channel to listen to KPsul's messages
# Create channels to listen to messages
channel_layer = get_channel_layer()
async_to_sync(channel_layer.flush)()
self.channel = async_to_sync(channel_layer.new_channel)()
self.team_channel = async_to_sync(channel_layer.new_channel)()

View file

@ -1812,6 +1812,7 @@ class KPsulPerformOperationsViewTests(ViewTestCaseMixin, TestCase):
# Create a channel to listen to KPsul's messages
channel_layer = get_channel_layer()
async_to_sync(channel_layer.flush)()
self.channel = async_to_sync(channel_layer.new_channel)()
async_to_sync(channel_layer.group_add)("kfet.kpsul", self.channel)
@ -3240,6 +3241,9 @@ class KPsulCancelOperationsViewTests(ViewTestCaseMixin, TestCase):
# Create a channel to listen to KPsul's messages
channel_layer = get_channel_layer()
# Flush old messages
async_to_sync(channel_layer.flush)()
self.channel = async_to_sync(channel_layer.new_channel)()
async_to_sync(channel_layer.group_add)("kfet.kpsul", self.channel)