mirror of
https://github.com/peeringdb/peeringdb.git
synced 2024-05-11 05:55:09 +00:00
handle bogon asns (#419)
This commit is contained in:
@ -27,6 +27,7 @@ from peeringdb_server.models import (
|
||||
IXLanPrefix, InternetExchangeFacility)
|
||||
|
||||
from peeringdb_server.serializers import REFTAG_MAP as REFTAG_MAP_SLZ
|
||||
from peeringdb_server import inet, settings as pdb_settings
|
||||
|
||||
START_TIMESTAMP = time.time()
|
||||
|
||||
@ -1033,6 +1034,32 @@ class TestJSON(unittest.TestCase):
|
||||
|
||||
##########################################################################
|
||||
|
||||
def test_org_admin_002_POST_net_bogon_asn(self):
|
||||
|
||||
# Test bogon asn failure
|
||||
|
||||
data = self.make_data_net()
|
||||
for bogon_asn in inet.BOGON_ASN_RANGES:
|
||||
r_data = self.assert_create(
|
||||
self.db_org_admin, "net", data,
|
||||
test_failures={"invalid": {
|
||||
"asn": bogon_asn[0]
|
||||
}}, test_success=False)
|
||||
|
||||
# server running in tutorial mode should be allowed
|
||||
# to create networks with bogon asns, so we test that
|
||||
# as well
|
||||
|
||||
pdb_settings.TUTORIAL_MODE = True
|
||||
|
||||
for bogon_asn in inet.BOGON_ASN_RANGES:
|
||||
data = self.make_data_net(asn=bogon_asn[0])
|
||||
r_data = self.assert_create(self.db_org_admin, "net", data)
|
||||
|
||||
pdb_settings.TUTORIAL_MODE = False
|
||||
|
||||
##########################################################################
|
||||
|
||||
def test_org_admin_002_PUT_net_write_only_fields(self):
|
||||
"""
|
||||
with this we check that certain fields that are allowed to be
|
||||
|
Reference in New Issue
Block a user