# Copyright (c) 2022, JINGROW and Contributors
# See license.txt

import jingrow
from jingrow.core.pagetype.rq_worker.rq_worker import RQWorker
from jingrow.tests.utils import JingrowTestCase


class TestRQWorker(JingrowTestCase):
	def test_get_worker_list(self):
		workers = RQWorker.get_list({})
		self.assertGreaterEqual(len(workers), 1)
		self.assertTrue(any("short" in w.queue_type for w in workers))

	def test_worker_serialization(self):
		workers = RQWorker.get_list({})
		jingrow.get_pg("RQ Worker", workers[0].name)
