nautobot 2.4.0__py3-none-any.whl → 2.4.0b1__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/apps/__init__.py +1 -1
- nautobot/apps/api.py +8 -8
- nautobot/apps/change_logging.py +2 -2
- nautobot/apps/choices.py +4 -4
- nautobot/apps/events.py +3 -3
- nautobot/apps/factory.py +2 -2
- nautobot/apps/filters.py +1 -1
- nautobot/apps/forms.py +20 -20
- nautobot/apps/graphql.py +2 -2
- nautobot/apps/jobs.py +8 -8
- nautobot/apps/models.py +19 -19
- nautobot/apps/tables.py +1 -1
- nautobot/apps/testing.py +10 -10
- nautobot/apps/ui.py +2 -2
- nautobot/apps/utils.py +7 -7
- nautobot/apps/views.py +7 -7
- nautobot/circuits/api/serializers.py +0 -1
- nautobot/circuits/api/views.py +8 -4
- nautobot/circuits/tables.py +1 -2
- nautobot/circuits/templates/circuits/circuit_create.html +7 -1
- nautobot/circuits/views.py +3 -3
- nautobot/cloud/api/views.py +10 -6
- nautobot/cloud/models.py +1 -1
- nautobot/cloud/views.py +16 -0
- nautobot/core/api/fields.py +5 -5
- nautobot/core/api/filter_backends.py +9 -3
- nautobot/core/api/schema.py +2 -13
- nautobot/core/api/serializers.py +34 -40
- nautobot/core/api/views.py +4 -56
- nautobot/core/celery/log.py +4 -4
- nautobot/core/celery/schedulers.py +1 -1
- nautobot/core/choices.py +2 -2
- nautobot/core/events/__init__.py +3 -3
- nautobot/core/filters.py +16 -21
- nautobot/core/fixtures/user-data.json +59 -0
- nautobot/core/forms/__init__.py +19 -19
- nautobot/core/forms/fields.py +11 -14
- nautobot/core/forms/forms.py +2 -33
- nautobot/core/graphql/types.py +1 -1
- nautobot/core/jobs/__init__.py +7 -28
- nautobot/core/jobs/cleanup.py +12 -48
- 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 +3 -6
- nautobot/core/settings.py +2 -29
- nautobot/core/settings.yaml +0 -21
- nautobot/core/tables.py +60 -74
- nautobot/core/templates/inc/media.html +0 -3
- nautobot/core/templates/inc/nav_menu.html +0 -1
- nautobot/core/templates/nautobot_config.py.j2 +0 -13
- nautobot/core/templates/search.html +0 -7
- nautobot/core/templates/utilities/render_jinja2.html +1 -1
- nautobot/core/templates/utilities/templatetags/tag.html +1 -1
- nautobot/core/templates/utilities/theme_preview.html +0 -7
- nautobot/core/templatetags/helpers.py +2 -11
- nautobot/core/testing/__init__.py +8 -8
- nautobot/core/testing/api.py +15 -170
- nautobot/core/testing/filters.py +2 -25
- nautobot/core/testing/forms.py +0 -2
- nautobot/core/testing/mixins.py +2 -7
- nautobot/core/testing/views.py +29 -44
- nautobot/core/tests/integration/test_app_home.py +1 -0
- nautobot/core/tests/integration/test_app_navbar.py +1 -0
- nautobot/core/tests/integration/test_filters.py +2 -0
- nautobot/core/tests/integration/test_home.py +1 -0
- nautobot/core/tests/integration/test_navbar.py +1 -0
- nautobot/core/tests/integration/test_view_authentication.py +0 -1
- nautobot/core/tests/runner.py +1 -1
- nautobot/core/tests/test_api.py +1 -98
- nautobot/core/tests/test_csv.py +3 -25
- nautobot/core/tests/test_forms.py +0 -1
- nautobot/core/tests/test_jobs.py +1 -303
- nautobot/core/tests/test_settings_schema.py +0 -7
- nautobot/core/tests/test_tables.py +0 -100
- nautobot/core/tests/test_utils.py +1 -63
- nautobot/core/tests/test_views.py +3 -30
- nautobot/core/ui/nav.py +0 -1
- nautobot/core/ui/object_detail.py +1 -15
- nautobot/core/urls.py +0 -11
- nautobot/core/utils/lookup.py +8 -11
- nautobot/core/utils/requests.py +9 -24
- nautobot/core/views/__init__.py +0 -42
- nautobot/core/views/generic.py +176 -78
- nautobot/core/views/mixins.py +34 -94
- nautobot/core/views/renderers.py +6 -6
- nautobot/dcim/api/serializers.py +62 -54
- nautobot/dcim/api/views.py +113 -47
- nautobot/dcim/filters/__init__.py +2 -31
- nautobot/dcim/forms.py +17 -36
- nautobot/dcim/graphql/types.py +2 -2
- nautobot/dcim/models/__init__.py +1 -1
- nautobot/dcim/models/device_component_templates.py +2 -2
- nautobot/dcim/models/device_components.py +20 -22
- nautobot/dcim/models/devices.py +1 -10
- nautobot/dcim/models/locations.py +3 -3
- nautobot/dcim/models/power.py +5 -6
- nautobot/dcim/models/racks.py +4 -4
- nautobot/dcim/tables/__init__.py +3 -3
- nautobot/dcim/tables/devices.py +5 -7
- nautobot/dcim/tables/devicetypes.py +2 -2
- nautobot/dcim/tables/racks.py +1 -1
- nautobot/dcim/templates/dcim/controller_create.html +7 -1
- nautobot/dcim/templates/dcim/controller_retrieve.html +9 -1
- nautobot/dcim/templates/dcim/controllermanageddevicegroup_create.html +0 -2
- nautobot/dcim/templates/dcim/controllermanageddevicegroup_retrieve.html +0 -5
- nautobot/dcim/templates/dcim/device.html +9 -1
- nautobot/dcim/templates/dcim/device_edit.html +37 -36
- nautobot/dcim/templates/dcim/location.html +9 -1
- nautobot/dcim/templates/dcim/location_edit.html +7 -1
- nautobot/dcim/templates/dcim/rack.html +9 -1
- nautobot/dcim/templates/dcim/rack_edit.html +7 -1
- nautobot/dcim/templates/dcim/rackreservation.html +9 -1
- nautobot/dcim/templates/dcim/virtualdevicecontext_retrieve.html +9 -1
- nautobot/dcim/templates/dcim/virtualdevicecontext_update.html +7 -1
- nautobot/dcim/tests/test_api.py +3 -16
- nautobot/dcim/tests/test_filters.py +0 -33
- nautobot/dcim/tests/test_forms.py +2 -51
- nautobot/dcim/tests/test_graphql.py +0 -52
- nautobot/dcim/tests/test_models.py +5 -34
- nautobot/dcim/tests/test_views.py +83 -21
- nautobot/dcim/views.py +13 -1
- nautobot/extras/api/customfields.py +2 -2
- nautobot/extras/api/serializers.py +85 -90
- nautobot/extras/api/views.py +27 -22
- nautobot/extras/constants.py +0 -2
- nautobot/extras/filters/__init__.py +6 -8
- nautobot/extras/forms/base.py +2 -2
- nautobot/extras/forms/forms.py +31 -139
- nautobot/extras/forms/mixins.py +5 -13
- nautobot/extras/group_sync.py +3 -3
- nautobot/extras/health_checks.py +2 -1
- nautobot/extras/jobs.py +12 -70
- nautobot/extras/managers.py +1 -3
- nautobot/extras/migrations/0018_joblog_data_migration.py +9 -7
- nautobot/extras/models/__init__.py +1 -1
- nautobot/extras/models/contacts.py +1 -1
- nautobot/extras/models/customfields.py +11 -12
- nautobot/extras/models/groups.py +9 -11
- nautobot/extras/models/jobs.py +4 -23
- nautobot/extras/models/models.py +2 -2
- nautobot/extras/plugins/__init__.py +2 -13
- nautobot/extras/plugins/marketplace_manifest.yml +79 -84
- nautobot/extras/plugins/tables.py +14 -16
- nautobot/extras/plugins/views.py +69 -65
- nautobot/extras/registry.py +1 -1
- nautobot/extras/secrets/__init__.py +2 -2
- nautobot/extras/tables.py +5 -7
- nautobot/extras/templates/extras/dynamicgroup.html +9 -1
- nautobot/extras/templates/extras/job_detail.html +0 -16
- nautobot/extras/templates/extras/job_edit.html +0 -1
- nautobot/extras/templates/extras/jobqueue_retrieve.html +9 -1
- nautobot/extras/templates/extras/marketplace.html +11 -29
- nautobot/extras/templates/extras/plugin_detail.html +15 -32
- nautobot/extras/templates/extras/plugins_tiles.html +10 -21
- 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 +1 -3
- 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/integration/test_plugin_banner.py +2 -0
- nautobot/extras/tests/test_api.py +13 -13
- nautobot/extras/tests/test_customfields.py +1 -1
- nautobot/extras/tests/test_datasources.py +1 -2
- nautobot/extras/tests/test_dynamicgroups.py +1 -1
- nautobot/extras/tests/test_filters.py +6 -6
- nautobot/extras/tests/test_forms.py +1 -20
- nautobot/extras/tests/test_jobs.py +19 -160
- nautobot/extras/tests/test_models.py +10 -10
- nautobot/extras/tests/test_plugins.py +9 -62
- nautobot/extras/tests/test_relationships.py +9 -120
- nautobot/extras/tests/test_views.py +191 -52
- nautobot/extras/utils.py +2 -3
- nautobot/extras/views.py +98 -30
- nautobot/ipam/api/fields.py +3 -3
- nautobot/ipam/api/serializers.py +33 -41
- nautobot/ipam/api/views.py +117 -68
- nautobot/ipam/factory.py +1 -1
- nautobot/ipam/filters.py +2 -3
- nautobot/ipam/lookups.py +62 -101
- nautobot/ipam/models.py +16 -66
- nautobot/ipam/querysets.py +2 -2
- nautobot/ipam/tables.py +7 -23
- nautobot/ipam/templates/ipam/ipaddress.html +9 -1
- nautobot/ipam/templates/ipam/ipaddress_bulk_add.html +7 -1
- nautobot/ipam/templates/ipam/ipaddress_edit.html +7 -1
- nautobot/ipam/templates/ipam/prefix.html +9 -1
- nautobot/ipam/templates/ipam/prefix_edit.html +7 -1
- nautobot/ipam/templates/ipam/vlan.html +9 -1
- nautobot/ipam/templates/ipam/vlan_edit.html +7 -1
- nautobot/ipam/templates/ipam/vrf_edit.html +7 -1
- nautobot/ipam/tests/test_api.py +3 -416
- nautobot/ipam/tests/test_forms.py +47 -49
- nautobot/ipam/tests/test_migrations.py +30 -30
- nautobot/ipam/tests/test_models.py +34 -95
- nautobot/ipam/tests/test_querysets.py +1 -63
- nautobot/ipam/tests/test_views.py +0 -3
- nautobot/ipam/utils/__init__.py +6 -36
- nautobot/ipam/views.py +87 -61
- nautobot/project-static/bootstrap-3.4.1-dist/css/bootstrap-theme.css.map +1 -1
- nautobot/project-static/bootstrap-3.4.1-dist/css/bootstrap-theme.min.css.map +1 -1
- nautobot/project-static/bootstrap-3.4.1-dist/css/bootstrap.css +2 -40
- nautobot/project-static/bootstrap-3.4.1-dist/css/bootstrap.css.map +1 -1
- nautobot/project-static/bootstrap-3.4.1-dist/css/bootstrap.min.css +1 -1
- nautobot/project-static/bootstrap-3.4.1-dist/css/bootstrap.min.css.map +1 -1
- nautobot/project-static/docs/404.html +4 -46
- nautobot/project-static/docs/apps/index.html +4 -46
- nautobot/project-static/docs/apps/nautobot-apps.html +6 -47
- nautobot/project-static/docs/assets/_mkdocstrings.css +1 -25
- nautobot/project-static/docs/assets/javascripts/{bundle.88dd0f4e.min.js → bundle.83f73b43.min.js} +2 -2
- nautobot/project-static/docs/assets/javascripts/{bundle.88dd0f4e.min.js.map → bundle.83f73b43.min.js.map} +2 -2
- nautobot/project-static/docs/code-reference/nautobot/apps/__init__.html +10 -62
- nautobot/project-static/docs/code-reference/nautobot/apps/admin.html +7 -59
- nautobot/project-static/docs/code-reference/nautobot/apps/api.html +122 -374
- nautobot/project-static/docs/code-reference/nautobot/apps/change_logging.html +18 -90
- nautobot/project-static/docs/code-reference/nautobot/apps/choices.html +21 -95
- nautobot/project-static/docs/code-reference/nautobot/apps/config.html +6 -53
- nautobot/project-static/docs/code-reference/nautobot/apps/constants.html +5 -52
- nautobot/project-static/docs/code-reference/nautobot/apps/datasources.html +17 -79
- nautobot/project-static/docs/code-reference/nautobot/apps/events.html +28 -102
- nautobot/project-static/docs/code-reference/nautobot/apps/exceptions.html +21 -108
- nautobot/project-static/docs/code-reference/nautobot/apps/factory.html +38 -131
- nautobot/project-static/docs/code-reference/nautobot/apps/filters.html +65 -239
- nautobot/project-static/docs/code-reference/nautobot/apps/forms.html +165 -581
- nautobot/project-static/docs/code-reference/nautobot/apps/graphql.html +36 -109
- nautobot/project-static/docs/code-reference/nautobot/apps/jobs.html +167 -453
- nautobot/project-static/docs/code-reference/nautobot/apps/models.html +211 -493
- nautobot/project-static/docs/code-reference/nautobot/apps/querysets.html +8 -60
- nautobot/project-static/docs/code-reference/nautobot/apps/secrets.html +15 -71
- nautobot/project-static/docs/code-reference/nautobot/apps/tables.html +55 -407
- nautobot/project-static/docs/code-reference/nautobot/apps/testing.html +205 -585
- nautobot/project-static/docs/code-reference/nautobot/apps/ui.html +412 -858
- nautobot/project-static/docs/code-reference/nautobot/apps/urls.html +7 -59
- nautobot/project-static/docs/code-reference/nautobot/apps/utils.html +186 -448
- nautobot/project-static/docs/code-reference/nautobot/apps/views.html +147 -365
- nautobot/project-static/docs/development/apps/api/configuration-view.html +4 -46
- nautobot/project-static/docs/development/apps/api/database-backend-config.html +4 -46
- nautobot/project-static/docs/development/apps/api/models/django-admin.html +4 -46
- nautobot/project-static/docs/development/apps/api/models/global-search.html +4 -46
- nautobot/project-static/docs/development/apps/api/models/graphql.html +4 -46
- nautobot/project-static/docs/development/apps/api/models/index.html +4 -46
- nautobot/project-static/docs/development/apps/api/nautobot-app-config.html +4 -46
- nautobot/project-static/docs/development/apps/api/platform-features/custom-validators.html +4 -46
- nautobot/project-static/docs/development/apps/api/platform-features/filter-extensions.html +4 -46
- nautobot/project-static/docs/development/apps/api/platform-features/git-repository-content.html +4 -46
- nautobot/project-static/docs/development/apps/api/platform-features/index.html +4 -46
- nautobot/project-static/docs/development/apps/api/platform-features/jinja2-filters.html +4 -46
- nautobot/project-static/docs/development/apps/api/platform-features/jobs.html +4 -46
- nautobot/project-static/docs/development/apps/api/platform-features/populating-extensibility-features.html +4 -46
- nautobot/project-static/docs/development/apps/api/platform-features/secrets-providers.html +4 -46
- nautobot/project-static/docs/development/apps/api/platform-features/table-extensions.html +7 -68
- nautobot/project-static/docs/development/apps/api/platform-features/uniquely-identify-objects.html +4 -46
- nautobot/project-static/docs/development/apps/api/prometheus.html +4 -46
- nautobot/project-static/docs/development/apps/api/setup.html +4 -46
- nautobot/project-static/docs/development/apps/api/testing.html +4 -46
- nautobot/project-static/docs/development/apps/api/ui-extensions/banners.html +4 -46
- nautobot/project-static/docs/development/apps/api/ui-extensions/home-page.html +4 -46
- nautobot/project-static/docs/development/apps/api/ui-extensions/index.html +4 -46
- nautobot/project-static/docs/development/apps/api/ui-extensions/navigation.html +4 -46
- nautobot/project-static/docs/development/apps/api/ui-extensions/object-views.html +4 -46
- nautobot/project-static/docs/development/apps/api/views/base-template.html +4 -46
- nautobot/project-static/docs/development/apps/api/views/core-view-overrides.html +4 -46
- nautobot/project-static/docs/development/apps/api/views/django-generic-views.html +4 -46
- nautobot/project-static/docs/development/apps/api/views/help-documentation.html +4 -46
- nautobot/project-static/docs/development/apps/api/views/index.html +4 -46
- nautobot/project-static/docs/development/apps/api/views/nautobot-generic-views.html +4 -46
- nautobot/project-static/docs/development/apps/api/views/nautobotuiviewset.html +4 -46
- nautobot/project-static/docs/development/apps/api/views/nautobotuiviewsetrouter.html +4 -46
- nautobot/project-static/docs/development/apps/api/views/notes.html +4 -46
- nautobot/project-static/docs/development/apps/api/views/rest-api.html +6 -52
- nautobot/project-static/docs/development/apps/api/views/urls.html +4 -46
- nautobot/project-static/docs/development/apps/index.html +4 -46
- nautobot/project-static/docs/development/apps/migration/code-updates.html +4 -46
- nautobot/project-static/docs/development/apps/migration/dependency-updates.html +4 -46
- nautobot/project-static/docs/development/apps/migration/from-v1.html +4 -46
- nautobot/project-static/docs/development/apps/migration/model-updates/dcim.html +4 -46
- nautobot/project-static/docs/development/apps/migration/model-updates/extras.html +4 -46
- nautobot/project-static/docs/development/apps/migration/model-updates/global.html +4 -46
- nautobot/project-static/docs/development/apps/migration/model-updates/ipam.html +4 -46
- nautobot/project-static/docs/development/apps/migration/ui-component-framework/best-practices.html +8 -50
- nautobot/project-static/docs/development/apps/migration/ui-component-framework/custom-content.html +4 -46
- nautobot/project-static/docs/development/apps/migration/ui-component-framework/index.html +14 -211
- nautobot/project-static/docs/development/apps/migration/ui-component-framework/migration-steps.html +4 -46
- nautobot/project-static/docs/development/apps/porting-from-netbox.html +4 -46
- nautobot/project-static/docs/development/core/application-registry.html +4 -46
- nautobot/project-static/docs/development/core/best-practices.html +4 -46
- nautobot/project-static/docs/development/core/bootstrap-ui.html +4 -46
- nautobot/project-static/docs/development/core/caching.html +4 -46
- nautobot/project-static/docs/development/core/controllers.html +4 -46
- nautobot/project-static/docs/development/core/docker-compose-advanced-use-cases.html +74 -73
- nautobot/project-static/docs/development/core/generic-views.html +4 -46
- nautobot/project-static/docs/development/core/getting-started.html +224 -249
- nautobot/project-static/docs/development/core/homepage.html +7 -49
- nautobot/project-static/docs/development/core/index.html +4 -46
- nautobot/project-static/docs/development/core/{minikube-dev-environment-for-k8s-jobs.html → local-k8s.html} +168 -469
- nautobot/project-static/docs/development/core/model-checklist.html +12 -56
- nautobot/project-static/docs/development/core/model-features.html +4 -46
- nautobot/project-static/docs/development/core/natural-keys.html +4 -46
- nautobot/project-static/docs/development/core/navigation-menu.html +4 -46
- nautobot/project-static/docs/development/core/release-checklist.html +7 -49
- nautobot/project-static/docs/development/core/role-internals.html +4 -46
- nautobot/project-static/docs/development/core/settings.html +4 -46
- nautobot/project-static/docs/development/core/style-guide.html +7 -49
- nautobot/project-static/docs/development/core/templates.html +4 -46
- nautobot/project-static/docs/development/core/testing.html +4 -46
- nautobot/project-static/docs/development/core/ui-component-framework.html +273 -369
- nautobot/project-static/docs/development/core/user-preferences.html +4 -46
- nautobot/project-static/docs/development/index.html +4 -46
- nautobot/project-static/docs/development/jobs/index.html +122 -216
- nautobot/project-static/docs/development/jobs/migration/from-v1.html +4 -46
- nautobot/project-static/docs/index.html +23 -54
- nautobot/project-static/docs/objects.inv +0 -0
- nautobot/project-static/docs/overview/application_stack.html +7 -47
- nautobot/project-static/docs/overview/design_philosophy.html +4 -46
- nautobot/project-static/docs/release-notes/index.html +12 -52
- nautobot/project-static/docs/release-notes/version-1.0.html +193 -234
- nautobot/project-static/docs/release-notes/version-1.1.html +190 -231
- nautobot/project-static/docs/release-notes/version-1.2.html +265 -306
- nautobot/project-static/docs/release-notes/version-1.3.html +291 -332
- nautobot/project-static/docs/release-notes/version-1.4.html +377 -417
- nautobot/project-static/docs/release-notes/version-1.5.html +566 -605
- nautobot/project-static/docs/release-notes/version-1.6.html +447 -904
- nautobot/project-static/docs/release-notes/version-2.0.html +489 -528
- nautobot/project-static/docs/release-notes/version-2.1.html +324 -363
- nautobot/project-static/docs/release-notes/version-2.2.html +317 -356
- nautobot/project-static/docs/release-notes/version-2.3.html +352 -997
- nautobot/project-static/docs/release-notes/version-2.4.html +101 -417
- nautobot/project-static/docs/requirements.txt +2 -2
- nautobot/project-static/docs/search/search_index.json +1 -1
- nautobot/project-static/docs/sitemap.xml +287 -295
- nautobot/project-static/docs/sitemap.xml.gz +0 -0
- nautobot/project-static/docs/user-guide/administration/configuration/authentication/ldap.html +4 -46
- nautobot/project-static/docs/user-guide/administration/configuration/authentication/remote.html +4 -46
- nautobot/project-static/docs/user-guide/administration/configuration/authentication/sso.html +6 -48
- nautobot/project-static/docs/user-guide/administration/configuration/index.html +4 -46
- nautobot/project-static/docs/user-guide/administration/configuration/redis.html +4 -46
- nautobot/project-static/docs/user-guide/administration/configuration/settings.html +8 -110
- nautobot/project-static/docs/user-guide/administration/configuration/time-zones.html +4 -46
- nautobot/project-static/docs/user-guide/administration/guides/celery-queues.html +4 -46
- nautobot/project-static/docs/user-guide/administration/guides/docker.html +4 -46
- nautobot/project-static/docs/user-guide/administration/guides/health-checks.html +4 -46
- nautobot/project-static/docs/user-guide/administration/guides/permissions.html +4 -46
- nautobot/project-static/docs/user-guide/administration/guides/prometheus-metrics.html +4 -46
- nautobot/project-static/docs/user-guide/administration/guides/replicating-nautobot.html +4 -46
- nautobot/project-static/docs/user-guide/administration/guides/request-profiling.html +4 -46
- nautobot/project-static/docs/user-guide/administration/guides/s3-django-storage.html +6 -48
- nautobot/project-static/docs/user-guide/administration/guides/selinux-troubleshooting.html +4 -46
- nautobot/project-static/docs/user-guide/administration/installation/app-install.html +4 -46
- nautobot/project-static/docs/user-guide/administration/installation/external-authentication.html +4 -46
- nautobot/project-static/docs/user-guide/administration/installation/http-server.html +8 -66
- nautobot/project-static/docs/user-guide/administration/installation/index.html +4 -46
- nautobot/project-static/docs/user-guide/administration/installation/install_system.html +5 -47
- nautobot/project-static/docs/user-guide/administration/installation/nautobot.html +4 -46
- nautobot/project-static/docs/user-guide/administration/installation/services.html +4 -46
- nautobot/project-static/docs/user-guide/administration/migration/migrating-from-netbox.html +4 -46
- nautobot/project-static/docs/user-guide/administration/migration/migrating-from-postgresql.html +4 -46
- nautobot/project-static/docs/user-guide/administration/tools/nautobot-server.html +4 -46
- nautobot/project-static/docs/user-guide/administration/tools/nautobot-shell.html +4 -46
- nautobot/project-static/docs/user-guide/administration/upgrading/database-backup.html +4 -46
- nautobot/project-static/docs/user-guide/administration/upgrading/from-v1/ipam/after-you-upgrade.html +4 -46
- nautobot/project-static/docs/user-guide/administration/upgrading/from-v1/ipam/before-you-upgrade.html +4 -46
- nautobot/project-static/docs/user-guide/administration/upgrading/from-v1/ipam/for-developers.html +4 -46
- nautobot/project-static/docs/user-guide/administration/upgrading/from-v1/ipam/index.html +4 -46
- nautobot/project-static/docs/user-guide/administration/upgrading/from-v1/ipam/whats-changed.html +8 -49
- nautobot/project-static/docs/user-guide/administration/upgrading/from-v1/region-and-site-data-migration-guide.html +4 -46
- nautobot/project-static/docs/user-guide/administration/upgrading/from-v1/upgrading-from-nautobot-v1.html +4 -46
- nautobot/project-static/docs/user-guide/administration/upgrading/upgrading.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/circuits/circuit.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/circuits/circuittermination.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/circuits/circuittype.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/circuits/provider.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/circuits/providernetwork.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/cloud/cloud.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/cloud/cloudaccount.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/cloud/cloudnetwork.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/cloud/cloudnetworkprefixassignment.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/cloud/cloudresourcetype.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/cloud/cloudservice.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/cloud/cloudservicenetworkassignment.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/dcim/cable.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/dcim/consoleport.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/dcim/consoleporttemplate.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/dcim/consoleserverport.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/dcim/consoleserverporttemplate.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/dcim/controller.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/dcim/controllermanageddevicegroup.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/dcim/device.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/dcim/devicebay.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/dcim/devicebaytemplate.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/dcim/devicefamily.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/dcim/deviceredundancygroup.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/dcim/devicetype.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/dcim/frontport.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/dcim/frontporttemplate.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/dcim/interface.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/dcim/interfaceredundancygroup.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/dcim/interfacetemplate.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/dcim/inventoryitem.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/dcim/location.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/dcim/locationtype.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/dcim/manufacturer.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/dcim/module.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/dcim/modulebay.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/dcim/modulebaytemplate.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/dcim/moduletype.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/dcim/platform.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/dcim/powerfeed.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/dcim/poweroutlet.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/dcim/poweroutlettemplate.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/dcim/powerpanel.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/dcim/powerport.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/dcim/powerporttemplate.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/dcim/rack.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/dcim/rackgroup.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/dcim/rackreservation.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/dcim/rearport.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/dcim/rearporttemplate.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/dcim/softwareimagefile.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/dcim/softwareversion.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/dcim/virtualchassis.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/dcim/virtualdevicecontext.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/extras/configcontext.html +12 -50
- nautobot/project-static/docs/user-guide/core-data-model/extras/configcontextschema.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/extras/contact.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/extras/team.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/ipam/ipaddress.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/ipam/namespace.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/ipam/prefix.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/ipam/rir.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/ipam/routetarget.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/ipam/service.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/ipam/vlan.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/ipam/vlangroup.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/ipam/vrf.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/overview/introduction.html +7 -49
- nautobot/project-static/docs/user-guide/core-data-model/tenancy/tenant.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/tenancy/tenantgroup.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/virtualization/cluster.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/virtualization/clustergroup.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/virtualization/clustertype.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/virtualization/virtualmachine.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/virtualization/vminterface.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/wireless/index.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/wireless/radioprofile.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/wireless/supporteddatarate.html +4 -46
- nautobot/project-static/docs/user-guide/core-data-model/wireless/wirelessnetwork.html +4 -46
- nautobot/project-static/docs/user-guide/feature-guides/contacts-and-teams.html +4 -46
- nautobot/project-static/docs/user-guide/feature-guides/custom-fields.html +4 -46
- nautobot/project-static/docs/user-guide/feature-guides/getting-started/creating-devices.html +4 -46
- nautobot/project-static/docs/user-guide/feature-guides/getting-started/creating-location-types-and-locations.html +4 -46
- nautobot/project-static/docs/user-guide/feature-guides/getting-started/index.html +4 -46
- nautobot/project-static/docs/user-guide/feature-guides/getting-started/interfaces.html +4 -46
- nautobot/project-static/docs/user-guide/feature-guides/getting-started/ipam.html +4 -46
- nautobot/project-static/docs/user-guide/feature-guides/getting-started/platforms.html +4 -46
- nautobot/project-static/docs/user-guide/feature-guides/getting-started/search-bar.html +4 -46
- nautobot/project-static/docs/user-guide/feature-guides/getting-started/tenants.html +4 -46
- nautobot/project-static/docs/user-guide/feature-guides/getting-started/vlans-and-vlan-groups.html +4 -46
- nautobot/project-static/docs/user-guide/feature-guides/git-data-source.html +7 -51
- nautobot/project-static/docs/user-guide/feature-guides/graphql.html +4 -46
- nautobot/project-static/docs/user-guide/feature-guides/ip-address-merge-tool.html +4 -46
- nautobot/project-static/docs/user-guide/feature-guides/relationships.html +4 -46
- nautobot/project-static/docs/user-guide/feature-guides/software-image-files-and-versions.html +7 -49
- nautobot/project-static/docs/user-guide/index.html +4 -46
- nautobot/project-static/docs/user-guide/platform-functionality/change-logging.html +4 -46
- nautobot/project-static/docs/user-guide/platform-functionality/computedfield.html +8 -50
- nautobot/project-static/docs/user-guide/platform-functionality/customfield.html +4 -46
- nautobot/project-static/docs/user-guide/platform-functionality/customlink.html +4 -46
- nautobot/project-static/docs/user-guide/platform-functionality/dynamicgroup.html +4 -46
- nautobot/project-static/docs/user-guide/platform-functionality/events.html +4 -46
- nautobot/project-static/docs/user-guide/platform-functionality/exporttemplate.html +4 -46
- nautobot/project-static/docs/user-guide/platform-functionality/externalintegration.html +4 -46
- nautobot/project-static/docs/user-guide/platform-functionality/gitrepository.html +4 -46
- nautobot/project-static/docs/user-guide/platform-functionality/graphql.html +4 -46
- nautobot/project-static/docs/user-guide/platform-functionality/graphqlquery.html +4 -46
- nautobot/project-static/docs/user-guide/platform-functionality/imageattachment.html +4 -46
- nautobot/project-static/docs/user-guide/platform-functionality/jobs/index.html +7 -50
- nautobot/project-static/docs/user-guide/platform-functionality/jobs/job-scheduling-and-approvals.html +4 -46
- nautobot/project-static/docs/user-guide/platform-functionality/jobs/jobbutton.html +7 -49
- nautobot/project-static/docs/user-guide/platform-functionality/jobs/jobhook.html +4 -46
- nautobot/project-static/docs/user-guide/platform-functionality/jobs/jobqueue.html +4 -46
- nautobot/project-static/docs/user-guide/platform-functionality/jobs/models.html +4 -46
- nautobot/project-static/docs/user-guide/platform-functionality/napalm.html +4 -46
- nautobot/project-static/docs/user-guide/platform-functionality/note.html +4 -46
- nautobot/project-static/docs/user-guide/platform-functionality/objectmetadata.html +4 -46
- nautobot/project-static/docs/user-guide/platform-functionality/relationship.html +5 -47
- nautobot/project-static/docs/user-guide/platform-functionality/rendering-jinja-templates.html +4 -46
- nautobot/project-static/docs/user-guide/platform-functionality/rest-api/authentication.html +4 -46
- nautobot/project-static/docs/user-guide/platform-functionality/rest-api/filtering.html +25 -94
- nautobot/project-static/docs/user-guide/platform-functionality/rest-api/overview.html +5 -74
- nautobot/project-static/docs/user-guide/platform-functionality/rest-api/ui-related-endpoints.html +4 -46
- nautobot/project-static/docs/user-guide/platform-functionality/role.html +4 -46
- nautobot/project-static/docs/user-guide/platform-functionality/savedview.html +4 -46
- nautobot/project-static/docs/user-guide/platform-functionality/secret.html +4 -46
- nautobot/project-static/docs/user-guide/platform-functionality/staticgroupassociation.html +4 -46
- nautobot/project-static/docs/user-guide/platform-functionality/status.html +4 -46
- nautobot/project-static/docs/user-guide/platform-functionality/tag.html +4 -46
- nautobot/project-static/docs/user-guide/platform-functionality/template-filters.html +4 -46
- nautobot/project-static/docs/user-guide/platform-functionality/users/objectpermission.html +4 -46
- nautobot/project-static/docs/user-guide/platform-functionality/users/token.html +4 -46
- nautobot/project-static/docs/user-guide/platform-functionality/webhook.html +4 -46
- nautobot/project-static/js/forms.js +1 -1
- nautobot/tenancy/api/views.py +13 -9
- nautobot/tenancy/views.py +2 -4
- nautobot/users/admin.py +1 -1
- nautobot/users/api/serializers.py +4 -5
- nautobot/users/api/views.py +3 -3
- nautobot/virtualization/api/serializers.py +4 -4
- nautobot/virtualization/api/views.py +24 -5
- nautobot/virtualization/filters.py +3 -20
- nautobot/virtualization/models.py +1 -1
- nautobot/virtualization/tables.py +2 -2
- nautobot/virtualization/templates/virtualization/cluster_edit.html +7 -1
- nautobot/virtualization/templates/virtualization/virtualmachine.html +9 -1
- nautobot/virtualization/templates/virtualization/virtualmachine_edit.html +8 -2
- nautobot/virtualization/tests/test_filters.py +0 -17
- nautobot/wireless/filters.py +2 -2
- nautobot/wireless/forms.py +1 -1
- nautobot/wireless/templates/wireless/wirelessnetwork_retrieve.html +9 -1
- nautobot/wireless/tests/test_filters.py +1 -29
- nautobot/wireless/views.py +10 -0
- {nautobot-2.4.0.dist-info → nautobot-2.4.0b1.dist-info}/METADATA +6 -6
- {nautobot-2.4.0.dist-info → nautobot-2.4.0b1.dist-info}/RECORD +543 -591
- {nautobot-2.4.0.dist-info → nautobot-2.4.0b1.dist-info}/WHEEL +1 -1
- nautobot/core/api/constants.py +0 -11
- nautobot/core/jobs/bulk_actions.py +0 -248
- nautobot/core/templates/about.html +0 -67
- nautobot/core/templates/inc/tenancy_form_panel.html +0 -9
- nautobot/core/templates/inc/tenant_table_row.html +0 -11
- nautobot/core/utils/querysets.py +0 -64
- nautobot/dcim/migrations/0067_controllermanageddevicegroup_tenant.py +0 -25
- nautobot/dcim/tests/integration/test_controller.py +0 -62
- nautobot/dcim/tests/integration/test_controller_managed_device_group.py +0 -71
- nautobot/dcim/tests/test_jobs.py +0 -118
- nautobot/extras/migrations/0120_job_is_singleton_job_is_singleton_override.py +0 -22
- nautobot/extras/migrations/0121_alter_team_contacts.py +0 -17
- nautobot/extras/test_jobs/singleton.py +0 -16
- nautobot/project-static/docs/media/development/core/kubernetes/k8s_job_edit.png +0 -0
- nautobot/project-static/docs/media/development/core/kubernetes/k8s_job_edit_button.png +0 -0
- nautobot/project-static/docs/media/development/core/kubernetes/k8s_job_list_nav.png +0 -0
- nautobot/project-static/docs/media/development/core/kubernetes/k8s_job_list_view.png +0 -0
- nautobot/project-static/docs/media/development/core/kubernetes/k8s_job_queue.png +0 -0
- nautobot/project-static/docs/media/development/core/kubernetes/k8s_job_queue_add.png +0 -0
- nautobot/project-static/docs/media/development/core/kubernetes/k8s_job_queue_config.png +0 -0
- nautobot/project-static/docs/media/development/core/kubernetes/k8s_job_result_completed.png +0 -0
- nautobot/project-static/docs/media/development/core/kubernetes/k8s_job_result_nav.png +0 -0
- nautobot/project-static/docs/media/development/core/kubernetes/k8s_job_result_pending.png +0 -0
- nautobot/project-static/docs/media/development/core/kubernetes/k8s_job_run_form.png +0 -0
- nautobot/project-static/docs/media/development/core/kubernetes/k8s_nautobot_login.png +0 -0
- nautobot/project-static/docs/media/development/core/kubernetes/k8s_run_job.png +0 -0
- nautobot/project-static/docs/media/development/core/kubernetes/k8s_run_scheduled_job_form.png +0 -0
- nautobot/project-static/docs/media/development/core/kubernetes/k8s_scheduled_job_result.png +0 -0
- nautobot/project-static/docs/media/development/core/ui-component-framework/buttons-example.png +0 -0
- nautobot/project-static/docs/media/development/core/ui-component-framework/cluster-type-before-after-example.png +0 -0
- nautobot/project-static/docs/media/development/core/ui-component-framework/object-fields-panel-example_2.png +0 -0
- nautobot/project-static/docs/media/development/core/ui-component-framework/stats-panel-example-code.png +0 -0
- nautobot/project-static/docs/user-guide/feature-guides/images/wireless/central-mode.png +0 -0
- nautobot/project-static/docs/user-guide/feature-guides/images/wireless/device-group-add.png +0 -0
- nautobot/project-static/docs/user-guide/feature-guides/images/wireless/device-group-create-1.png +0 -0
- nautobot/project-static/docs/user-guide/feature-guides/images/wireless/device-group-create-2.png +0 -0
- nautobot/project-static/docs/user-guide/feature-guides/images/wireless/radio-profile-add.png +0 -0
- nautobot/project-static/docs/user-guide/feature-guides/images/wireless/radio-profile-create.png +0 -0
- nautobot/project-static/docs/user-guide/feature-guides/images/wireless/supported-data-rate-add.png +0 -0
- nautobot/project-static/docs/user-guide/feature-guides/images/wireless/supported-data-rate-create.png +0 -0
- nautobot/project-static/docs/user-guide/feature-guides/images/wireless/wireless-controller-add.png +0 -0
- nautobot/project-static/docs/user-guide/feature-guides/images/wireless/wireless-controller-create-1.png +0 -0
- nautobot/project-static/docs/user-guide/feature-guides/images/wireless/wireless-controller-create-2.png +0 -0
- nautobot/project-static/docs/user-guide/feature-guides/images/wireless/wireless-network-add.png +0 -0
- nautobot/project-static/docs/user-guide/feature-guides/images/wireless/wireless-network-create.png +0 -0
- nautobot/project-static/docs/user-guide/feature-guides/wireless-networks-and-controllers.html +0 -9444
- nautobot/project-static/docs/user-guide/platform-functionality/jobs/kubernetes-job-support.html +0 -9722
- nautobot/wireless/tests/integration/__init__.py +0 -0
- nautobot/wireless/tests/integration/test_radio_profile.py +0 -42
- {nautobot-2.4.0.dist-info → nautobot-2.4.0b1.dist-info}/LICENSE.txt +0 -0
- {nautobot-2.4.0.dist-info → nautobot-2.4.0b1.dist-info}/NOTICE +0 -0
- {nautobot-2.4.0.dist-info → nautobot-2.4.0b1.dist-info}/entry_points.txt +0 -0
nautobot/core/tests/test_api.py
CHANGED
|
@@ -3,7 +3,6 @@ from io import BytesIO, StringIO
|
|
|
3
3
|
import json
|
|
4
4
|
import os
|
|
5
5
|
from unittest import skip
|
|
6
|
-
import uuid
|
|
7
6
|
|
|
8
7
|
from constance import config
|
|
9
8
|
from constance.test import override_config
|
|
@@ -15,7 +14,6 @@ from django.urls import reverse
|
|
|
15
14
|
from rest_framework import status
|
|
16
15
|
from rest_framework.exceptions import ParseError
|
|
17
16
|
from rest_framework.settings import api_settings
|
|
18
|
-
from rest_framework.test import APIRequestFactory, force_authenticate
|
|
19
17
|
import yaml
|
|
20
18
|
|
|
21
19
|
from nautobot.circuits.models import Provider
|
|
@@ -24,14 +22,13 @@ from nautobot.core.api.parsers import NautobotCSVParser
|
|
|
24
22
|
from nautobot.core.api.renderers import NautobotCSVRenderer
|
|
25
23
|
from nautobot.core.api.utils import get_serializer_for_model, get_view_name
|
|
26
24
|
from nautobot.core.api.versioning import NautobotAPIVersioning
|
|
27
|
-
from nautobot.core.api.views import ModelViewSet
|
|
28
25
|
from nautobot.core.constants import COMPOSITE_KEY_SEPARATOR
|
|
29
26
|
from nautobot.core.templatetags.helpers import humanize_speed
|
|
30
27
|
from nautobot.core.utils.lookup import get_route_for_model
|
|
31
28
|
from nautobot.dcim import models as dcim_models
|
|
32
29
|
from nautobot.dcim.api import serializers as dcim_serializers
|
|
33
30
|
from nautobot.extras import choices, models as extras_models
|
|
34
|
-
from nautobot.ipam import
|
|
31
|
+
from nautobot.ipam import models as ipam_models
|
|
35
32
|
from nautobot.ipam.api import serializers as ipam_serializers, views as ipam_api_views
|
|
36
33
|
from nautobot.tenancy import models as tenancy_models
|
|
37
34
|
|
|
@@ -384,7 +381,6 @@ class GenerateLookupValueDomElementViewTestCase(testing.APITestCase):
|
|
|
384
381
|
(
|
|
385
382
|
'<select name="role" class="form-control nautobot-select2-api" data-multiple="1" '
|
|
386
383
|
'data-query-param-content_types="["dcim.device", "virtualization.virtualmachine"]" '
|
|
387
|
-
'data-query-param-exclude_m2m="["true"]" '
|
|
388
384
|
'display-field="display" value-field="name" data-depth="0" data-url="/api/extras/roles/" id="id_for_role" '
|
|
389
385
|
"multiple>\n</select>"
|
|
390
386
|
),
|
|
@@ -520,80 +516,6 @@ class NautobotCSVRendererTest(TestCase):
|
|
|
520
516
|
self.assertEqual(read_data["parent__name"], location_type.parent.name)
|
|
521
517
|
|
|
522
518
|
|
|
523
|
-
class ModelViewSetMixinTest(testing.APITestCase):
|
|
524
|
-
"""Unit tests for ModelViewSetMixin, base class for ModelViewSet/ReadOnlyModelViewSet classes."""
|
|
525
|
-
|
|
526
|
-
class SimpleIPAddressViewSet(ModelViewSet):
|
|
527
|
-
queryset = ipam_models.IPAddress.objects.all() # no explicit optimizations
|
|
528
|
-
serializer_class = ipam_serializers.IPAddressSerializer
|
|
529
|
-
filterset_class = ipam_filters.IPAddressFilterSet
|
|
530
|
-
|
|
531
|
-
def test_get_queryset_optimizations(self):
|
|
532
|
-
"""Test that the queryset is appropriately optimized based on request parameters."""
|
|
533
|
-
self.user.is_superuser = True
|
|
534
|
-
self.user.save()
|
|
535
|
-
|
|
536
|
-
# Default behavior - m2m fields included
|
|
537
|
-
view = self.SimpleIPAddressViewSet()
|
|
538
|
-
view.action_map = {"get": "list"}
|
|
539
|
-
request = APIRequestFactory().get(reverse("ipam-api:ipaddress-list"), headers=self.header)
|
|
540
|
-
force_authenticate(request, user=self.user)
|
|
541
|
-
request = view.initialize_request(request)
|
|
542
|
-
view.setup(request)
|
|
543
|
-
view.initial(request)
|
|
544
|
-
|
|
545
|
-
queryset = view.get_queryset()
|
|
546
|
-
with self.assertNumQueries(5): # IPAddress plus four prefetches
|
|
547
|
-
instance = queryset.first()
|
|
548
|
-
# FK related objects should have been auto-selected
|
|
549
|
-
with self.assertNumQueries(0):
|
|
550
|
-
instance.status
|
|
551
|
-
instance.role
|
|
552
|
-
instance.parent
|
|
553
|
-
instance.tenant
|
|
554
|
-
instance.nat_inside
|
|
555
|
-
# Reverse relations should have been auto-prefetched
|
|
556
|
-
with self.assertNumQueries(0):
|
|
557
|
-
list(instance.nat_outside_list.all())
|
|
558
|
-
# Many-to-many relations should have been auto-prefetched
|
|
559
|
-
with self.assertNumQueries(0):
|
|
560
|
-
list(instance.interfaces.all())
|
|
561
|
-
list(instance.vm_interfaces.all())
|
|
562
|
-
list(instance.tags.all())
|
|
563
|
-
|
|
564
|
-
# With exclude_m2m query parameter
|
|
565
|
-
view = self.SimpleIPAddressViewSet()
|
|
566
|
-
view.action_map = {"get": "list"}
|
|
567
|
-
request = APIRequestFactory().get(
|
|
568
|
-
reverse("ipam-api:ipaddress-list"), headers=self.header, data={"exclude_m2m": True}
|
|
569
|
-
)
|
|
570
|
-
force_authenticate(request, user=self.user)
|
|
571
|
-
request = view.initialize_request(request)
|
|
572
|
-
view.setup(request)
|
|
573
|
-
view.initial(request)
|
|
574
|
-
|
|
575
|
-
queryset = view.get_queryset()
|
|
576
|
-
with self.assertNumQueries(1): # IPAddress only, no prefetches
|
|
577
|
-
instance = queryset.first()
|
|
578
|
-
# FK related objects should still have been auto-selected
|
|
579
|
-
with self.assertNumQueries(0):
|
|
580
|
-
instance.status
|
|
581
|
-
instance.role
|
|
582
|
-
instance.parent
|
|
583
|
-
instance.tenant
|
|
584
|
-
instance.nat_inside
|
|
585
|
-
# Reverse relations should NOT have been auto-prefetched
|
|
586
|
-
with self.assertNumQueries(1):
|
|
587
|
-
list(instance.nat_outside_list.all())
|
|
588
|
-
# Many-to-many relations should NOT have been auto-prefetched
|
|
589
|
-
with self.assertNumQueries(1):
|
|
590
|
-
list(instance.interfaces.all())
|
|
591
|
-
with self.assertNumQueries(1):
|
|
592
|
-
list(instance.vm_interfaces.all())
|
|
593
|
-
with self.assertNumQueries(1):
|
|
594
|
-
list(instance.tags.all())
|
|
595
|
-
|
|
596
|
-
|
|
597
519
|
class WritableNestedSerializerTest(testing.APITestCase):
|
|
598
520
|
"""
|
|
599
521
|
Test the operation of WritableNestedSerializer using VLANSerializer as our test subject.
|
|
@@ -766,25 +688,6 @@ class WritableNestedSerializerTest(testing.APITestCase):
|
|
|
766
688
|
self.assertHttpStatus(response, status.HTTP_400_BAD_REQUEST)
|
|
767
689
|
self.assertEqual(ipam_models.VLAN.objects.filter(name="Test VLAN 100").count(), 0)
|
|
768
690
|
|
|
769
|
-
def test_create_with_specified_id(self):
|
|
770
|
-
data = {
|
|
771
|
-
"id": str(uuid.uuid4()),
|
|
772
|
-
"vid": 400,
|
|
773
|
-
"name": "Test VLAN 400",
|
|
774
|
-
"status": self.statuses.first().pk,
|
|
775
|
-
"vlan_group": self.vlan_group1.pk,
|
|
776
|
-
}
|
|
777
|
-
url = reverse("ipam-api:vlan-list")
|
|
778
|
-
self.add_permissions("ipam.add_vlan")
|
|
779
|
-
|
|
780
|
-
response = self.client.post(url, data, format="json", **self.header)
|
|
781
|
-
self.assertHttpStatus(response, status.HTTP_201_CREATED)
|
|
782
|
-
self.assertEqual(str(response.data["vlan_group"]["url"]), self.absolute_api_url(self.vlan_group1))
|
|
783
|
-
self.assertEqual(str(response.data["id"]), data["id"])
|
|
784
|
-
vlan = ipam_models.VLAN.objects.get(pk=response.data["id"])
|
|
785
|
-
self.assertEqual(vlan.status, self.statuses.first())
|
|
786
|
-
self.assertEqual(vlan.vlan_group, self.vlan_group1)
|
|
787
|
-
|
|
788
691
|
|
|
789
692
|
class APIOrderingTestCase(testing.APITestCase):
|
|
790
693
|
"""
|
nautobot/core/tests/test_csv.py
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import csv
|
|
2
|
-
import io
|
|
3
|
-
|
|
4
1
|
from django.contrib.contenttypes.models import ContentType
|
|
5
2
|
from django.test import override_settings, RequestFactory, TestCase
|
|
6
3
|
from django.urls import reverse
|
|
@@ -264,28 +261,9 @@ class CSVParsingRelatedTestCase(TestCase):
|
|
|
264
261
|
self.assertEqual(response.status_code, 200)
|
|
265
262
|
response_data = response.content.decode(response.charset)
|
|
266
263
|
|
|
267
|
-
#
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
fieldnames = [field for field in csv_reader.fieldnames if field != "id"]
|
|
271
|
-
# read all entries into a list
|
|
272
|
-
response_csv = list(csv_reader)
|
|
273
|
-
|
|
274
|
-
# mutate our data for testing purposes
|
|
275
|
-
for row in response_csv:
|
|
276
|
-
if row["name"] == "TestDevice1":
|
|
277
|
-
row["name"] = "TestDevice3"
|
|
278
|
-
elif row["name"] == "TestDevice2":
|
|
279
|
-
row["name"] = ""
|
|
280
|
-
|
|
281
|
-
# prep our data to write out
|
|
282
|
-
with io.StringIO() as import_csv:
|
|
283
|
-
writer = csv.DictWriter(import_csv, fieldnames=fieldnames)
|
|
284
|
-
writer.writeheader()
|
|
285
|
-
for row in response_csv:
|
|
286
|
-
filtered_row = {key: row[key] for key in fieldnames}
|
|
287
|
-
writer.writerow(filtered_row)
|
|
288
|
-
data = {"csv_data": import_csv.getvalue()}
|
|
264
|
+
# Replace Device Name
|
|
265
|
+
import_data = response_data.replace("TestDevice1", "TestDevice3").replace("TestDevice2", "")
|
|
266
|
+
data = {"csv_data": import_data}
|
|
289
267
|
url = reverse("dcim:device_import")
|
|
290
268
|
response = self.client.post(url, data)
|
|
291
269
|
self.assertEqual(response.status_code, 200)
|
|
@@ -806,7 +806,6 @@ class DynamicFilterFormTest(TestCase):
|
|
|
806
806
|
"data-depth": 0,
|
|
807
807
|
"data-multiple": 1,
|
|
808
808
|
"data-query-param-content_types": '["dcim.location"]',
|
|
809
|
-
"data-query-param-exclude_m2m": '["true"]',
|
|
810
809
|
"display-field": "display",
|
|
811
810
|
"value-field": "name",
|
|
812
811
|
},
|
nautobot/core/tests/test_jobs.py
CHANGED
|
@@ -24,10 +24,9 @@ from nautobot.extras.models import (
|
|
|
24
24
|
ObjectChange,
|
|
25
25
|
Role,
|
|
26
26
|
Status,
|
|
27
|
-
Tag,
|
|
28
27
|
)
|
|
29
28
|
from nautobot.extras.models.metadata import ObjectMetadata
|
|
30
|
-
from nautobot.ipam.models import
|
|
29
|
+
from nautobot.ipam.models import Prefix
|
|
31
30
|
from nautobot.users.models import ObjectPermission
|
|
32
31
|
|
|
33
32
|
|
|
@@ -607,304 +606,3 @@ class LogsCleanupTestCase(TransactionTestCase):
|
|
|
607
606
|
self.assertTrue(JobResult.objects.filter(date_done__gte=cutoff).exists())
|
|
608
607
|
self.assertFalse(ObjectChange.objects.filter(time__lt=cutoff).exists())
|
|
609
608
|
self.assertTrue(ObjectChange.objects.filter(time__gte=cutoff).exists())
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
class BulkEditTestCase(TransactionTestCase):
|
|
613
|
-
"""
|
|
614
|
-
Test the BulkEdit system job.
|
|
615
|
-
"""
|
|
616
|
-
|
|
617
|
-
def setUp(self):
|
|
618
|
-
super().setUp()
|
|
619
|
-
self.status_ct = ContentType.objects.get_for_model(Status)
|
|
620
|
-
self.namespace_ct = ContentType.objects.get_for_model(Namespace)
|
|
621
|
-
self.role_ct = ContentType.objects.get_for_model(Role)
|
|
622
|
-
self.tags = [Tag.objects.create(name=f"Example Tag {x}") for x in range(5)]
|
|
623
|
-
for tag in self.tags:
|
|
624
|
-
tag.content_types.add(self.namespace_ct)
|
|
625
|
-
|
|
626
|
-
def _common_no_error_test_assertion(self, model, job_result, expected_count, **filter_params):
|
|
627
|
-
self.assertEqual(job_result.status, JobResultStatusChoices.STATUS_SUCCESS)
|
|
628
|
-
self.assertEqual(model.objects.filter(**filter_params).count(), expected_count)
|
|
629
|
-
self.assertFalse(
|
|
630
|
-
JobLogEntry.objects.filter(job_result=job_result, log_level=LogLevelChoices.LOG_WARNING).exists()
|
|
631
|
-
)
|
|
632
|
-
self.assertFalse(
|
|
633
|
-
JobLogEntry.objects.filter(job_result=job_result, log_level=LogLevelChoices.LOG_ERROR).exists()
|
|
634
|
-
)
|
|
635
|
-
|
|
636
|
-
def test_bulk_edit_without_permission(self):
|
|
637
|
-
statuses = [Status.objects.create(name=f"Sample Status {x}") for x in range(3)]
|
|
638
|
-
pk_list = [str(status.id) for status in statuses]
|
|
639
|
-
job_result = create_job_result_and_run_job(
|
|
640
|
-
"nautobot.core.jobs.bulk_actions",
|
|
641
|
-
"BulkEditObjects",
|
|
642
|
-
content_type=self.status_ct.id,
|
|
643
|
-
edit_all=False,
|
|
644
|
-
filter_query_params={},
|
|
645
|
-
form_data={"pk": pk_list, "color": "aa1409"},
|
|
646
|
-
username=self.user.username,
|
|
647
|
-
)
|
|
648
|
-
self.assertEqual(job_result.status, JobResultStatusChoices.STATUS_FAILURE)
|
|
649
|
-
job_log = JobLogEntry.objects.get(job_result=job_result, log_level=LogLevelChoices.LOG_ERROR)
|
|
650
|
-
self.assertEqual(job_log.message, f'User "{self.user}" does not have permission to update status objects')
|
|
651
|
-
|
|
652
|
-
# Assert status did not get updated
|
|
653
|
-
for status in statuses:
|
|
654
|
-
status.refresh_from_db()
|
|
655
|
-
self.assertNotEqual(status.color, "aa1409")
|
|
656
|
-
|
|
657
|
-
def test_bulk_edit_all(self):
|
|
658
|
-
self.add_permissions("extras.change_role", "extras.view_role")
|
|
659
|
-
job_result = create_job_result_and_run_job(
|
|
660
|
-
"nautobot.core.jobs.bulk_actions",
|
|
661
|
-
"BulkEditObjects",
|
|
662
|
-
content_type=self.role_ct.id,
|
|
663
|
-
edit_all=True,
|
|
664
|
-
filter_query_params={},
|
|
665
|
-
form_data={"color": "aa1409"},
|
|
666
|
-
username=self.user.username,
|
|
667
|
-
)
|
|
668
|
-
self._common_no_error_test_assertion(Role, job_result, Role.objects.all().count(), color="aa1409")
|
|
669
|
-
|
|
670
|
-
def test_bulk_edit_filter_all(self):
|
|
671
|
-
self.add_permissions("extras.change_status", "extras.view_status")
|
|
672
|
-
# By default Active and Available are some of the example of Status that starts with A
|
|
673
|
-
statuses = Status.objects.filter(name__istartswith="A")
|
|
674
|
-
status_to_ignore = Status.objects.create(name="Ignore Example Status")
|
|
675
|
-
self.assertNotEqual(statuses.count(), 0)
|
|
676
|
-
job_result = create_job_result_and_run_job(
|
|
677
|
-
"nautobot.core.jobs.bulk_actions",
|
|
678
|
-
"BulkEditObjects",
|
|
679
|
-
content_type=self.status_ct.id,
|
|
680
|
-
edit_all=True,
|
|
681
|
-
filter_query_params={"name__isw": "A"},
|
|
682
|
-
# pk ignored if edit_all is True
|
|
683
|
-
form_data={
|
|
684
|
-
"pk": [str(statuses[0].pk)],
|
|
685
|
-
"color": "aa1409",
|
|
686
|
-
"_all": "True",
|
|
687
|
-
},
|
|
688
|
-
username=self.user.username,
|
|
689
|
-
)
|
|
690
|
-
self._common_no_error_test_assertion(
|
|
691
|
-
Status, job_result, statuses.count(), name__istartswith="A", color="aa1409"
|
|
692
|
-
)
|
|
693
|
-
self.assertNotEqual(status_to_ignore.color, "aa1409")
|
|
694
|
-
|
|
695
|
-
def test_bulk_edit_with_pk(self):
|
|
696
|
-
self.add_permissions("ipam.change_namespace", "ipam.view_namespace", "extras.change_tag", "extras.view_tag")
|
|
697
|
-
namespaces = [Namespace.objects.create(name=f"Sample Namespace {x}") for x in range(5)]
|
|
698
|
-
for namespace in namespaces:
|
|
699
|
-
namespace.tags.set(self.tags[3:])
|
|
700
|
-
pk_list = [str(status.id) for status in namespaces[:3]]
|
|
701
|
-
|
|
702
|
-
job_result = create_job_result_and_run_job(
|
|
703
|
-
"nautobot.core.jobs.bulk_actions",
|
|
704
|
-
"BulkEditObjects",
|
|
705
|
-
content_type=self.namespace_ct.id,
|
|
706
|
-
edit_all=False,
|
|
707
|
-
filter_query_params={},
|
|
708
|
-
form_data={
|
|
709
|
-
"pk": pk_list,
|
|
710
|
-
"description": "Example description for bulk edit",
|
|
711
|
-
"add_tags": [str(tag.id) for tag in self.tags[:3]],
|
|
712
|
-
"remove_tags": [str(tag.id) for tag in self.tags[3:]],
|
|
713
|
-
},
|
|
714
|
-
username=self.user.username,
|
|
715
|
-
)
|
|
716
|
-
|
|
717
|
-
self._common_no_error_test_assertion(
|
|
718
|
-
Namespace,
|
|
719
|
-
job_result,
|
|
720
|
-
3,
|
|
721
|
-
description="Example description for bulk edit",
|
|
722
|
-
)
|
|
723
|
-
|
|
724
|
-
# Assert Namespaces withing pk_list updated tags
|
|
725
|
-
for namespace in namespaces[:3]:
|
|
726
|
-
self.assertTrue(namespace.tags.filter(pk__in=[tag.pk for tag in self.tags[:3]]).exists())
|
|
727
|
-
self.assertFalse(namespace.tags.filter(pk__in=[tag.pk for tag in self.tags[3:]]).exists())
|
|
728
|
-
|
|
729
|
-
# Assert Namespaces not withing pk_list tags did not get updated
|
|
730
|
-
for namespace in namespaces[3:]:
|
|
731
|
-
self.assertFalse(namespace.tags.filter(pk__in=[tag.pk for tag in self.tags[:3]]).exists())
|
|
732
|
-
self.assertTrue(namespace.tags.filter(pk__in=[tag.pk for tag in self.tags[3:]]).exists())
|
|
733
|
-
|
|
734
|
-
def test_bulk_edit_objects_with_constrained_permission(self):
|
|
735
|
-
roles_to_update = [
|
|
736
|
-
Role.objects.create(name="Example Role 1"),
|
|
737
|
-
Role.objects.create(name="Example Role 2"),
|
|
738
|
-
]
|
|
739
|
-
pk_list = [str(role.pk) for role in roles_to_update]
|
|
740
|
-
|
|
741
|
-
obj_perm = ObjectPermission.objects.create(
|
|
742
|
-
name="Test permission",
|
|
743
|
-
constraints={"pk": pk_list[0]},
|
|
744
|
-
actions=["change", "view"],
|
|
745
|
-
)
|
|
746
|
-
obj_perm.users.add(self.user)
|
|
747
|
-
obj_perm.object_types.add(self.role_ct)
|
|
748
|
-
|
|
749
|
-
job_result = create_job_result_and_run_job(
|
|
750
|
-
"nautobot.core.jobs.bulk_actions",
|
|
751
|
-
"BulkEditObjects",
|
|
752
|
-
content_type=self.role_ct.id,
|
|
753
|
-
edit_all=False,
|
|
754
|
-
filter_query_params={},
|
|
755
|
-
form_data={"pk": pk_list, "color": "aa1409"},
|
|
756
|
-
username=self.user.username,
|
|
757
|
-
)
|
|
758
|
-
error_log = JobLogEntry.objects.get(job_result=job_result, log_level=LogLevelChoices.LOG_ERROR)
|
|
759
|
-
self.assertIn("Form validation unsuccessful", error_log.message)
|
|
760
|
-
self.assertIn(f"{roles_to_update[1].pk} is not one of the available choices.", error_log.message)
|
|
761
|
-
roles_to_update[0].refresh_from_db()
|
|
762
|
-
roles_to_update[1].refresh_from_db()
|
|
763
|
-
self.assertNotEqual(roles_to_update[0].color, "aa1409")
|
|
764
|
-
self.assertNotEqual(roles_to_update[1].color, "aa1409")
|
|
765
|
-
|
|
766
|
-
obj_perm.constraints = {"pk__in": pk_list}
|
|
767
|
-
obj_perm.save()
|
|
768
|
-
|
|
769
|
-
job_result = create_job_result_and_run_job(
|
|
770
|
-
"nautobot.core.jobs.bulk_actions",
|
|
771
|
-
"BulkEditObjects",
|
|
772
|
-
content_type=self.role_ct.id,
|
|
773
|
-
edit_all=False,
|
|
774
|
-
filter_query_params={},
|
|
775
|
-
form_data={"pk": pk_list, "color": "aa1409"},
|
|
776
|
-
username=self.user.username,
|
|
777
|
-
)
|
|
778
|
-
self._common_no_error_test_assertion(Role, job_result, 2, pk__in=pk_list, color="aa1409")
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
class BulkDeleteTestCase(TransactionTestCase):
|
|
782
|
-
"""
|
|
783
|
-
Test the BulkDelete system job.
|
|
784
|
-
"""
|
|
785
|
-
|
|
786
|
-
def setUp(self):
|
|
787
|
-
super().setUp()
|
|
788
|
-
self.status_ct = ContentType.objects.get_for_model(Status)
|
|
789
|
-
self.role_ct = ContentType.objects.get_for_model(Role)
|
|
790
|
-
self.device_ct = ContentType.objects.get_for_model(Device)
|
|
791
|
-
|
|
792
|
-
def _common_no_error_test_assertion(self, model, job_result, **filter_params):
|
|
793
|
-
self.assertEqual(job_result.status, JobResultStatusChoices.STATUS_SUCCESS)
|
|
794
|
-
self.assertEqual(model.objects.filter(**filter_params).count(), 0)
|
|
795
|
-
self.assertFalse(
|
|
796
|
-
JobLogEntry.objects.filter(job_result=job_result, log_level=LogLevelChoices.LOG_WARNING).exists()
|
|
797
|
-
)
|
|
798
|
-
self.assertFalse(
|
|
799
|
-
JobLogEntry.objects.filter(job_result=job_result, log_level=LogLevelChoices.LOG_ERROR).exists()
|
|
800
|
-
)
|
|
801
|
-
|
|
802
|
-
def test_bulk_delete_without_permission(self):
|
|
803
|
-
statuses_to_delete = [str(status) for status in Status.objects.all().values_list("pk", flat=True)[:2]]
|
|
804
|
-
job_result = create_job_result_and_run_job(
|
|
805
|
-
"nautobot.core.jobs.bulk_actions",
|
|
806
|
-
"BulkDeleteObjects",
|
|
807
|
-
content_type=self.status_ct.id,
|
|
808
|
-
pk_list=statuses_to_delete,
|
|
809
|
-
username=self.user.username,
|
|
810
|
-
)
|
|
811
|
-
self.assertEqual(job_result.status, JobResultStatusChoices.STATUS_FAILURE)
|
|
812
|
-
job_log = JobLogEntry.objects.get(job_result=job_result, log_level=LogLevelChoices.LOG_ERROR)
|
|
813
|
-
self.assertEqual(job_log.message, f'User "{self.user}" does not have permission to delete status objects')
|
|
814
|
-
self.assertEqual(Status.objects.filter(pk__in=statuses_to_delete).count(), len(statuses_to_delete))
|
|
815
|
-
|
|
816
|
-
def test_bulk_delete_objects_with_constrained_permission(self):
|
|
817
|
-
statuses_to_delete = [str(status) for status in Status.objects.all().values_list("pk", flat=True)[:2]]
|
|
818
|
-
obj_perm = ObjectPermission(
|
|
819
|
-
name="Test permission",
|
|
820
|
-
constraints={"pk": str(statuses_to_delete[0])},
|
|
821
|
-
actions=["delete"],
|
|
822
|
-
)
|
|
823
|
-
obj_perm.save()
|
|
824
|
-
obj_perm.users.add(self.user)
|
|
825
|
-
obj_perm.object_types.add(ContentType.objects.get_for_model(Status))
|
|
826
|
-
|
|
827
|
-
job_result = create_job_result_and_run_job(
|
|
828
|
-
"nautobot.core.jobs.bulk_actions",
|
|
829
|
-
"BulkDeleteObjects",
|
|
830
|
-
content_type=self.status_ct.id,
|
|
831
|
-
pk_list=statuses_to_delete,
|
|
832
|
-
username=self.user.username,
|
|
833
|
-
)
|
|
834
|
-
self.assertEqual(job_result.status, JobResultStatusChoices.STATUS_FAILURE)
|
|
835
|
-
error_log = JobLogEntry.objects.get(job_result=job_result, log_level=LogLevelChoices.LOG_ERROR)
|
|
836
|
-
self.assertEqual(
|
|
837
|
-
error_log.message, "You do not have permissions to delete some of the objects provided in `pk_list`."
|
|
838
|
-
)
|
|
839
|
-
self.assertEqual(Status.objects.filter(pk__in=statuses_to_delete).count(), len(statuses_to_delete))
|
|
840
|
-
|
|
841
|
-
def test_bulk_delete_all(self):
|
|
842
|
-
self.add_permissions("extras.delete_objectmetadata")
|
|
843
|
-
|
|
844
|
-
# Assert ObjectMetadata is not empty
|
|
845
|
-
self.assertNotEqual(ObjectMetadata.objects.all().count(), 0)
|
|
846
|
-
|
|
847
|
-
job_result = create_job_result_and_run_job(
|
|
848
|
-
"nautobot.core.jobs.bulk_actions",
|
|
849
|
-
"BulkDeleteObjects",
|
|
850
|
-
content_type=ContentType.objects.get_for_model(ObjectMetadata).id,
|
|
851
|
-
delete_all=True,
|
|
852
|
-
filter_query_params={},
|
|
853
|
-
pk_list=[],
|
|
854
|
-
username=self.user.username,
|
|
855
|
-
)
|
|
856
|
-
self._common_no_error_test_assertion(ObjectMetadata, job_result)
|
|
857
|
-
|
|
858
|
-
def test_bulk_delete_filter_all(self):
|
|
859
|
-
self.add_permissions("extras.delete_status")
|
|
860
|
-
for x in range(10):
|
|
861
|
-
Status.objects.create(name=f"Example Status {x}")
|
|
862
|
-
|
|
863
|
-
status_to_ignore = Status.objects.create(name="Ignore Example Status")
|
|
864
|
-
job_result = create_job_result_and_run_job(
|
|
865
|
-
"nautobot.core.jobs.bulk_actions",
|
|
866
|
-
"BulkDeleteObjects",
|
|
867
|
-
content_type=self.status_ct.id,
|
|
868
|
-
delete_all=True,
|
|
869
|
-
filter_query_params={"name__isw": "Example Status"},
|
|
870
|
-
username=self.user.username,
|
|
871
|
-
)
|
|
872
|
-
self._common_no_error_test_assertion(Status, job_result, name__istartswith="Example Status")
|
|
873
|
-
self.assertTrue(Status.objects.filter(name=status_to_ignore.name).exists())
|
|
874
|
-
|
|
875
|
-
def test_bulk_delete_passing_both_pk_list_and_delete_all(self):
|
|
876
|
-
self.add_permissions("extras.delete_status")
|
|
877
|
-
status_count = Status.objects.all().count()
|
|
878
|
-
job_result = create_job_result_and_run_job(
|
|
879
|
-
"nautobot.core.jobs.bulk_actions",
|
|
880
|
-
"BulkDeleteObjects",
|
|
881
|
-
content_type=self.status_ct.id,
|
|
882
|
-
delete_all=True,
|
|
883
|
-
filter_query_params={"name__isw": "Example Status"},
|
|
884
|
-
pk_list=[str(Status.objects.first().pk)],
|
|
885
|
-
username=self.user.username,
|
|
886
|
-
)
|
|
887
|
-
self.assertEqual(job_result.status, JobResultStatusChoices.STATUS_FAILURE)
|
|
888
|
-
job_log = JobLogEntry.objects.get(job_result=job_result, log_level=LogLevelChoices.LOG_ERROR)
|
|
889
|
-
self.assertEqual(
|
|
890
|
-
job_log.message,
|
|
891
|
-
"You can either delete objs within `pk_list` provided or `delete_all` with `filter_query_params` if needed.",
|
|
892
|
-
)
|
|
893
|
-
self.assertEqual(status_count, Status.objects.all().count())
|
|
894
|
-
|
|
895
|
-
def test_bulk_delete_with_pk(self):
|
|
896
|
-
self.add_permissions("extras.delete_role")
|
|
897
|
-
roles_to_delete = [Role.objects.create(name=f"Example Role {x}") for x in range(3)]
|
|
898
|
-
roles_to_ignore = Role.objects.create(name="Ignore Example Role")
|
|
899
|
-
roles_pks = [str(role.pk) for role in roles_to_delete]
|
|
900
|
-
job_result = create_job_result_and_run_job(
|
|
901
|
-
"nautobot.core.jobs.bulk_actions",
|
|
902
|
-
"BulkDeleteObjects",
|
|
903
|
-
content_type=self.role_ct.id,
|
|
904
|
-
delete_all=False,
|
|
905
|
-
filter_query_params={},
|
|
906
|
-
pk_list=roles_pks,
|
|
907
|
-
username=self.user.username,
|
|
908
|
-
)
|
|
909
|
-
self._common_no_error_test_assertion(Role, job_result, pk__in=roles_pks)
|
|
910
|
-
self.assertTrue(Role.objects.filter(name=roles_to_ignore.name).exists())
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import datetime
|
|
2
1
|
import os
|
|
3
2
|
import sys
|
|
4
3
|
from unittest import mock, TestCase
|
|
@@ -241,8 +240,6 @@ class SettingsJSONSchemaTestCase(TestCase):
|
|
|
241
240
|
fake = faker.Faker()
|
|
242
241
|
if value_type == "boolean":
|
|
243
242
|
return str(fake.boolean())
|
|
244
|
-
elif value_type == "date":
|
|
245
|
-
return datetime.date.today().isoformat()
|
|
246
243
|
elif value_type == "integer":
|
|
247
244
|
return str(fake.random_int())
|
|
248
245
|
return f"FAKE_ENV_{fake.word()}"
|
|
@@ -255,8 +252,6 @@ class SettingsJSONSchemaTestCase(TestCase):
|
|
|
255
252
|
# ALLOWED_HOSTS is a special case (space separated instead of commas)
|
|
256
253
|
if setting_name == "ALLOWED_HOSTS":
|
|
257
254
|
return os.environ[env_var].split(" ")
|
|
258
|
-
elif setting_name == "NTC_SUPPORT_CONTRACT_EXPIRATION_DATE":
|
|
259
|
-
return datetime.date.fromisoformat(os.environ[env_var])
|
|
260
255
|
elif setting_type == "array":
|
|
261
256
|
children_type = setting_schema.get("items", {}).get("type", "string")
|
|
262
257
|
if children_type == "integer":
|
|
@@ -278,8 +273,6 @@ class SettingsJSONSchemaTestCase(TestCase):
|
|
|
278
273
|
# ALLOWED_HOSTS is a special case (space separated instead of commas)
|
|
279
274
|
if setting_name == "ALLOWED_HOSTS":
|
|
280
275
|
os.environ[env_var] = " ".join(self._get_fake_env_value("string") for _ in range(3))
|
|
281
|
-
elif setting_name == "NTC_SUPPORT_CONTRACT_EXPIRATION_DATE":
|
|
282
|
-
os.environ[env_var] = self._get_fake_env_value("date")
|
|
283
276
|
elif setting_type == "array":
|
|
284
277
|
children_type = setting_schema.get("items", {}).get("type", "string")
|
|
285
278
|
os.environ[env_var] = ",".join(self._get_fake_env_value(children_type) for _ in range(3))
|
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
from django.test import TestCase
|
|
2
2
|
|
|
3
|
-
from nautobot.circuits.models import Circuit
|
|
4
|
-
from nautobot.circuits.tables import CircuitTable
|
|
5
3
|
from nautobot.core.models.querysets import count_related
|
|
6
4
|
from nautobot.dcim.models import Device, InventoryItem, Location, LocationType, Rack, RackGroup
|
|
7
5
|
from nautobot.dcim.tables import InventoryItemTable, LocationTable, LocationTypeTable, RackGroupTable
|
|
8
|
-
from nautobot.extras.models import JobLogEntry
|
|
9
|
-
from nautobot.extras.tables import JobLogEntryTable
|
|
10
6
|
from nautobot.tenancy.tables import TenantGroupTable
|
|
11
|
-
from nautobot.wireless.models import WirelessNetwork
|
|
12
|
-
from nautobot.wireless.tables import WirelessNetworkTable
|
|
13
7
|
|
|
14
8
|
|
|
15
9
|
class TableTestCase(TestCase):
|
|
@@ -69,97 +63,3 @@ class TableTestCase(TestCase):
|
|
|
69
63
|
queryset = RackGroupTable.Meta.model.objects.annotate(rack_count=count_related(Rack, "rack_group")).all()
|
|
70
64
|
self._validate_sorted_tree_queryset_same_with_table_queryset(queryset, RackGroupTable, "rack_count")
|
|
71
65
|
self._validate_sorted_tree_queryset_same_with_table_queryset(queryset, RackGroupTable, "-rack_count")
|
|
72
|
-
|
|
73
|
-
def test_base_table_apis(self):
|
|
74
|
-
"""
|
|
75
|
-
Test BaseTable APIs, specifically visible_columns and configurable_columns.
|
|
76
|
-
Assert that they gave the correct results.
|
|
77
|
-
"""
|
|
78
|
-
# Wireless Network Table
|
|
79
|
-
wn_table = WirelessNetworkTable(WirelessNetwork.objects.all(), exclude=["enabled", "hidden"])
|
|
80
|
-
wn_table.columns.hide("description")
|
|
81
|
-
expected_visible_columns = [
|
|
82
|
-
"name",
|
|
83
|
-
"ssid",
|
|
84
|
-
"mode",
|
|
85
|
-
"authentication",
|
|
86
|
-
"actions",
|
|
87
|
-
]
|
|
88
|
-
expected_configurable_columns = [
|
|
89
|
-
("name", "Name"),
|
|
90
|
-
("ssid", "SSID"),
|
|
91
|
-
("mode", "Mode"),
|
|
92
|
-
("authentication", "Authentication"),
|
|
93
|
-
("secret", "Secret"),
|
|
94
|
-
("description", "Description"),
|
|
95
|
-
("tags", "Tags"),
|
|
96
|
-
("dynamic_group_count", "Dynamic Groups"),
|
|
97
|
-
]
|
|
98
|
-
self.assertEqual(wn_table.visible_columns, expected_visible_columns)
|
|
99
|
-
self.assertEqual(wn_table.configurable_columns, expected_configurable_columns)
|
|
100
|
-
|
|
101
|
-
# Location Table
|
|
102
|
-
location_table = LocationTable(Location.objects.all(), exclude=["parent", "tenant"])
|
|
103
|
-
location_table.columns.hide("description")
|
|
104
|
-
location_table.columns.hide("tags")
|
|
105
|
-
expected_visible_columns = ["name", "status", "actions"]
|
|
106
|
-
expected_configurable_columns = [
|
|
107
|
-
("name", "Name"),
|
|
108
|
-
("status", "Status"),
|
|
109
|
-
("location_type", "Location type"),
|
|
110
|
-
("description", "Description"),
|
|
111
|
-
("facility", "Facility"),
|
|
112
|
-
("asn", "ASN"),
|
|
113
|
-
("time_zone", "Time zone"),
|
|
114
|
-
("physical_address", "Physical address"),
|
|
115
|
-
("shipping_address", "Shipping address"),
|
|
116
|
-
("latitude", "Latitude"),
|
|
117
|
-
("longitude", "Longitude"),
|
|
118
|
-
("contact_name", "Contact name"),
|
|
119
|
-
("contact_phone", "Contact phone"),
|
|
120
|
-
("contact_email", "Contact E-mail"),
|
|
121
|
-
("tags", "Tags"),
|
|
122
|
-
("dynamic_group_count", "Dynamic Groups"),
|
|
123
|
-
("cf_example_app_auto_custom_field", "Example App Automatically Added Custom Field"),
|
|
124
|
-
]
|
|
125
|
-
self.assertEqual(location_table.visible_columns, expected_visible_columns)
|
|
126
|
-
self.assertEqual(location_table.configurable_columns, expected_configurable_columns)
|
|
127
|
-
|
|
128
|
-
# Circuit Table
|
|
129
|
-
circuit_table = CircuitTable(Circuit.objects.all(), exclude=["provider", "circuit_termination_a"])
|
|
130
|
-
circuit_table.columns.hide("tags")
|
|
131
|
-
expected_visible_columns = [
|
|
132
|
-
"cid",
|
|
133
|
-
"circuit_type",
|
|
134
|
-
"status",
|
|
135
|
-
"circuit_termination_z",
|
|
136
|
-
"description",
|
|
137
|
-
"example_app_provider_asn",
|
|
138
|
-
]
|
|
139
|
-
expected_configurable_columns = [
|
|
140
|
-
("cid", "ID"),
|
|
141
|
-
("circuit_type", "Circuit type"),
|
|
142
|
-
("status", "Status"),
|
|
143
|
-
("tenant", "Tenant"),
|
|
144
|
-
("circuit_termination_z", "Side Z"),
|
|
145
|
-
("install_date", "Date installed"),
|
|
146
|
-
("commit_rate", "Commit rate (Kbps)"),
|
|
147
|
-
("description", "Description"),
|
|
148
|
-
("tags", "Tags"),
|
|
149
|
-
("example_app_provider_asn", "Provider ASN"),
|
|
150
|
-
("dynamic_group_count", "Dynamic Groups"),
|
|
151
|
-
]
|
|
152
|
-
self.assertEqual(circuit_table.visible_columns, expected_visible_columns)
|
|
153
|
-
self.assertEqual(circuit_table.configurable_columns, expected_configurable_columns)
|
|
154
|
-
|
|
155
|
-
# Job Log Entry Table (Job Log Entry is not Dynamic Group associable)
|
|
156
|
-
job_log_entry_table = JobLogEntryTable(JobLogEntry.objects.all(), exclude=["created", "message"])
|
|
157
|
-
job_log_entry_table.columns.hide("log_level")
|
|
158
|
-
expected_visible_columns = ["grouping", "log_object"]
|
|
159
|
-
expected_configurable_columns = [
|
|
160
|
-
("grouping", "Grouping"),
|
|
161
|
-
("log_level", "Level"),
|
|
162
|
-
("log_object", "Object"),
|
|
163
|
-
]
|
|
164
|
-
self.assertEqual(job_log_entry_table.visible_columns, expected_visible_columns)
|
|
165
|
-
self.assertEqual(job_log_entry_table.configurable_columns, expected_configurable_columns)
|