mirror of
https://github.com/peeringdb/peeringdb.git
synced 2024-05-11 05:55:09 +00:00
Support 202202 (#1125)
* New Field "Health Check" #512 * Add status_dashboard to fields #512 * RS Peer Checkbox also visible on IX Site #727 * Add "Management" search field to Advanced Search of Exchanges #506 * wrap correctly on mobile #881 * missing delete button for user #653 * Removed cruft from IX view template #881 * To force or not to force www, that is a question #916 * add health check fields to entity creation forms (fac, ix, net) (#512) * status_dashboard should accept null values #512 * Sort usergroup names in https://peeringdb.com/cp/peeringdb_server/userpermission/xxxxx numerically #656 * fix issue with deleted entities showing up in search results #1042 * 2FA Backup Tokens language doesn't seem correct #908 * linting * poetry relock * fix user permission save trying to create a user * add status_dashboard to mock data * docs * add api doc regen to gen_docs call fix issue with run_tests if BASE_URL env var is set * fix generate_schema typo * linting Co-authored-by: David Poarch <dpoarch@20c.com> Co-authored-by: Stefan Pratter <stefan@20c.com>
This commit is contained in:
@@ -210,16 +210,46 @@ class SearchTests(TestCase):
|
||||
net_3.delete(hard=True)
|
||||
call_command("rebuild_index", "--noinput")
|
||||
|
||||
def test_search_asn_direct(self):
|
||||
"""
|
||||
Test that the new fast matching methods of asn and ip address
|
||||
comparisons do not return deleted objects
|
||||
"""
|
||||
|
||||
org_1 = models.Organization.objects.create(name="Test org 1")
|
||||
net_1 = models.Network.objects.create(
|
||||
org_id=org_1.id, asn=34532, name="Net 1", status="ok"
|
||||
)
|
||||
|
||||
rv = search.search("34532")
|
||||
|
||||
assert rv["net"][0]["id"] == net_1.id
|
||||
|
||||
# soft-delete network, should disappear from results
|
||||
|
||||
net_1.delete()
|
||||
rv = search.search("34532")
|
||||
|
||||
assert not rv["net"]
|
||||
|
||||
def test_search_ipv4(self):
|
||||
"""
|
||||
This will test a search for a partial ipv4 address
|
||||
"""
|
||||
org_1 = models.Organization.objects.create(name="Test org 1")
|
||||
org_2 = models.Organization.objects.create(name="Test org 2")
|
||||
net_1 = models.Network.objects.create(org_id=org_1.id, asn=34532, name="Net 1")
|
||||
net_2 = models.Network.objects.create(org_id=org_2.id, asn=2432, name="Net 2")
|
||||
ix_1 = models.InternetExchange.objects.create(org_id=org_1.id, name="IX 1")
|
||||
ix_2 = models.InternetExchange.objects.create(org_id=org_2.id, name="IX 2")
|
||||
org_1 = models.Organization.objects.create(name="Test org 1", status="ok")
|
||||
org_2 = models.Organization.objects.create(name="Test org 2", status="ok")
|
||||
net_1 = models.Network.objects.create(
|
||||
org_id=org_1.id, asn=34532, name="Net 1", status="ok"
|
||||
)
|
||||
net_2 = models.Network.objects.create(
|
||||
org_id=org_2.id, asn=2432, name="Net 2", status="ok"
|
||||
)
|
||||
ix_1 = models.InternetExchange.objects.create(
|
||||
org_id=org_1.id, name="IX 1", status="ok"
|
||||
)
|
||||
ix_2 = models.InternetExchange.objects.create(
|
||||
org_id=org_2.id, name="IX 2", status="ok"
|
||||
)
|
||||
next_id = models.IXLan.objects.all().order_by("-id").first().id + 1
|
||||
ixlan_1 = models.IXLan(id=next_id, ix=ix_1)
|
||||
ixlan_2 = models.IXLan(id=next_id + 1, ix=ix_2)
|
||||
@@ -249,6 +279,11 @@ class SearchTests(TestCase):
|
||||
|
||||
assert rv["net"][0]["id"] == net_1.id
|
||||
|
||||
# soft-delete network, should disappear from results
|
||||
net_1.delete()
|
||||
rv = search.search("8.8.4")
|
||||
assert not rv["net"]
|
||||
|
||||
# clean up
|
||||
netixlan_1.delete(hard=True)
|
||||
netixlan_2.delete(hard=True)
|
||||
@@ -267,12 +302,20 @@ class SearchTests(TestCase):
|
||||
"""
|
||||
This will test a search for a partial ipv6 address.
|
||||
"""
|
||||
org_1 = models.Organization.objects.create(name="Test org 1")
|
||||
org_2 = models.Organization.objects.create(name="Test org 2")
|
||||
net_1 = models.Network.objects.create(org_id=org_1.id, asn=34532, name="Net 1")
|
||||
net_2 = models.Network.objects.create(org_id=org_2.id, asn=2432, name="Net 2")
|
||||
ix_1 = models.InternetExchange.objects.create(org_id=org_1.id, name="IX 1")
|
||||
ix_2 = models.InternetExchange.objects.create(org_id=org_2.id, name="IX 2")
|
||||
org_1 = models.Organization.objects.create(name="Test org 1", status="ok")
|
||||
org_2 = models.Organization.objects.create(name="Test org 2", status="ok")
|
||||
net_1 = models.Network.objects.create(
|
||||
org_id=org_1.id, asn=34532, name="Net 1", status="ok"
|
||||
)
|
||||
net_2 = models.Network.objects.create(
|
||||
org_id=org_2.id, asn=2432, name="Net 2", status="ok"
|
||||
)
|
||||
ix_1 = models.InternetExchange.objects.create(
|
||||
org_id=org_1.id, name="IX 1", status="ok"
|
||||
)
|
||||
ix_2 = models.InternetExchange.objects.create(
|
||||
org_id=org_2.id, name="IX 2", status="ok"
|
||||
)
|
||||
next_id = models.IXLan.objects.all().order_by("-id").first().id + 1
|
||||
ixlan_1 = models.IXLan(id=next_id, ix=ix_1)
|
||||
ixlan_2 = models.IXLan(id=next_id + 1, ix=ix_2)
|
||||
@@ -302,6 +345,13 @@ class SearchTests(TestCase):
|
||||
|
||||
assert rv["net"][0]["id"] == net_1.id
|
||||
|
||||
# soft-delete network, should disappear from results
|
||||
|
||||
net_1.delete()
|
||||
rv = search.search("2001:4888:456")
|
||||
|
||||
assert not rv["net"]
|
||||
|
||||
# clean up
|
||||
netixlan_1.delete(hard=True)
|
||||
netixlan_2.delete(hard=True)
|
||||
|
||||
Reference in New Issue
Block a user