[PR #4733] [MERGED] Closes #4730: Update REST API tests to enforce ObjectPermissions #12909

Closed
opened 2025-12-29 22:24:18 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/4733
Author: @jeremystretch
Created: 6/8/2020
Status: Merged
Merged: 6/8/2020
Merged by: @jeremystretch

Base: develop-2.9Head: 4730-api-test-permissions


📝 Commits (10+)

  • f83e435 Move APIViewTestCases to api.py
  • 830fd5f Remove duplicate test method
  • 3b44e7c Update API test methods to evaluate permissions assignment
  • a8145fe Add permission assignment to custom test methods
  • c1a37db Fix managers on Graph and ExportTemplate
  • 6222485 Standardize ObjectPermissionTest
  • a295519 Remove extraneous permission class from SecretRoleViewSet
  • 047286f Add a third initial object to VirtualChassisTest
  • 987414e Introduce NestedObjectPermissionSerializer
  • 7a858ce Extend test_bulk_create_objects() to inspect created objects

📊 Changes

20 files changed (+455 additions, -309 deletions)

View changed files

📝 netbox/circuits/tests/test_api.py (+1 -0)
📝 netbox/dcim/tests/test_api.py (+33 -7)
📝 netbox/extras/models/models.py (+4 -0)
📝 netbox/extras/tests/test_api.py (+6 -0)
📝 netbox/extras/tests/test_changelog.py (+6 -11)
📝 netbox/extras/tests/test_customfields.py (+14 -8)
📝 netbox/extras/tests/test_tags.py (+4 -7)
📝 netbox/extras/tests/test_webhooks.py (+5 -7)
📝 netbox/ipam/tests/test_api.py (+11 -0)
📝 netbox/netbox/tests/test_authentication.py (+1 -1)
📝 netbox/secrets/api/views.py (+0 -1)
📝 netbox/users/api/nested_serializers.py (+26 -6)
📝 netbox/users/api/serializers.py (+1 -0)
📝 netbox/users/models.py (+3 -0)
📝 netbox/users/tests/test_api.py (+5 -75)
📝 netbox/utilities/testing/__init__.py (+2 -1)
netbox/utilities/testing/api.py (+282 -0)
📝 netbox/utilities/testing/views.py (+14 -138)
📝 netbox/utilities/tests/test_api.py (+12 -19)
📝 netbox/virtualization/tests/test_api.py (+25 -28)

📄 Description

Fixes: #4730

Update REST API tests to enforce ObjectPermissions


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbox-community/netbox/pull/4733 **Author:** [@jeremystretch](https://github.com/jeremystretch) **Created:** 6/8/2020 **Status:** ✅ Merged **Merged:** 6/8/2020 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `develop-2.9` ← **Head:** `4730-api-test-permissions` --- ### 📝 Commits (10+) - [`f83e435`](https://github.com/netbox-community/netbox/commit/f83e435a90f01f1b0d97daa50955f17d1f868f77) Move APIViewTestCases to api.py - [`830fd5f`](https://github.com/netbox-community/netbox/commit/830fd5f83ab04fb3032677a5f7374c13617c41fa) Remove duplicate test method - [`3b44e7c`](https://github.com/netbox-community/netbox/commit/3b44e7c1c4a8d8bee88f808a4bbeb05cf78d2aaf) Update API test methods to evaluate permissions assignment - [`a8145fe`](https://github.com/netbox-community/netbox/commit/a8145fe4c275463ecb54a1f2b522359b5f9c19d4) Add permission assignment to custom test methods - [`c1a37db`](https://github.com/netbox-community/netbox/commit/c1a37db87187649bb3bc86855a59bf38d34ccf10) Fix managers on Graph and ExportTemplate - [`6222485`](https://github.com/netbox-community/netbox/commit/62224857f0784e5864e5ec81ecffa9a4da319b60) Standardize ObjectPermissionTest - [`a295519`](https://github.com/netbox-community/netbox/commit/a2955196affd341800bb843d5c5ec8beb7a36f51) Remove extraneous permission class from SecretRoleViewSet - [`047286f`](https://github.com/netbox-community/netbox/commit/047286f9c05b6d44a750c2136ee8aad43117708c) Add a third initial object to VirtualChassisTest - [`987414e`](https://github.com/netbox-community/netbox/commit/987414ed7b2d6d2dea0dadb3900699543a4293e1) Introduce NestedObjectPermissionSerializer - [`7a858ce`](https://github.com/netbox-community/netbox/commit/7a858cea23cee1d9ea1eb558b2f987338e16e841) Extend test_bulk_create_objects() to inspect created objects ### 📊 Changes **20 files changed** (+455 additions, -309 deletions) <details> <summary>View changed files</summary> 📝 `netbox/circuits/tests/test_api.py` (+1 -0) 📝 `netbox/dcim/tests/test_api.py` (+33 -7) 📝 `netbox/extras/models/models.py` (+4 -0) 📝 `netbox/extras/tests/test_api.py` (+6 -0) 📝 `netbox/extras/tests/test_changelog.py` (+6 -11) 📝 `netbox/extras/tests/test_customfields.py` (+14 -8) 📝 `netbox/extras/tests/test_tags.py` (+4 -7) 📝 `netbox/extras/tests/test_webhooks.py` (+5 -7) 📝 `netbox/ipam/tests/test_api.py` (+11 -0) 📝 `netbox/netbox/tests/test_authentication.py` (+1 -1) 📝 `netbox/secrets/api/views.py` (+0 -1) 📝 `netbox/users/api/nested_serializers.py` (+26 -6) 📝 `netbox/users/api/serializers.py` (+1 -0) 📝 `netbox/users/models.py` (+3 -0) 📝 `netbox/users/tests/test_api.py` (+5 -75) 📝 `netbox/utilities/testing/__init__.py` (+2 -1) ➕ `netbox/utilities/testing/api.py` (+282 -0) 📝 `netbox/utilities/testing/views.py` (+14 -138) 📝 `netbox/utilities/tests/test_api.py` (+12 -19) 📝 `netbox/virtualization/tests/test_api.py` (+25 -28) </details> ### 📄 Description ### Fixes: #4730 Update REST API tests to enforce ObjectPermissions --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-29 22:24:18 +01:00
adam closed this issue 2025-12-29 22:24:18 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#12909