-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcommon.py
More file actions
32 lines (26 loc) · 1003 Bytes
/
common.py
File metadata and controls
32 lines (26 loc) · 1003 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Copyright 2016-2019 Camptocamp SA
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html)
from odoo.tests import common
from odoo.addons.queue_job.job import Job
class JobCommonCase(common.TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.queue_job = cls.env["queue.job"]
cls.user = cls.env["res.users"]
cls.method = cls.env["test.queue.job"].testing_method
def _create_job(self):
test_job = Job(self.method)
test_job.store()
stored = Job.db_records_from_uuids(self.env, [test_job.uuid])
self.assertEqual(len(stored), 1)
return stored
def _get_demo_job(self, uuid):
# job created during load of demo data
job = self.env["queue.job"].search([("uuid", "=", uuid)], limit=1)
self.assertTrue(
job,
f"Demo data queue job {uuid!r} should be loaded in order "
"to make this test work",
)
return job