mirror of
https://github.com/peeringdb/peeringdb.git
synced 2024-05-11 05:55:09 +00:00
Support 202106 (#994)
* fixes #965: intermittent bug during consolidation of notifications * fixes #863: better visibility for input validation errors * fixes #375: re-evaluate affiliation requests on email change * fixes #741: remove data quality validation for superusers * fixes #587: customizable pagination in django admin * fixes #923: Prevent deletion of a last technical contact if there is an existing netixlan object * better search #23 (first pass) * black format * haystack test config to run_tests.py remove old django_init.py test settings * black format * haystack test config fixes * #23 better search (pt.2) * rate limit distance queries (#23) rate limiting based on query filters * settings controlled blocking of distance filter for unauthenticated / unverified users (#23) * fix distance filter throttling with api key auth (#23) * fix anon user access check on distance queries * search index and performance tweaks * fix org_id not set in search results * org id to int Co-authored-by: Stefan Pratter <stefan@20c.com>
This commit is contained in:
@@ -227,6 +227,42 @@ class AsnAutomationTestCase(TestCase):
|
||||
self.assertEqual(net.status, "ok")
|
||||
self.assertEqual(net.org.status, "ok")
|
||||
|
||||
def test_reevaluate(self):
|
||||
"""
|
||||
tests re-check of affiliation requests
|
||||
"""
|
||||
asn_ok = 9000001
|
||||
|
||||
reset_group_ids()
|
||||
|
||||
# test 1: test affiliation to asn that has RiR entry and user relationship
|
||||
# cannot be verified (ASN 9000002)
|
||||
request = self.factory.post("/affiliate-to-org", data={"asn": asn_ok})
|
||||
request.user = self.user_b
|
||||
request._dont_enforce_csrf_checks = True
|
||||
resp = json.loads(pdbviews.view_affiliate_to_org(request).content)
|
||||
self.assertEqual(resp.get("status"), "ok")
|
||||
|
||||
net = models.Network.objects.get(asn=asn_ok)
|
||||
|
||||
assert not net.org.admin_usergroup.user_set.filter(id=self.user_b.id).exists()
|
||||
|
||||
# simulate email change
|
||||
old_email = self.user_b.email
|
||||
self.user_b.email = self.user_a.email
|
||||
self.user_b.save()
|
||||
|
||||
self.user_b.recheck_affiliation_requests()
|
||||
|
||||
ticket = models.DeskProTicket.objects.get(
|
||||
subject=f"[{settings.RELEASE_ENV}] [ASNAUTO] Ownership claim granted to Org 'ORG AS{asn_ok}' for user 'user_b'"
|
||||
)
|
||||
|
||||
assert net.org.admin_usergroup.user_set.filter(id=self.user_b.id).exists()
|
||||
|
||||
self.user_b.email = old_email
|
||||
self.user_b.save()
|
||||
|
||||
def test_affiliate_limit(self):
|
||||
"""
|
||||
test affiliation request limit (fail when there is n pending
|
||||
|
Reference in New Issue
Block a user