mirror of
https://github.com/peeringdb/peeringdb.git
synced 2024-05-11 05:55:09 +00:00
* Add pointer from API docs to tutorial #650 * Sorting by clicking table headers should use local-compare #356 * Mark IXP peering LAN as bogon #352 * Add help text to "Add (Facility, Network, Exchange)" tab #669 * Add Looking Glass field to the IX object #672 * Add read-only Superuser #679 * Make spelling of traffic levels consistent #519 (#723) * Offer 2FA (#290) * Show "Last Updated" fields on fac, ix, org records (#526) * Enable sort and reverse sort of IP column in IX display (#72) * IRR validation not handling unexpected characters gracefully (#712) * Support alternative direction of writing, e.g. Arabic (#618) * Undeleting an ixlan with an emtpy IPv4 XOR IPv6 field throws a silly error (#644) * Changing org while adding net results in 500 #654 * missing delete button for organisations (#121) * When changing owner of an ix admin GUI borks because of "Ixlan for exchange already exists" #666 * Selection should only present undeleted objects (#664) * change default encoding of API calls to 'utf-8' #663 * Posting https://www.peeringdb.com onto social media doesn't select a good preview image #537 * Revert "Add Looking Glass field to the IX object #672" This reverts commit 4daf2520043c241fabe9a521757efa86a274e28a. Conflicts: peeringdb_server/migrations/0037_ix_looking_glass.py peeringdb_server/views.py * 500 Internal Error when creating IX where prefix already exists elsewhere #718 * Fix graceful restore of soft-deleted objects with translation active (#580) * Don't return any POC data with status=deleted #569 Hard delete soft-deleted pocs after grace period #566 * django-peeringdb from github@2.0.0.2-beta Co-authored-by: Stefan Pratter <stefan@20c.com>
59 lines
2.0 KiB
Python
59 lines
2.0 KiB
Python
from django.test import TestCase
|
|
from django.contrib.auth import get_user_model
|
|
from django.conf import settings
|
|
|
|
|
|
from .util import SettingsCase
|
|
from peeringdb_server import signals, models, serializers
|
|
from peeringdb_server import settings as pdb_settings
|
|
|
|
|
|
class TestAutoVerifyUser(SettingsCase):
|
|
settings = {"AUTO_VERIFY_USERS": True}
|
|
|
|
def test_setting(self):
|
|
user = get_user_model().objects.create_user(
|
|
"user_a", "user_a@localhost", "user_a"
|
|
)
|
|
signals.new_user_to_guests(None, user)
|
|
assert user.is_verified_user == True
|
|
assert user.status == "ok"
|
|
|
|
|
|
class TestAutoApproveAffiliation(SettingsCase):
|
|
settings = {"AUTO_APPROVE_AFFILIATION": True}
|
|
|
|
def test_setting(self):
|
|
|
|
org = models.Organization.objects.create(name="Test Org", status="ok")
|
|
net = models.Network.objects.create(
|
|
name="Test Net", org=org, asn=63311, status="ok"
|
|
)
|
|
user = get_user_model().objects.create_user(
|
|
"user_a", "user_a@localhost", "user_a"
|
|
)
|
|
user_b = get_user_model().objects.create_user(
|
|
"user_b", "user_b@localhost", "user_b"
|
|
)
|
|
user.set_verified()
|
|
user_b.set_verified()
|
|
|
|
uoar = models.UserOrgAffiliationRequest.objects.create(
|
|
user=user, org=org, asn=net.asn
|
|
)
|
|
assert user.is_org_admin(org) == True
|
|
|
|
uoar = models.UserOrgAffiliationRequest.objects.create(user=user, asn=63312)
|
|
net = models.Network.objects.get(asn=63312)
|
|
assert user.is_org_admin(net.org) == True
|
|
|
|
uoar = models.UserOrgAffiliationRequest.objects.create(
|
|
user=user, org_name="Test Org 2"
|
|
)
|
|
org = models.Organization.objects.get(name="Test Org 2")
|
|
assert user.is_org_admin(org) == True
|
|
|
|
uoar = models.UserOrgAffiliationRequest.objects.create(user=user_b, asn=63312)
|
|
assert user_b.is_org_admin(net.org) == False
|
|
assert user_b.is_org_member(net.org) == False
|