mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-14 01:41:22 -06:00
Suppress extraneous logging in BackgroundTaskTestCase
This commit is contained in:
parent
3f3d379a1c
commit
b8c0c0faeb
@ -14,7 +14,7 @@ from core.choices import ObjectChangeActionChoices
|
|||||||
from core.models import *
|
from core.models import *
|
||||||
from dcim.models import Site
|
from dcim.models import Site
|
||||||
from users.models import User
|
from users.models import User
|
||||||
from utilities.testing import TestCase, ViewTestCases, create_tags
|
from utilities.testing import TestCase, ViewTestCases, create_tags, disable_logging
|
||||||
|
|
||||||
|
|
||||||
class DataSourceTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
class DataSourceTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
||||||
@ -271,7 +271,8 @@ class BackgroundTaskTestCase(TestCase):
|
|||||||
# Enqueue & run a job that will fail
|
# Enqueue & run a job that will fail
|
||||||
job = queue.enqueue(self.dummy_job_failing)
|
job = queue.enqueue(self.dummy_job_failing)
|
||||||
worker = get_worker('default')
|
worker = get_worker('default')
|
||||||
worker.work(burst=True)
|
with disable_logging():
|
||||||
|
worker.work(burst=True)
|
||||||
self.assertTrue(job.is_failed)
|
self.assertTrue(job.is_failed)
|
||||||
|
|
||||||
# Re-enqueue the failed job and check that its status has been reset
|
# Re-enqueue the failed job and check that its status has been reset
|
||||||
@ -317,7 +318,8 @@ class BackgroundTaskTestCase(TestCase):
|
|||||||
self.assertEqual(len(started_job_registry), 1)
|
self.assertEqual(len(started_job_registry), 1)
|
||||||
response = self.client.get(reverse('core:background_task_stop', args=[job.id]))
|
response = self.client.get(reverse('core:background_task_stop', args=[job.id]))
|
||||||
self.assertEqual(response.status_code, 302)
|
self.assertEqual(response.status_code, 302)
|
||||||
worker.monitor_work_horse(job, queue) # Sets the job as Failed and removes from Started
|
with disable_logging():
|
||||||
|
worker.monitor_work_horse(job, queue) # Sets the job as Failed and removes from Started
|
||||||
self.assertEqual(len(started_job_registry), 0)
|
self.assertEqual(len(started_job_registry), 0)
|
||||||
|
|
||||||
canceled_job_registry = FailedJobRegistry(queue.name, connection=queue.connection)
|
canceled_job_registry = FailedJobRegistry(queue.name, connection=queue.connection)
|
||||||
|
Loading…
Reference in New Issue
Block a user