mirror of
				https://github.com/peeringdb/peeringdb.git
				synced 2024-05-11 05:55:09 +00:00 
			
		
		
		
	Support 202108 (#1051)
* add OPERATIONS_EMAIL setting * fixes #1019: redundant saves to deleted netixlans during ix-f import * private pocs are no longer valid (#944) * poetry relock (handleref update) * fixes #1032: __id api filter not working * Additional self-selection fields for Facilities #800 * advanced search fields for available voltage, property and diverse serving substations (#1016) * When network sets netixlan speed to 1200000 only 1T is shown instead of 1.2T ... sometimes #500 * add search-data * comment out mount points for api-cache, search-data, django-peeringdb * poetry relock (django-peeringdb 2.9.0) * linting Co-authored-by: Stefan Pratter <stefan@20c.com>
This commit is contained in:
		@@ -29,6 +29,7 @@ from peeringdb_server.models import (
 | 
			
		||||
        "POLICY_CONTRACTS",
 | 
			
		||||
        "REGIONS",
 | 
			
		||||
        "POC_ROLES",
 | 
			
		||||
        "POC_VISIBILITY",
 | 
			
		||||
        "MEDIA",
 | 
			
		||||
        "PROTOCOLS",
 | 
			
		||||
        "ORG_GROUPS",
 | 
			
		||||
 
 | 
			
		||||
@@ -2789,6 +2789,107 @@ def test_send_email(entities, use_ip):
 | 
			
		||||
    assert importer.emails == 2
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@pytest.mark.django_db
 | 
			
		||||
def test_ixlan_add_netixlan_no_redundant_save_on_null_ip(entities):
 | 
			
		||||
 | 
			
		||||
    """
 | 
			
		||||
    Tests that if ixlan.add_netixlan receives a netixlan which
 | 
			
		||||
    has either ipaddr4 or ipaddr6 nulled will not cause redundant
 | 
			
		||||
    saves to already deleted netixlans that also have that same field
 | 
			
		||||
    nulled (#1019)
 | 
			
		||||
    """
 | 
			
		||||
 | 
			
		||||
    network = entities["net"]["UPDATE_ENABLED"]
 | 
			
		||||
    ixlan = entities["ixlan"][0]
 | 
			
		||||
 | 
			
		||||
    # create deleted netixlans
 | 
			
		||||
 | 
			
		||||
    with reversion.create_revision():
 | 
			
		||||
        NetworkIXLan.objects.create(
 | 
			
		||||
            ixlan=ixlan,
 | 
			
		||||
            network=network,
 | 
			
		||||
            asn=network.asn + 1,
 | 
			
		||||
            ipaddr4="195.69.147.253",
 | 
			
		||||
            ipaddr6="2001:7f8:1::a500:2906:10",
 | 
			
		||||
            speed=1000,
 | 
			
		||||
            status="deleted",
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
        NetworkIXLan.objects.create(
 | 
			
		||||
            ixlan=ixlan,
 | 
			
		||||
            network=network,
 | 
			
		||||
            asn=network.asn + 1,
 | 
			
		||||
            ipaddr4="195.69.147.252",
 | 
			
		||||
            ipaddr6="2001:7f8:1::a500:2906:11",
 | 
			
		||||
            speed=1000,
 | 
			
		||||
            status="deleted",
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
        netixlan6 = NetworkIXLan.objects.create(
 | 
			
		||||
            ixlan=ixlan,
 | 
			
		||||
            network=network,
 | 
			
		||||
            asn=network.asn + 1,
 | 
			
		||||
            ipaddr4=None,
 | 
			
		||||
            ipaddr6="2001:7f8:1::a500:2906:9",
 | 
			
		||||
            speed=1000,
 | 
			
		||||
            status="deleted",
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
        netixlan4 = NetworkIXLan.objects.create(
 | 
			
		||||
            ixlan=ixlan,
 | 
			
		||||
            network=network,
 | 
			
		||||
            asn=network.asn + 1,
 | 
			
		||||
            ipaddr4="195.69.147.251",
 | 
			
		||||
            ipaddr6=None,
 | 
			
		||||
            speed=1000,
 | 
			
		||||
            status="deleted",
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
    netixlan4.refresh_from_db()
 | 
			
		||||
    netixlan6.refresh_from_db()
 | 
			
		||||
 | 
			
		||||
    assert netixlan4.version == 1
 | 
			
		||||
    assert netixlan6.version == 1
 | 
			
		||||
 | 
			
		||||
    # create netixlans
 | 
			
		||||
 | 
			
		||||
    netixlan6_new = NetworkIXLan(
 | 
			
		||||
        ixlan=ixlan,
 | 
			
		||||
        network=network,
 | 
			
		||||
        asn=network.asn,
 | 
			
		||||
        ipaddr4=None,
 | 
			
		||||
        ipaddr6="2001:7f8:1::a500:2906:10",
 | 
			
		||||
        speed=1000,
 | 
			
		||||
        status="deleted",
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
    netixlan4_new = NetworkIXLan(
 | 
			
		||||
        ixlan=ixlan,
 | 
			
		||||
        network=network,
 | 
			
		||||
        asn=network.asn,
 | 
			
		||||
        ipaddr4="195.69.147.252",
 | 
			
		||||
        ipaddr6=None,
 | 
			
		||||
        speed=1000,
 | 
			
		||||
        status="deleted",
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
    with reversion.create_revision():
 | 
			
		||||
        netixlan6_new = ixlan.add_netixlan(netixlan6_new)
 | 
			
		||||
        netixlan4_new = ixlan.add_netixlan(netixlan4_new)
 | 
			
		||||
 | 
			
		||||
    netixlan4.refresh_from_db()
 | 
			
		||||
    netixlan6.refresh_from_db()
 | 
			
		||||
 | 
			
		||||
    # No further saves should have happened to the already
 | 
			
		||||
    # deleted netixlans
 | 
			
		||||
 | 
			
		||||
    assert not netixlan4.notes
 | 
			
		||||
    assert not netixlan6.notes
 | 
			
		||||
 | 
			
		||||
    assert netixlan4.version == 1
 | 
			
		||||
    assert netixlan6.version == 1
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# FIXTURES
 | 
			
		||||
@pytest.fixture(params=[True, False])
 | 
			
		||||
def save(request):
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,7 @@
 | 
			
		||||
import os
 | 
			
		||||
 | 
			
		||||
import pytest
 | 
			
		||||
from allauth.account.signals import email_confirmed, user_signed_up
 | 
			
		||||
from django.conf import settings
 | 
			
		||||
from django.contrib.auth import get_user_model
 | 
			
		||||
from django.test import TestCase
 | 
			
		||||
@@ -8,7 +9,6 @@ from django.test import TestCase
 | 
			
		||||
from mainsite.settings import _set_bool, _set_option
 | 
			
		||||
from peeringdb_server import models, serializers
 | 
			
		||||
from peeringdb_server import settings as pdb_settings
 | 
			
		||||
from allauth.account.signals import email_confirmed, user_signed_up
 | 
			
		||||
 | 
			
		||||
from .util import SettingsCase
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
import re
 | 
			
		||||
 | 
			
		||||
import pytest
 | 
			
		||||
from django.test import Client
 | 
			
		||||
from rest_framework.test import APIClient
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user