def test_claim_ownership_validation_failure(self): """ test failure to claim ownership to org via asn RiR validation """ org = models.Organization.objects.create( status="ok", name="test_claim_ownership ORG") net = models.Network.objects.create( status="ok", name="test_claim_ownership NET", asn=9000100, org=org) request = self.factory.post("/request-ownership", data={"id": org.id}) request.user = self.user_b request._dont_enforce_csrf_checks = True resp = json.loads(pdbviews.view_request_ownership(request).content) self.assertEqual(resp.get("status"), "ok") self.assertEqual(resp.get("ownership_status"), "pending") self.assertEqual( self.user_b.groups.filter(name=org.admin_usergroup.name).exists(), False)
def test_claim_ownership_validation_failure(self): """ test failure to claim ownership to org via asn RiR validation """ org = models.Organization.objects.create( status="ok", name="test_claim_ownership ORG") net = models.Network.objects.create(status="ok", name="test_claim_ownership NET", asn=9000100, org=org) request = self.factory.post("/request-ownership", data={"id": org.id}) request.user = self.user_b request._dont_enforce_csrf_checks = True resp = json.loads(pdbviews.view_request_ownership(request).content) self.assertEqual(resp.get("status"), "ok") self.assertEqual(resp.get("ownership_status"), "pending") self.assertEqual( self.user_b.groups.filter(name=org.admin_usergroup.name).exists(), False)