feat: show tenant column in netbox-inventory asset list
The asset table of netbox-inventory gets a tenant column (registered if the plugin does not provide one) that is part of the default columns, placed right after the status. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
cf1cafb632
commit
f86306e686
5 files changed
+61
-3
No files matched your search
@@ -0,0 +1,25 @@
|
||||
from types import SimpleNamespace
|
||||
|
||||
from django.test import SimpleTestCase
|
||||
|
||||
from netbox_utilities.inventory_assets import add_to_default_columns
|
||||
|
||||
|
||||
def fake_table(*default_columns):
|
||||
return SimpleNamespace(Meta=SimpleNamespace(default_columns=default_columns))
|
||||
|
||||
|
||||
class AssetTenantColumnTest(SimpleTestCase):
|
||||
def test_tenant_is_shown_after_status(self):
|
||||
table = fake_table("pk", "id", "name", "asset_tag", "status", "hardware", "tags")
|
||||
|
||||
add_to_default_columns(table)
|
||||
|
||||
self.assertEqual(table.Meta.default_columns, ("pk", "id", "name", "asset_tag", "status", "tenant", "hardware", "tags"))
|
||||
|
||||
def test_tenant_is_not_duplicated_and_appended_without_anchor(self):
|
||||
table = fake_table("pk", "tenant", "name")
|
||||
|
||||
add_to_default_columns(table)
|
||||
|
||||
self.assertEqual(table.Meta.default_columns, ("pk", "name", "tenant"))
|
||||
Reference in new issue
Block a user