[PR #4072] [MERGED] Closes #4000: Add tests for the create, edit, and delete views of all models #12750

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

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/4072
Author: @jeremystretch
Created: 1/31/2020
Status: Merged
Merged: 1/31/2020
Merged by: @jeremystretch

Base: developHead: 4000-view-tests


📝 Commits (10+)

  • 43b2c36 Introduced a custom TestCase
  • 61ac7c4 Migrate view tests to use new TestCase class
  • 179abcc Refactor APITestCase to subclass TestCase
  • 67fafb2 Use assertHttpStatus for evaluating HTTP response codes
  • a44c4d1 Convert view tests under extras to the new TestCase
  • e01c984 Introduced a custom model_to_dict()
  • 98cce7e Added ViewTestCase (WIP)
  • 939b5f2 Reorganize test classes to prevent unittest from running the base TestCases
  • 78d43a5 Move form/CSV data declaration under setUpTestData
  • 7daf1df Add _get_url() for View test case

📊 Changes

13 files changed (+1113 additions, -1239 deletions)

View changed files

📝 netbox/circuits/tests/test_views.py (+47 -93)
📝 netbox/dcim/forms.py (+1 -0)
📝 netbox/dcim/tests/test_views.py (+371 -478)
📝 netbox/extras/tests/test_views.py (+51 -43)
📝 netbox/ipam/tests/test_views.py (+146 -278)
📝 netbox/netbox/tests/test_views.py (+3 -3)
📝 netbox/secrets/tests/test_views.py (+46 -73)
📝 netbox/tenancy/tests/test_views.py (+27 -64)
netbox/utilities/testing.py (+0 -79)
netbox/utilities/testing/__init__.py (+2 -0)
netbox/utilities/testing/testcases.py (+249 -0)
netbox/utilities/testing/utils.py (+102 -0)
📝 netbox/virtualization/tests/test_views.py (+68 -128)

📄 Description

Fixes: #4000

  • Introduces a new test class to greatly reduce the amount of boilerplate code needed
  • Adds 80 new view tests in total

🔄 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/4072 **Author:** [@jeremystretch](https://github.com/jeremystretch) **Created:** 1/31/2020 **Status:** ✅ Merged **Merged:** 1/31/2020 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `develop` ← **Head:** `4000-view-tests` --- ### 📝 Commits (10+) - [`43b2c36`](https://github.com/netbox-community/netbox/commit/43b2c36066e9ab232cf3ca66dfe09f945498aef7) Introduced a custom TestCase - [`61ac7c4`](https://github.com/netbox-community/netbox/commit/61ac7c44ba2cfb55b484dc4d0e36bf775c2e59f6) Migrate view tests to use new TestCase class - [`179abcc`](https://github.com/netbox-community/netbox/commit/179abcc79de43893482a7e6adc6e6a8f8f7adc01) Refactor APITestCase to subclass TestCase - [`67fafb2`](https://github.com/netbox-community/netbox/commit/67fafb2b9dc700a5d91dd6ea243bd82bba73638d) Use assertHttpStatus for evaluating HTTP response codes - [`a44c4d1`](https://github.com/netbox-community/netbox/commit/a44c4d14e4dd4ad3cf71e4d41cf2cd0096418ee6) Convert view tests under extras to the new TestCase - [`e01c984`](https://github.com/netbox-community/netbox/commit/e01c984c01fcd45a9976067f5bd043d661038739) Introduced a custom model_to_dict() - [`98cce7e`](https://github.com/netbox-community/netbox/commit/98cce7eee4aa4fe2642ad45b3eea0e982de050da) Added ViewTestCase (WIP) - [`939b5f2`](https://github.com/netbox-community/netbox/commit/939b5f2e292f6f885c8f1d49068ffe36a8caec8f) Reorganize test classes to prevent unittest from running the base TestCases - [`78d43a5`](https://github.com/netbox-community/netbox/commit/78d43a5d66bedbb5e41443082949106d528e586a) Move form/CSV data declaration under setUpTestData - [`7daf1df`](https://github.com/netbox-community/netbox/commit/7daf1df22da42efe3312a4f7a40ddd442dc68150) Add _get_url() for View test case ### 📊 Changes **13 files changed** (+1113 additions, -1239 deletions) <details> <summary>View changed files</summary> 📝 `netbox/circuits/tests/test_views.py` (+47 -93) 📝 `netbox/dcim/forms.py` (+1 -0) 📝 `netbox/dcim/tests/test_views.py` (+371 -478) 📝 `netbox/extras/tests/test_views.py` (+51 -43) 📝 `netbox/ipam/tests/test_views.py` (+146 -278) 📝 `netbox/netbox/tests/test_views.py` (+3 -3) 📝 `netbox/secrets/tests/test_views.py` (+46 -73) 📝 `netbox/tenancy/tests/test_views.py` (+27 -64) ➖ `netbox/utilities/testing.py` (+0 -79) ➕ `netbox/utilities/testing/__init__.py` (+2 -0) ➕ `netbox/utilities/testing/testcases.py` (+249 -0) ➕ `netbox/utilities/testing/utils.py` (+102 -0) 📝 `netbox/virtualization/tests/test_views.py` (+68 -128) </details> ### 📄 Description ### Fixes: #4000 - Introduces a new test class to greatly reduce the amount of boilerplate code needed - Adds 80 new view tests in total --- <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:23:24 +01:00
adam closed this issue 2025-12-29 22:23:25 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#12750