Skip to content

Commit 816be31

Browse files
author
menckend
committed
updates tests
1 parent 6fdbd1a commit 816be31

File tree

3 files changed

+55
-1
lines changed

3 files changed

+55
-1
lines changed

netbox_rpki/tests/__init__.py

Whitespace-only changes.

netbox_rpki/tests/test_api.py

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import json
2+
3+
from django.urls import reverse
4+
from utilities.testing import APITestCase, APIViewTestCases
5+
6+
from tenancy.models import Tenant
7+
from dcim.models import Site, DeviceRole, DeviceType, Manufacturer, Device, Interface
8+
from ipam.models import IPAddress, ASN, RIR, Prefix
9+
10+
from netbox_rpki.models import (
11+
Certificate,
12+
CertificateAsn,
13+
CertificatePrefix,
14+
Roa,
15+
RoaPrefix,
16+
RoaAsn,
17+
Organization
18+
)
19+
20+
from netbox_rpki.choices import (
21+
CertificateStatusChoices
22+
)
23+
24+
25+
class OrganizationAPITestCase(
26+
APIViewTestCases.GetObjectViewTestCase,
27+
APIViewTestCases.ListObjectsViewTestCase,
28+
APIViewTestCases.CreateObjectViewTestCase,
29+
APIViewTestCases.UpdateObjectViewTestCase,
30+
APIViewTestCases.DeleteObjectViewTestCase,
31+
APIViewTestCases.GraphQLTestCase,
32+
):
33+
model = Organization
34+
view_namespace = "plugins-api:netbox_rpki"
35+
brief_fields = ["org_id", "name", "parent_rir"]
36+
graphql_base_name = "netbox_bgp_community"
37+
38+
create_data = [
39+
{"name": "rpki-testorg1", "org_id": "rpki-testorg1"},
40+
{"name": "rpki-testorg2", "org_id": "rpki-testorg2"},
41+
{"name": "rpki-testorg3", "org_id": "rpki-testorg3"},
42+
]
43+
44+
bulk_update_data = {
45+
"description": "Test Community desc",
46+
}
47+
@classmethod
48+
def setUpTestData(cls):
49+
organizations = (
50+
Organization(org_id="rpki-testorg1", name="rpki-testorg1"),
51+
Organization(org_id="rpki-testorg2", name="rpki-testorg2"),
52+
Organization(org_id="rpki-testorg3", name="rpki-testorg3"),
53+
)
54+
Organization.objects.bulk_create(organizations)

netbox_rpki/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def get_extra_context(self, request, instance):
1313
certificateasn_table.configure(request)
1414
roa_table = tables.RoaTable(instance.roas.all())
1515
roa_table.configure(request)
16-
16+
1717
return {
1818
'signed_roas_table': roa_table,
1919
'assigned_asns_table': certificateasn_table,

0 commit comments

Comments
 (0)