31 lines
1.0 KiB
Python
31 lines
1.0 KiB
Python
# Copyright 2024 (c) Anna Schumaker.
|
|
"""Tests our custom ListenBrainz GObject."""
|
|
import emmental.listenbrainz
|
|
import unittest
|
|
from gi.repository import GObject
|
|
|
|
|
|
class TestListenBrainz(unittest.TestCase):
|
|
"""ListenBrainz GObject test case."""
|
|
|
|
def setUp(self):
|
|
"""Set up common variables."""
|
|
self.listenbrainz = emmental.listenbrainz.ListenBrainz()
|
|
|
|
def tearDown(self):
|
|
"""Clean up."""
|
|
self.listenbrainz.stop()
|
|
|
|
def test_init(self):
|
|
"""Test that the ListenBrainz GObject was set up properly."""
|
|
self.assertIsInstance(self.listenbrainz, GObject.GObject)
|
|
self.assertIsInstance(self.listenbrainz._queue,
|
|
emmental.listenbrainz.task.Queue)
|
|
self.assertIsInstance(self.listenbrainz._thread,
|
|
emmental.listenbrainz.thread.Thread)
|
|
|
|
def test_stop(self):
|
|
"""Test stopping the thread during shutdown."""
|
|
self.listenbrainz.stop()
|
|
self.assertFalse(self.listenbrainz._thread.is_alive())
|