mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Closes #7784: Support cluster type assignment for config contexts
This commit is contained in:
@ -216,80 +216,77 @@ class ConfigContextTest(TestCase):
|
||||
self.assertEqual(device.get_config_context(), annotated_queryset[0].get_config_context())
|
||||
|
||||
def test_annotation_same_as_get_for_object_virtualmachine_relations(self):
|
||||
cluster_type = ClusterType.objects.create(name="Cluster Type")
|
||||
cluster_group = ClusterGroup.objects.create(name="Cluster Group")
|
||||
cluster = Cluster.objects.create(name="Cluster", group=cluster_group, type=cluster_type)
|
||||
|
||||
site_context = ConfigContext.objects.create(
|
||||
name="site",
|
||||
weight=100,
|
||||
data={
|
||||
"site": 1
|
||||
}
|
||||
data={"site": 1}
|
||||
)
|
||||
site_context.sites.add(self.site)
|
||||
|
||||
region_context = ConfigContext.objects.create(
|
||||
name="region",
|
||||
weight=100,
|
||||
data={
|
||||
"region": 1
|
||||
}
|
||||
data={"region": 1}
|
||||
)
|
||||
region_context.regions.add(self.region)
|
||||
|
||||
sitegroup_context = ConfigContext.objects.create(
|
||||
name="sitegroup",
|
||||
weight=100,
|
||||
data={
|
||||
"sitegroup": 1
|
||||
}
|
||||
data={"sitegroup": 1}
|
||||
)
|
||||
sitegroup_context.site_groups.add(self.sitegroup)
|
||||
|
||||
platform_context = ConfigContext.objects.create(
|
||||
name="platform",
|
||||
weight=100,
|
||||
data={
|
||||
"platform": 1
|
||||
}
|
||||
data={"platform": 1}
|
||||
)
|
||||
platform_context.platforms.add(self.platform)
|
||||
|
||||
tenant_group_context = ConfigContext.objects.create(
|
||||
name="tenant group",
|
||||
weight=100,
|
||||
data={
|
||||
"tenant_group": 1
|
||||
}
|
||||
data={"tenant_group": 1}
|
||||
)
|
||||
tenant_group_context.tenant_groups.add(self.tenantgroup)
|
||||
|
||||
tenant_context = ConfigContext.objects.create(
|
||||
name="tenant",
|
||||
weight=100,
|
||||
data={
|
||||
"tenant": 1
|
||||
}
|
||||
data={"tenant": 1}
|
||||
)
|
||||
tenant_context.tenants.add(self.tenant)
|
||||
|
||||
tag_context = ConfigContext.objects.create(
|
||||
name="tag",
|
||||
weight=100,
|
||||
data={
|
||||
"tag": 1
|
||||
}
|
||||
data={"tag": 1}
|
||||
)
|
||||
tag_context.tags.add(self.tag)
|
||||
cluster_group = ClusterGroup.objects.create(name="Cluster Group")
|
||||
|
||||
cluster_type_context = ConfigContext.objects.create(
|
||||
name="cluster type",
|
||||
weight=100,
|
||||
data={"cluster_type": 1}
|
||||
)
|
||||
cluster_type_context.cluster_types.add(cluster_type)
|
||||
|
||||
cluster_group_context = ConfigContext.objects.create(
|
||||
name="cluster group",
|
||||
weight=100,
|
||||
data={
|
||||
"cluster_group": 1
|
||||
}
|
||||
data={"cluster_group": 1}
|
||||
)
|
||||
cluster_group_context.cluster_groups.add(cluster_group)
|
||||
cluster_type = ClusterType.objects.create(name="Cluster Type 1")
|
||||
cluster = Cluster.objects.create(name="Cluster", group=cluster_group, type=cluster_type)
|
||||
|
||||
cluster_context = ConfigContext.objects.create(
|
||||
name="cluster",
|
||||
weight=100,
|
||||
data={
|
||||
"cluster": 1
|
||||
}
|
||||
data={"cluster": 1}
|
||||
)
|
||||
cluster_context.clusters.add(cluster)
|
||||
|
||||
|
Reference in New Issue
Block a user