# Copyright (c) 2022, InfluxFramework LLC
# See license.txt

import influxframework
from influxframework.core.doctype.rq_worker.rq_worker import RQWorker
from influxframework.tests.utils import InfluxFrameworkTestCase


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

	def test_worker_serialization(self):
		workers = RQWorker.get_list({})
		influxframework.get_doc("RQ Worker", workers[0].pid)
