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

import xhiveframework
from xhiveframework.core.doctype.rq_worker.rq_worker import RQWorker
from xhiveframework.tests.utils import XhiveFrameworkTestCase


class TestRQWorker(XhiveFrameworkTestCase):
	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({})
		xhiveframework.get_doc("RQ Worker", workers[0].pid)
