Files
NetBox-SLM/netbox_slm/tests/base.py
T
MrBlakeandClaude Opus 5.5 0a81a04746 docs: state fork, original authors and Apache 2.0 license
Follow the attribution requirements of the Apache License 2.0 for this fork of
ICTU/netbox_slm:

- add a NOTICE file with the original copyright (ICTU) and the fork's notice
- mark every file changed since upstream 1.9.0 as modified (section 4b);
  the original copyright header in __init__.py is kept
- add a visible fork notice and a section on origin, credits, changes and
  license to the README
- point project URLs to this fork (with an Upstream link), list ICTU as
  author and MrBlake as maintainer, and stop showing ICTU's email address
  as the plugin contact
- ship NOTICE in the package and drop the MANIFEST entry for the removed
  SECURITY.md

Bump version to 1.14.1.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-13 15:52:13 +01:00

51 lines
2.7 KiB
Python

# Modified by MrBlake for the NetBox-SLM fork: https://git.mrblake.cc/MrBlake/NetBox-SLM
# Based on ICTU/netbox_slm (Apache License 2.0). See the LICENSE and NOTICE files.
from django.test import TestCase
from dcim.models import Device, DeviceRole, DeviceType, Manufacturer, Site
from netbox_slm.models import SoftwareProduct, SoftwareProductVersion, SoftwareProductInstallation, SoftwareLicense
from tenancy.models import Tenant, TenantGroup
from virtualization.models import Cluster, ClusterType, VirtualMachine
class SlmBaseTestCase(TestCase):
p_name: str = "test product"
v_name: str = "test version"
l_name: str = "test license"
test_url: str = "https://github.com/ICTU/netbox_slm"
vm: VirtualMachine
software_product: SoftwareProduct
software_product_version: SoftwareProductVersion
software_product_installation: SoftwareProductInstallation
@classmethod
def setUpTestData(cls):
# setUpTestData rolls back after the class and gives every test its own copy of these objects.
manufacturer = Manufacturer.objects.create(name="test manufacturer")
device_type = DeviceType.objects.create(model="test device type", manufacturer=manufacturer)
device_role = DeviceRole.objects.create(name="test device role")
site = Site.objects.create(name="test site")
cls.device = Device.objects.create(name="test device", device_type=device_type, role=device_role, site=site)
cls.vm = VirtualMachine.objects.create(name="test VM")
cluster_type = ClusterType.objects.create(name="test cluster type")
cls.cluster = Cluster.objects.create(name="test cluster", type=cluster_type)
cls.tenant_group = TenantGroup.objects.create(name="test tenant group", slug="test-tenant-group")
cls.tenant = Tenant.objects.create(name="test tenant", slug="test-tenant", group=cls.tenant_group)
cls.software_product = SoftwareProduct.objects.create(name=cls.p_name)
cls.software_product_version = SoftwareProductVersion.objects.create(
name=cls.v_name, software_product=cls.software_product
)
cls.software_product_installation = SoftwareProductInstallation.objects.create(
virtualmachine=cls.vm, software_product=cls.software_product, version=cls.software_product_version
)
cls.software_license = SoftwareLicense.objects.create(
name=cls.l_name,
software_product=cls.software_product,
version=cls.software_product_version,
installation=cls.software_product_installation,
stored_location_url=cls.test_url,
tenant_group=cls.tenant_group,
tenant=cls.tenant,
)