def setUp(self): from core.urls import BASE # store the base object from the server to allow mocking and direct method access self.base = BASE self.client = Client() util.admin_login(self.client) self.base.musiq.player.start_loop()
def tearDown(self): util.admin_login(self.client) # restore player state self.client.post(reverse("set_autoplay"), {"value": "false"}) self._poll_musiq_state(lambda state: not state["autoplay"]) # ensure that the player is not waiting for a song to finish self.client.post(reverse("remove_all")) self._poll_musiq_state(lambda state: len(state["song_queue"]) == 0) self.client.post(reverse("skip_song")) self._poll_musiq_state(lambda state: not state["current_song"]) super().tearDown()
def tearDown(self) -> None: util.admin_login(self.client) super().tearDown()
def tearDown(self): util.admin_login(self.client) self.base.musiq.player.stop_loop()
def setUp(self) -> None: self.client = Client() # many tests need admin rights for setup or execution # they will drop privileges if necessary util.admin_login(self.client) redis.start()