1
0
mirror of https://github.com/peeringdb/peeringdb.git synced 2024-05-11 05:55:09 +00:00

advanced search fixes (#984)

* fix advanced search error when not logged in

* fix error with data/my_organizations if user is not logged in

* fix 500 error when viewing advanced search as a user that is not affiliated with any org

* tests for adv search init and anonymous data/my_organizations request

Co-authored-by: Stefan Pratter <stefan@20c.com>
This commit is contained in:
Matt Griswold
2021-05-26 01:33:55 -04:00
committed by GitHub
parent 207ad371c0
commit de413ef1f6
4 changed files with 38 additions and 0 deletions

View File

@@ -1,5 +1,6 @@
import pytest
from rest_framework.test import APIClient
from django.test import Client
from peeringdb_server.models import (
Network,
@@ -113,3 +114,22 @@ def test_affiliate_to_nonexisting_org_multiple(client):
response = client.post(URL, other_data)
assert response.status_code == 200
assert UserOrgAffiliationRequest.objects.count() == 2
@pytest.mark.django_db
def test_adv_search_init():
client = Client()
response = client.get("/advanced_search")
assert response.status_code == 200
user = User.objects.create(
username="test",
email="test@localhost",
)
user.set_password("test1234")
user.save()
client.login(username="test", password="test1234")
response = client.get("/advanced_search")
assert response.status_code == 200