nautobot 2.3.15__py3-none-any.whl → 2.3.16__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of nautobot might be problematic. Click here for more details.
- nautobot/circuits/views.py +3 -3
- nautobot/cloud/models.py +1 -1
- nautobot/core/api/fields.py +5 -5
- nautobot/core/api/serializers.py +9 -9
- nautobot/core/api/views.py +3 -2
- nautobot/core/apps/__init__.py +5 -2
- nautobot/core/celery/schedulers.py +1 -1
- nautobot/core/filters.py +19 -16
- nautobot/core/forms/fields.py +5 -5
- nautobot/core/graphql/types.py +1 -1
- nautobot/core/jobs/__init__.py +4 -4
- nautobot/core/jobs/cleanup.py +1 -1
- nautobot/core/jobs/groups.py +1 -1
- nautobot/core/management/commands/validate_models.py +1 -1
- nautobot/core/models/__init__.py +1 -1
- nautobot/core/models/query_functions.py +2 -2
- nautobot/core/models/tree_queries.py +2 -2
- nautobot/core/tables.py +5 -5
- nautobot/core/testing/filters.py +7 -3
- nautobot/core/testing/views.py +5 -0
- nautobot/core/tests/runner.py +1 -1
- nautobot/core/views/generic.py +51 -43
- nautobot/core/views/mixins.py +21 -11
- nautobot/dcim/api/serializers.py +48 -48
- nautobot/dcim/forms.py +2 -0
- nautobot/dcim/graphql/types.py +2 -2
- nautobot/dcim/models/device_component_templates.py +2 -2
- nautobot/dcim/models/device_components.py +22 -20
- nautobot/dcim/models/devices.py +1 -1
- nautobot/dcim/models/locations.py +3 -3
- nautobot/dcim/models/power.py +6 -5
- nautobot/dcim/models/racks.py +4 -4
- nautobot/dcim/tables/__init__.py +3 -3
- nautobot/dcim/tables/devicetypes.py +2 -2
- nautobot/dcim/tests/test_filters.py +1 -0
- nautobot/dcim/tests/test_graphql.py +52 -0
- nautobot/dcim/tests/test_models.py +4 -1
- nautobot/dcim/views.py +1 -1
- nautobot/extras/api/customfields.py +2 -2
- nautobot/extras/api/serializers.py +72 -69
- nautobot/extras/api/views.py +4 -4
- nautobot/extras/health_checks.py +1 -2
- nautobot/extras/jobs.py +5 -5
- nautobot/extras/managers.py +3 -1
- nautobot/extras/migrations/0018_joblog_data_migration.py +7 -9
- nautobot/extras/models/groups.py +13 -9
- nautobot/extras/models/jobs.py +4 -4
- nautobot/extras/models/models.py +2 -2
- nautobot/extras/plugins/views.py +1 -1
- nautobot/extras/tables.py +5 -5
- nautobot/extras/test_jobs/api_test_job.py +1 -1
- nautobot/extras/test_jobs/atomic_transaction.py +2 -2
- nautobot/extras/test_jobs/dry_run.py +1 -1
- nautobot/extras/test_jobs/fail.py +5 -5
- nautobot/extras/test_jobs/file_output.py +1 -1
- nautobot/extras/test_jobs/file_upload_fail.py +1 -1
- nautobot/extras/test_jobs/file_upload_pass.py +1 -1
- nautobot/extras/test_jobs/ipaddress_vars.py +3 -1
- nautobot/extras/test_jobs/jobs_module/jobs_submodule/jobs.py +1 -1
- nautobot/extras/test_jobs/location_with_custom_field.py +1 -1
- nautobot/extras/test_jobs/log_redaction.py +1 -1
- nautobot/extras/test_jobs/log_skip_db_logging.py +1 -1
- nautobot/extras/test_jobs/modify_db.py +1 -1
- nautobot/extras/test_jobs/object_var_optional.py +1 -1
- nautobot/extras/test_jobs/object_var_required.py +1 -1
- nautobot/extras/test_jobs/object_vars.py +1 -1
- nautobot/extras/test_jobs/pass.py +3 -3
- nautobot/extras/test_jobs/profiling.py +1 -1
- nautobot/extras/test_jobs/relative_import.py +3 -3
- nautobot/extras/test_jobs/soft_time_limit_greater_than_time_limit.py +1 -1
- nautobot/extras/test_jobs/task_queues.py +1 -1
- nautobot/extras/tests/test_api.py +13 -13
- nautobot/extras/tests/test_customfields.py +1 -1
- nautobot/extras/tests/test_datasources.py +2 -1
- nautobot/extras/tests/test_dynamicgroups.py +1 -1
- nautobot/extras/tests/test_filters.py +6 -6
- nautobot/extras/tests/test_jobs.py +11 -11
- nautobot/extras/tests/test_models.py +10 -10
- nautobot/extras/tests/test_relationships.py +1 -1
- nautobot/extras/tests/test_views.py +16 -16
- nautobot/extras/views.py +20 -16
- nautobot/ipam/api/fields.py +3 -3
- nautobot/ipam/api/serializers.py +33 -33
- nautobot/ipam/api/views.py +37 -61
- nautobot/ipam/querysets.py +2 -2
- nautobot/ipam/tests/test_api.py +12 -1
- nautobot/ipam/tests/test_forms.py +51 -47
- nautobot/ipam/tests/test_migrations.py +30 -30
- nautobot/ipam/tests/test_querysets.py +14 -0
- nautobot/project-static/docs/code-reference/nautobot/apps/forms.html +1 -1
- nautobot/project-static/docs/code-reference/nautobot/apps/testing.html +1 -1
- nautobot/project-static/docs/code-reference/nautobot/apps/views.html +2 -2
- nautobot/project-static/docs/release-notes/version-2.3.html +181 -99
- nautobot/project-static/docs/search/search_index.json +1 -1
- nautobot/project-static/docs/sitemap.xml +270 -270
- nautobot/project-static/docs/sitemap.xml.gz +0 -0
- nautobot/users/admin.py +1 -1
- nautobot/users/api/serializers.py +4 -4
- nautobot/users/api/views.py +1 -1
- nautobot/virtualization/api/serializers.py +4 -4
- {nautobot-2.3.15.dist-info → nautobot-2.3.16.dist-info}/METADATA +1 -1
- {nautobot-2.3.15.dist-info → nautobot-2.3.16.dist-info}/RECORD +106 -106
- {nautobot-2.3.15.dist-info → nautobot-2.3.16.dist-info}/WHEEL +1 -1
- {nautobot-2.3.15.dist-info → nautobot-2.3.16.dist-info}/LICENSE.txt +0 -0
- {nautobot-2.3.15.dist-info → nautobot-2.3.16.dist-info}/NOTICE +0 -0
- {nautobot-2.3.15.dist-info → nautobot-2.3.16.dist-info}/entry_points.txt +0 -0
|
@@ -7,7 +7,7 @@ from nautobot.extras.jobs import get_task_logger, Job, RunJobTaskFailed
|
|
|
7
7
|
logger = get_task_logger(__name__)
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
class
|
|
10
|
+
class TestFailJob(Job):
|
|
11
11
|
"""
|
|
12
12
|
Job with fail result.
|
|
13
13
|
"""
|
|
@@ -15,7 +15,7 @@ class TestFail(Job):
|
|
|
15
15
|
description = "Validate job import"
|
|
16
16
|
|
|
17
17
|
def before_start(self, task_id, args, kwargs):
|
|
18
|
-
if task_id != self.request.id:
|
|
18
|
+
if task_id != self.request.id: # pylint: disable=no-member
|
|
19
19
|
raise RuntimeError(f"Expected task_id {task_id} to equal self.request.id {self.request.id}")
|
|
20
20
|
if args:
|
|
21
21
|
raise RuntimeError(f"Expected args to be empty, but it was {args!r}")
|
|
@@ -23,7 +23,7 @@ class TestFail(Job):
|
|
|
23
23
|
raise RuntimeError(f"Expected kwargs to be empty, but it was {kwargs!r}")
|
|
24
24
|
logger.info("before_start() was called as expected")
|
|
25
25
|
|
|
26
|
-
def run(self):
|
|
26
|
+
def run(self): # pylint:disable=arguments-differ
|
|
27
27
|
"""
|
|
28
28
|
Job function.
|
|
29
29
|
"""
|
|
@@ -71,7 +71,7 @@ class TestFailWithSanitization(Job):
|
|
|
71
71
|
|
|
72
72
|
description = "Validate job failure sanitization"
|
|
73
73
|
|
|
74
|
-
def run(self):
|
|
74
|
+
def run(self): # pylint:disable=arguments-differ
|
|
75
75
|
logger.info("I'm a test job that fails and sanitizes the exception!")
|
|
76
76
|
exc = RunJobTaskFailed(
|
|
77
77
|
"fatal: could not read Password for 'https://abc123@github.com': terminal prompts disabled"
|
|
@@ -91,4 +91,4 @@ class TestFailWithSanitization(Job):
|
|
|
91
91
|
raise exc
|
|
92
92
|
|
|
93
93
|
|
|
94
|
-
register_jobs(
|
|
94
|
+
register_jobs(TestFailJob, TestFailWithSanitization)
|
|
@@ -13,7 +13,7 @@ class TestFileUploadPass(Job):
|
|
|
13
13
|
description="File to upload",
|
|
14
14
|
)
|
|
15
15
|
|
|
16
|
-
def run(self, file):
|
|
16
|
+
def run(self, file): # pylint:disable=arguments-differ
|
|
17
17
|
contents = str(file.read())
|
|
18
18
|
logger.warning("File contents: %s", contents)
|
|
19
19
|
logger.info("Job didn't crash!")
|
|
@@ -39,7 +39,9 @@ class TestIPAddresses(Job):
|
|
|
39
39
|
if kwargs[expected_kwarg] is None:
|
|
40
40
|
raise RuntimeError(f"kwargs[{expected_kwarg}] is unexpectedly None!")
|
|
41
41
|
|
|
42
|
-
def run(
|
|
42
|
+
def run( # pylint:disable=arguments-differ
|
|
43
|
+
self, *, ipv4_address, ipv4_with_mask, ipv4_network, ipv6_address, ipv6_with_mask, ipv6_network
|
|
44
|
+
):
|
|
43
45
|
if not isinstance(ipv4_address, netaddr.IPAddress):
|
|
44
46
|
raise RuntimeError(f"Expected ipv4_address to be a netaddr.IPAddress, but it was {ipv4_address!r}")
|
|
45
47
|
if not isinstance(ipv4_with_mask, netaddr.IPNetwork):
|
|
@@ -15,7 +15,7 @@ class TestCreateLocationWithCustomField(Job):
|
|
|
15
15
|
name = "Location and Custom Field Creation"
|
|
16
16
|
description = "Location with a custom field"
|
|
17
17
|
|
|
18
|
-
def run(self):
|
|
18
|
+
def run(self): # pylint: disable=arguments-differ
|
|
19
19
|
with transaction.atomic():
|
|
20
20
|
obj_type = ContentType.objects.get_for_model(Location)
|
|
21
21
|
cf = CustomField(label="cf1", type=CustomFieldTypeChoices.TYPE_TEXT, default="-")
|
|
@@ -8,7 +8,7 @@ class TestLogRedaction(Job):
|
|
|
8
8
|
class Meta:
|
|
9
9
|
description = "Test redaction of logs"
|
|
10
10
|
|
|
11
|
-
def run(self):
|
|
11
|
+
def run(self): # pylint: disable=arguments-differ
|
|
12
12
|
logger.debug("The secret is supersecret123")
|
|
13
13
|
logger.info("The secret is supersecret123")
|
|
14
14
|
logger.warning("The secret is supersecret123")
|
|
@@ -8,7 +8,7 @@ class TestLogSkipDBLogging(Job):
|
|
|
8
8
|
class Meta:
|
|
9
9
|
description = "Test logs not being saved to the database"
|
|
10
10
|
|
|
11
|
-
def run(self):
|
|
11
|
+
def run(self): # pylint: disable=arguments-differ
|
|
12
12
|
logger.debug("I should NOT be logged to the database", extra={"skip_db_logging": True})
|
|
13
13
|
logger.info("I should be logged to the database")
|
|
14
14
|
|
|
@@ -12,7 +12,7 @@ class TestOptionalObjectVar(Job):
|
|
|
12
12
|
required=False,
|
|
13
13
|
)
|
|
14
14
|
|
|
15
|
-
def run(self, location=None):
|
|
15
|
+
def run(self, location=None): # pylint: disable=arguments-differ
|
|
16
16
|
logger.info("The Location if any that the user provided.", extra={"object": location})
|
|
17
17
|
return "Nice Location (or not)!"
|
|
18
18
|
|
|
@@ -12,7 +12,7 @@ class TestRequiredObjectVar(Job):
|
|
|
12
12
|
required=True,
|
|
13
13
|
)
|
|
14
14
|
|
|
15
|
-
def run(self, location):
|
|
15
|
+
def run(self, location): # pylint: disable=arguments-differ
|
|
16
16
|
logger.info("The Location that the user provided.", extra={"object": location})
|
|
17
17
|
return "Nice Location!"
|
|
18
18
|
|
|
@@ -13,7 +13,7 @@ class TestObjectVars(Job):
|
|
|
13
13
|
role = ObjectVar(model=Role)
|
|
14
14
|
roles = MultiObjectVar(model=Role)
|
|
15
15
|
|
|
16
|
-
def run(self, role, roles):
|
|
16
|
+
def run(self, role, roles): # pylint: disable=arguments-differ
|
|
17
17
|
logger.info("Role: %s", role)
|
|
18
18
|
logger.warning("Roles: %s", roles)
|
|
19
19
|
|
|
@@ -5,7 +5,7 @@ from nautobot.extras.jobs import get_task_logger, Job
|
|
|
5
5
|
logger = get_task_logger(__name__)
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
class
|
|
8
|
+
class TestPassJob(Job):
|
|
9
9
|
"""
|
|
10
10
|
Job with pass result.
|
|
11
11
|
"""
|
|
@@ -24,7 +24,7 @@ class TestPass(Job):
|
|
|
24
24
|
raise RuntimeError(f"Expected kwargs to be empty, but it was {kwargs!r}")
|
|
25
25
|
logger.info("before_start() was called as expected")
|
|
26
26
|
|
|
27
|
-
def run(self):
|
|
27
|
+
def run(self): # pylint: disable=arguments-differ
|
|
28
28
|
"""
|
|
29
29
|
Job function.
|
|
30
30
|
"""
|
|
@@ -61,4 +61,4 @@ class TestPass(Job):
|
|
|
61
61
|
logger.info("after_return() was called as expected")
|
|
62
62
|
|
|
63
63
|
|
|
64
|
-
register_jobs(
|
|
64
|
+
register_jobs(TestPassJob)
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
from fail import
|
|
1
|
+
from fail import TestFailJob # pylint: disable=import-error
|
|
2
2
|
|
|
3
3
|
from nautobot.apps.jobs import register_jobs
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
class TestReallyPass(
|
|
7
|
-
def run(self):
|
|
6
|
+
class TestReallyPass(TestFailJob):
|
|
7
|
+
def run(self): # pylint: disable=arguments-differ
|
|
8
8
|
pass
|
|
9
9
|
|
|
10
10
|
|
|
@@ -1535,10 +1535,10 @@ class JobTest(
|
|
|
1535
1535
|
self.assertHttpStatus(response, status.HTTP_404_NOT_FOUND)
|
|
1536
1536
|
|
|
1537
1537
|
# Try post to permitted job
|
|
1538
|
-
job_model = Job.objects.get_for_class_path("pass.
|
|
1538
|
+
job_model = Job.objects.get_for_class_path("pass.TestPassJob")
|
|
1539
1539
|
job_model.enabled = True
|
|
1540
1540
|
job_model.validated_save()
|
|
1541
|
-
url = self.get_run_url("pass.
|
|
1541
|
+
url = self.get_run_url("pass.TestPassJob")
|
|
1542
1542
|
response = self.client.post(url, **self.header)
|
|
1543
1543
|
self.assertHttpStatus(response, self.run_success_response_status)
|
|
1544
1544
|
|
|
@@ -2091,10 +2091,10 @@ class JobTest(
|
|
|
2091
2091
|
"task_queue": settings.CELERY_TASK_DEFAULT_QUEUE,
|
|
2092
2092
|
}
|
|
2093
2093
|
|
|
2094
|
-
job_model = Job.objects.get_for_class_path("pass.
|
|
2094
|
+
job_model = Job.objects.get_for_class_path("pass.TestPassJob")
|
|
2095
2095
|
job_model.enabled = True
|
|
2096
2096
|
job_model.validated_save()
|
|
2097
|
-
url = self.get_run_url("pass.
|
|
2097
|
+
url = self.get_run_url("pass.TestPassJob")
|
|
2098
2098
|
response = self.client.post(url, data, format="json", **self.header)
|
|
2099
2099
|
self.assertHttpStatus(response, self.run_success_response_status)
|
|
2100
2100
|
|
|
@@ -2465,10 +2465,10 @@ class ScheduledJobTest(
|
|
|
2465
2465
|
@classmethod
|
|
2466
2466
|
def setUpTestData(cls):
|
|
2467
2467
|
user = User.objects.create(username="user1", is_active=True)
|
|
2468
|
-
job_model = Job.objects.get_for_class_path("pass.
|
|
2468
|
+
job_model = Job.objects.get_for_class_path("pass.TestPassJob")
|
|
2469
2469
|
ScheduledJob.objects.create(
|
|
2470
2470
|
name="test1",
|
|
2471
|
-
task="pass.
|
|
2471
|
+
task="pass.TestPassJob",
|
|
2472
2472
|
job_model=job_model,
|
|
2473
2473
|
interval=JobExecutionType.TYPE_IMMEDIATELY,
|
|
2474
2474
|
user=user,
|
|
@@ -2477,7 +2477,7 @@ class ScheduledJobTest(
|
|
|
2477
2477
|
)
|
|
2478
2478
|
ScheduledJob.objects.create(
|
|
2479
2479
|
name="test2",
|
|
2480
|
-
task="pass.
|
|
2480
|
+
task="pass.TestPassJob",
|
|
2481
2481
|
job_model=job_model,
|
|
2482
2482
|
interval=JobExecutionType.TYPE_DAILY,
|
|
2483
2483
|
user=user,
|
|
@@ -2487,7 +2487,7 @@ class ScheduledJobTest(
|
|
|
2487
2487
|
)
|
|
2488
2488
|
ScheduledJob.objects.create(
|
|
2489
2489
|
name="test3",
|
|
2490
|
-
task="pass.
|
|
2490
|
+
task="pass.TestPassJob",
|
|
2491
2491
|
job_model=job_model,
|
|
2492
2492
|
interval=JobExecutionType.TYPE_CUSTOM,
|
|
2493
2493
|
crontab="34 12 * * *",
|
|
@@ -2502,12 +2502,12 @@ class JobApprovalTest(APITestCase):
|
|
|
2502
2502
|
@classmethod
|
|
2503
2503
|
def setUpTestData(cls):
|
|
2504
2504
|
cls.additional_user = User.objects.create(username="user1", is_active=True)
|
|
2505
|
-
cls.job_model = Job.objects.get_for_class_path("pass.
|
|
2505
|
+
cls.job_model = Job.objects.get_for_class_path("pass.TestPassJob")
|
|
2506
2506
|
cls.job_model.enabled = True
|
|
2507
2507
|
cls.job_model.save()
|
|
2508
2508
|
cls.scheduled_job = ScheduledJob.objects.create(
|
|
2509
2509
|
name="test pass",
|
|
2510
|
-
task="pass.
|
|
2510
|
+
task="pass.TestPassJob",
|
|
2511
2511
|
job_model=cls.job_model,
|
|
2512
2512
|
interval=JobExecutionType.TYPE_IMMEDIATELY,
|
|
2513
2513
|
user=cls.additional_user,
|
|
@@ -2560,7 +2560,7 @@ class JobApprovalTest(APITestCase):
|
|
|
2560
2560
|
self.add_permissions("extras.approve_job", "extras.view_scheduledjob", "extras.change_scheduledjob")
|
|
2561
2561
|
scheduled_job = ScheduledJob.objects.create(
|
|
2562
2562
|
name="test",
|
|
2563
|
-
task="pass.
|
|
2563
|
+
task="pass.TestPassJob",
|
|
2564
2564
|
job_model=self.job_model,
|
|
2565
2565
|
interval=JobExecutionType.TYPE_IMMEDIATELY,
|
|
2566
2566
|
user=self.user,
|
|
@@ -2583,7 +2583,7 @@ class JobApprovalTest(APITestCase):
|
|
|
2583
2583
|
self.add_permissions("extras.approve_job", "extras.view_scheduledjob", "extras.change_scheduledjob")
|
|
2584
2584
|
scheduled_job = ScheduledJob.objects.create(
|
|
2585
2585
|
name="test",
|
|
2586
|
-
task="pass.
|
|
2586
|
+
task="pass.TestPassJob",
|
|
2587
2587
|
job_model=self.job_model,
|
|
2588
2588
|
interval=JobExecutionType.TYPE_FUTURE,
|
|
2589
2589
|
one_off=True,
|
|
@@ -2600,7 +2600,7 @@ class JobApprovalTest(APITestCase):
|
|
|
2600
2600
|
self.add_permissions("extras.approve_job", "extras.view_scheduledjob", "extras.change_scheduledjob")
|
|
2601
2601
|
scheduled_job = ScheduledJob.objects.create(
|
|
2602
2602
|
name="test",
|
|
2603
|
-
task="pass.
|
|
2603
|
+
task="pass.TestPassJob",
|
|
2604
2604
|
job_model=self.job_model,
|
|
2605
2605
|
interval=JobExecutionType.TYPE_FUTURE,
|
|
2606
2606
|
one_off=True,
|
|
@@ -2240,7 +2240,7 @@ class CustomFieldTableTest(TestCase):
|
|
|
2240
2240
|
self.assertIsNotNone(custom_column, internal_col_name)
|
|
2241
2241
|
self.assertIsInstance(custom_column, CustomFieldColumn)
|
|
2242
2242
|
|
|
2243
|
-
rendered_value = bound_row.get_cell(internal_col_name)
|
|
2243
|
+
rendered_value = bound_row.get_cell(internal_col_name) # pylint: disable=no-member
|
|
2244
2244
|
self.assertEqual(rendered_value, col_expected_value)
|
|
2245
2245
|
|
|
2246
2246
|
|
|
@@ -285,7 +285,8 @@ class GitTest(TransactionTestCase):
|
|
|
285
285
|
|
|
286
286
|
self.repo.secrets_group = secrets_group
|
|
287
287
|
self.repo.remote_url = "http://localhost/git.git"
|
|
288
|
-
|
|
288
|
+
# avoid failing due to lack of jobs module
|
|
289
|
+
self.repo.provided_contents.remove("extras.job") # pylint: disable=no-member
|
|
289
290
|
self.repo.save()
|
|
290
291
|
|
|
291
292
|
self.mock_request.id = uuid.uuid4()
|
|
@@ -587,7 +587,7 @@ class DynamicGroupModelTest(DynamicGroupTestBase): # TODO: BaseModelTestCase mi
|
|
|
587
587
|
"""
|
|
588
588
|
pfx_content_type = ContentType.objects.get_for_model(Prefix)
|
|
589
589
|
group = DynamicGroup(name="pfx", content_type=pfx_content_type)
|
|
590
|
-
filterset = group.filterset_class()
|
|
590
|
+
filterset = group.filterset_class() # pylint: disable=not-callable # should not be None here!
|
|
591
591
|
fields = group._map_filter_fields
|
|
592
592
|
|
|
593
593
|
# We know that `within_include` does not have a `generate_query_{filter_method}` method.
|
|
@@ -1078,11 +1078,11 @@ class JobFilterSetTestCase(FilterTestCases.NameOnlyFilterTestCase):
|
|
|
1078
1078
|
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2)
|
|
1079
1079
|
|
|
1080
1080
|
def test_installed(self):
|
|
1081
|
-
params = {"job_class_name": "
|
|
1081
|
+
params = {"job_class_name": "TestPassJob", "installed": True}
|
|
1082
1082
|
self.assertTrue(self.filterset(params, self.queryset).qs.exists())
|
|
1083
1083
|
|
|
1084
1084
|
def test_enabled(self):
|
|
1085
|
-
params = {"job_class_name": "
|
|
1085
|
+
params = {"job_class_name": "TestPassJob", "enabled": False}
|
|
1086
1086
|
self.assertTrue(self.filterset(params, self.queryset).qs.exists())
|
|
1087
1087
|
|
|
1088
1088
|
def test_dryrun_default(self):
|
|
@@ -1134,11 +1134,11 @@ class JobResultFilterSetTestCase(FilterTestCases.FilterTestCase):
|
|
|
1134
1134
|
jobs = Job.objects.all()[:3]
|
|
1135
1135
|
cls.jobs = jobs
|
|
1136
1136
|
user = User.objects.create(username="user1", is_active=True)
|
|
1137
|
-
job_model = Job.objects.get_for_class_path("pass.
|
|
1137
|
+
job_model = Job.objects.get_for_class_path("pass.TestPassJob")
|
|
1138
1138
|
scheduled_jobs = [
|
|
1139
1139
|
ScheduledJob.objects.create(
|
|
1140
1140
|
name="test1",
|
|
1141
|
-
task="pass.
|
|
1141
|
+
task="pass.TestPassJob",
|
|
1142
1142
|
job_model=job_model,
|
|
1143
1143
|
interval=JobExecutionType.TYPE_IMMEDIATELY,
|
|
1144
1144
|
user=user,
|
|
@@ -1147,7 +1147,7 @@ class JobResultFilterSetTestCase(FilterTestCases.FilterTestCase):
|
|
|
1147
1147
|
),
|
|
1148
1148
|
ScheduledJob.objects.create(
|
|
1149
1149
|
name="test2",
|
|
1150
|
-
task="pass.
|
|
1150
|
+
task="pass.TestPassJob",
|
|
1151
1151
|
job_model=job_model,
|
|
1152
1152
|
interval=JobExecutionType.TYPE_DAILY,
|
|
1153
1153
|
user=user,
|
|
@@ -1157,7 +1157,7 @@ class JobResultFilterSetTestCase(FilterTestCases.FilterTestCase):
|
|
|
1157
1157
|
),
|
|
1158
1158
|
ScheduledJob.objects.create(
|
|
1159
1159
|
name="test3",
|
|
1160
|
-
task="pass.
|
|
1160
|
+
task="pass.TestPassJob",
|
|
1161
1161
|
job_model=job_model,
|
|
1162
1162
|
interval=JobExecutionType.TYPE_CUSTOM,
|
|
1163
1163
|
crontab="34 12 * * *",
|
|
@@ -170,7 +170,7 @@ class JobTest(TestCase):
|
|
|
170
170
|
self.assertTrue(job_model.supports_dryrun)
|
|
171
171
|
|
|
172
172
|
module = "pass"
|
|
173
|
-
name = "
|
|
173
|
+
name = "TestPassJob"
|
|
174
174
|
job_class, job_model = get_job_class_and_model(module, name)
|
|
175
175
|
self.assertFalse(job_class.supports_dryrun)
|
|
176
176
|
self.assertFalse(job_model.supports_dryrun)
|
|
@@ -212,7 +212,7 @@ register_jobs(MyJob)
|
|
|
212
212
|
self.assertIsNotNone(get_job("my_jobs.MyJob"))
|
|
213
213
|
# Also make sure some representative previous JOBS_ROOT jobs aren't still around:
|
|
214
214
|
self.assertNotIn("dry_run.TestDryRun", jobs_data.keys())
|
|
215
|
-
self.assertNotIn("pass.
|
|
215
|
+
self.assertNotIn("pass.TestPassJob", jobs_data.keys())
|
|
216
216
|
|
|
217
217
|
# Create a second Job in the same module
|
|
218
218
|
with open(os.path.join(temp_dir, "my_jobs.py"), "a") as fd:
|
|
@@ -319,7 +319,7 @@ class JobTransactionTest(TransactionTestCase):
|
|
|
319
319
|
Job test with pass result.
|
|
320
320
|
"""
|
|
321
321
|
module = "pass"
|
|
322
|
-
name = "
|
|
322
|
+
name = "TestPassJob"
|
|
323
323
|
job_result = create_job_result_and_run_job(module, name)
|
|
324
324
|
self.assertEqual(job_result.status, JobResultStatusChoices.STATUS_SUCCESS)
|
|
325
325
|
self.assertEqual(job_result.result, True)
|
|
@@ -353,7 +353,7 @@ class JobTransactionTest(TransactionTestCase):
|
|
|
353
353
|
Job test with fail result.
|
|
354
354
|
"""
|
|
355
355
|
module = "fail"
|
|
356
|
-
name = "
|
|
356
|
+
name = "TestFailJob"
|
|
357
357
|
job_result = create_job_result_and_run_job(module, name)
|
|
358
358
|
self.assertEqual(job_result.status, JobResultStatusChoices.STATUS_FAILURE)
|
|
359
359
|
logs = job_result.job_log_entries
|
|
@@ -588,7 +588,7 @@ class JobTransactionTest(TransactionTestCase):
|
|
|
588
588
|
Job test to see if the latest_result property is indeed returning the most recent job result
|
|
589
589
|
"""
|
|
590
590
|
module = "pass"
|
|
591
|
-
name = "
|
|
591
|
+
name = "TestPassJob"
|
|
592
592
|
job_result_1 = create_job_result_and_run_job(module, name)
|
|
593
593
|
self.assertEqual(job_result_1.status, JobResultStatusChoices.STATUS_SUCCESS)
|
|
594
594
|
job_result_2 = create_job_result_and_run_job(module, name)
|
|
@@ -803,7 +803,7 @@ class RunJobManagementCommandTest(TransactionTestCase):
|
|
|
803
803
|
def test_runjob_nochange_successful(self):
|
|
804
804
|
"""Basic success-path test for Jobs that don't modify the Nautobot database."""
|
|
805
805
|
module = "pass"
|
|
806
|
-
name = "
|
|
806
|
+
name = "TestPassJob"
|
|
807
807
|
_job_class, job_model = get_job_class_and_model(module, name)
|
|
808
808
|
|
|
809
809
|
out, err = self.run_command("--local", "--no-color", "--username", self.user.username, job_model.class_path)
|
|
@@ -903,7 +903,7 @@ class JobButtonReceiverTest(TestCase):
|
|
|
903
903
|
def test_is_job_button(self):
|
|
904
904
|
with self.subTest(expected=False):
|
|
905
905
|
module = "pass"
|
|
906
|
-
name = "
|
|
906
|
+
name = "TestPassJob"
|
|
907
907
|
_job_class, job_model = get_job_class_and_model(module, name)
|
|
908
908
|
self.assertFalse(job_model.is_job_button_receiver)
|
|
909
909
|
|
|
@@ -966,7 +966,7 @@ class JobHookReceiverTest(TestCase):
|
|
|
966
966
|
def test_is_job_hook(self):
|
|
967
967
|
with self.subTest(expected=False):
|
|
968
968
|
module = "pass"
|
|
969
|
-
name = "
|
|
969
|
+
name = "TestPassJob"
|
|
970
970
|
_job_class, job_model = get_job_class_and_model(module, name)
|
|
971
971
|
self.assertFalse(job_model.is_job_hook_receiver)
|
|
972
972
|
|
|
@@ -1127,7 +1127,7 @@ class RemoveScheduledJobManagementCommandTestCase(TestCase):
|
|
|
1127
1127
|
for i in range(1, 7):
|
|
1128
1128
|
models.ScheduledJob.objects.create(
|
|
1129
1129
|
name=f"test{i}",
|
|
1130
|
-
task="pass.
|
|
1130
|
+
task="pass.TestPassJob",
|
|
1131
1131
|
interval=JobExecutionType.TYPE_FUTURE,
|
|
1132
1132
|
user=self.user,
|
|
1133
1133
|
start_time=timezone.now() - datetime.timedelta(days=i * 30),
|
|
@@ -1136,7 +1136,7 @@ class RemoveScheduledJobManagementCommandTestCase(TestCase):
|
|
|
1136
1136
|
|
|
1137
1137
|
models.ScheduledJob.objects.create(
|
|
1138
1138
|
name="test7",
|
|
1139
|
-
task="pass.
|
|
1139
|
+
task="pass.TestPassJob",
|
|
1140
1140
|
interval=JobExecutionType.TYPE_DAILY,
|
|
1141
1141
|
user=self.user,
|
|
1142
1142
|
start_time=timezone.now() - datetime.timedelta(days=180),
|
|
@@ -1164,7 +1164,7 @@ class ScheduledJobIntervalTestCase(TestCase):
|
|
|
1164
1164
|
start_time = timezone.now() + datetime.timedelta(days=6)
|
|
1165
1165
|
scheduled_job = models.ScheduledJob.objects.create(
|
|
1166
1166
|
name="weekly_interval",
|
|
1167
|
-
task="pass.
|
|
1167
|
+
task="pass.TestPassJob",
|
|
1168
1168
|
interval=JobExecutionType.TYPE_WEEKLY,
|
|
1169
1169
|
user=self.user,
|
|
1170
1170
|
start_time=start_time,
|
|
@@ -1086,7 +1086,7 @@ class JobModelTest(ModelTestCases.BaseModelTestCase):
|
|
|
1086
1086
|
@classmethod
|
|
1087
1087
|
def setUpTestData(cls):
|
|
1088
1088
|
# JobModel instances are automatically instantiated at startup, so we just need to look them up.
|
|
1089
|
-
cls.local_job = JobModel.objects.get(job_class_name="
|
|
1089
|
+
cls.local_job = JobModel.objects.get(job_class_name="TestPassJob")
|
|
1090
1090
|
cls.job_containing_sensitive_variables = JobModel.objects.get(job_class_name="ExampleLoggingJob")
|
|
1091
1091
|
cls.app_job = JobModel.objects.get(job_class_name="ExampleJob")
|
|
1092
1092
|
|
|
@@ -1098,7 +1098,7 @@ class JobModelTest(ModelTestCases.BaseModelTestCase):
|
|
|
1098
1098
|
self.assertEqual(self.app_job.job_class, ExampleJob)
|
|
1099
1099
|
|
|
1100
1100
|
def test_class_path(self):
|
|
1101
|
-
self.assertEqual(self.local_job.class_path, "pass.
|
|
1101
|
+
self.assertEqual(self.local_job.class_path, "pass.TestPassJob")
|
|
1102
1102
|
self.assertIsNotNone(self.local_job.job_class)
|
|
1103
1103
|
self.assertEqual(self.local_job.class_path, self.local_job.job_class.class_path)
|
|
1104
1104
|
|
|
@@ -1812,11 +1812,11 @@ class ScheduledJobTest(ModelTestCases.BaseModelTestCase):
|
|
|
1812
1812
|
|
|
1813
1813
|
def setUp(self):
|
|
1814
1814
|
self.user = User.objects.create_user(username="scheduledjobuser")
|
|
1815
|
-
self.job_model = JobModel.objects.get(name="
|
|
1815
|
+
self.job_model = JobModel.objects.get(name="TestPassJob")
|
|
1816
1816
|
|
|
1817
1817
|
self.daily_utc_job = ScheduledJob.objects.create(
|
|
1818
1818
|
name="Daily UTC Job",
|
|
1819
|
-
task="pass.
|
|
1819
|
+
task="pass.TestPassJob",
|
|
1820
1820
|
job_model=self.job_model,
|
|
1821
1821
|
interval=JobExecutionType.TYPE_DAILY,
|
|
1822
1822
|
start_time=datetime(year=2050, month=1, day=22, hour=17, minute=0, tzinfo=get_default_timezone()),
|
|
@@ -1824,7 +1824,7 @@ class ScheduledJobTest(ModelTestCases.BaseModelTestCase):
|
|
|
1824
1824
|
)
|
|
1825
1825
|
self.daily_est_job = ScheduledJob.objects.create(
|
|
1826
1826
|
name="Daily EST Job",
|
|
1827
|
-
task="pass.
|
|
1827
|
+
task="pass.TestPassJob",
|
|
1828
1828
|
job_model=self.job_model,
|
|
1829
1829
|
interval=JobExecutionType.TYPE_DAILY,
|
|
1830
1830
|
start_time=datetime(year=2050, month=1, day=22, hour=17, minute=0, tzinfo=ZoneInfo("America/New_York")),
|
|
@@ -1839,7 +1839,7 @@ class ScheduledJobTest(ModelTestCases.BaseModelTestCase):
|
|
|
1839
1839
|
)
|
|
1840
1840
|
self.crontab_est_job = ScheduledJob.objects.create(
|
|
1841
1841
|
name="Crontab EST Job",
|
|
1842
|
-
task="pass.
|
|
1842
|
+
task="pass.TestPassJob",
|
|
1843
1843
|
job_model=self.job_model,
|
|
1844
1844
|
interval=JobExecutionType.TYPE_CUSTOM,
|
|
1845
1845
|
start_time=datetime(year=2050, month=1, day=22, hour=17, minute=0, tzinfo=ZoneInfo("America/New_York")),
|
|
@@ -1848,7 +1848,7 @@ class ScheduledJobTest(ModelTestCases.BaseModelTestCase):
|
|
|
1848
1848
|
)
|
|
1849
1849
|
self.one_off_utc_job = ScheduledJob.objects.create(
|
|
1850
1850
|
name="One-off UTC Job",
|
|
1851
|
-
task="pass.
|
|
1851
|
+
task="pass.TestPassJob",
|
|
1852
1852
|
job_model=self.job_model,
|
|
1853
1853
|
interval=JobExecutionType.TYPE_FUTURE,
|
|
1854
1854
|
start_time=datetime(year=2050, month=1, day=22, hour=0, minute=0, tzinfo=ZoneInfo("UTC")),
|
|
@@ -1987,7 +1987,7 @@ class ScheduledJobTest(ModelTestCases.BaseModelTestCase):
|
|
|
1987
1987
|
"""Test that TYPE_CUSTOM behavior around DST is as expected."""
|
|
1988
1988
|
cronjob = ScheduledJob.objects.create(
|
|
1989
1989
|
name="DST Aware Cronjob",
|
|
1990
|
-
task="pass.
|
|
1990
|
+
task="pass.TestPassJob",
|
|
1991
1991
|
job_model=self.job_model,
|
|
1992
1992
|
enabled=False,
|
|
1993
1993
|
interval=JobExecutionType.TYPE_CUSTOM,
|
|
@@ -2042,7 +2042,7 @@ class ScheduledJobTest(ModelTestCases.BaseModelTestCase):
|
|
|
2042
2042
|
"""Test the interaction of TYPE_DAILY around DST."""
|
|
2043
2043
|
daily = ScheduledJob.objects.create(
|
|
2044
2044
|
name="Daily Job",
|
|
2045
|
-
task="pass.
|
|
2045
|
+
task="pass.TestPassJob",
|
|
2046
2046
|
job_model=self.job_model,
|
|
2047
2047
|
enabled=False,
|
|
2048
2048
|
interval=JobExecutionType.TYPE_DAILY,
|
|
@@ -2583,7 +2583,7 @@ class JobLogEntryTest(TestCase): # TODO: change to BaseModelTestCase
|
|
|
2583
2583
|
|
|
2584
2584
|
def setUp(self):
|
|
2585
2585
|
module = "pass"
|
|
2586
|
-
name = "
|
|
2586
|
+
name = "TestPassJob"
|
|
2587
2587
|
job_class = get_job(f"{module}.{name}")
|
|
2588
2588
|
|
|
2589
2589
|
self.job_result = JobResult.objects.create(name=job_class.class_path, user=None)
|
|
@@ -1325,7 +1325,7 @@ class RelationshipTableTest(RelationshipBaseTest, TestCase):
|
|
|
1325
1325
|
self.assertIsNotNone(relationship_column)
|
|
1326
1326
|
self.assertIsInstance(relationship_column, RelationshipColumn)
|
|
1327
1327
|
|
|
1328
|
-
rendered_value = bound_row.get_cell(internal_col_name)
|
|
1328
|
+
rendered_value = bound_row.get_cell(internal_col_name) # pylint: disable=no-member
|
|
1329
1329
|
# Test if the expected value is in the rendered value.
|
|
1330
1330
|
# Exact match is difficult because the order of rendering is unpredictable.
|
|
1331
1331
|
for value in col_expected_value:
|