1
0
mirror of https://github.com/peeringdb/peeringdb.git synced 2024-05-11 05:55:09 +00:00
* remove log file writing from migration

* run tests on mysql

* fix tests (pt.1)

* fix tests (pt.2)

* fix all user_id errors in tests

* Fix geocode typo

* More test changes for mysql id issues

* Add coverage config that defines coverage db should go inside test folder

* update docs

* fix mysql user

* fix tests cli

* add mysql collate settings

* docs

* fix sync

* fix sync

* docs

* remove debug output

* remove XXX

* interim commit to move to dev box

* mv db local, rm after run

* updates for 724

* note layer error message and work around

* fix travis

* chown tests

* more travis fixes

* travis: touch Ctl/dev/.env

* write coverage report to ./coverage

* clean up docs

* formatting

Co-authored-by: Stefan Pratter <stefan@20c.com>
Co-authored-by: Elliot Frank <elliot@20c.com>
This commit is contained in:
Matt Griswold
2020-12-03 19:10:02 +00:00
committed by GitHub
parent b2fe79cdcd
commit 299016282e
42 changed files with 494 additions and 726 deletions

View File

@@ -5,48 +5,22 @@ import uuid
from django.test import Client, TestCase, RequestFactory
from django.contrib.auth.models import Group, AnonymousUser
from django.contrib.auth import get_user
from .util import ClientCase
import django_namespace_perms as nsp
import peeringdb_server.views as views
import peeringdb_server.models as models
class ViewTestCase(TestCase):
class ViewTestCase(ClientCase):
entities = ["ix", "net", "fac"]
@classmethod
def setUpTestData(cls):
# create user and guest group
guest_group = Group.objects.create(name="guest")
user_group = Group.objects.create(name="user")
cls.guest_user = models.User.objects.create_user(
"guest", "guest@localhost", "guest"
)
cls.guest_user.set_password("guest")
guest_group.user_set.add(cls.guest_user)
nsp.models.GroupPermission.objects.create(
group=guest_group, namespace="peeringdb.organization", permissions=0x01
)
nsp.models.GroupPermission.objects.create(
group=user_group, namespace="peeringdb.organization", permissions=0x01
)
nsp.models.GroupPermission.objects.create(
group=user_group,
namespace="peeringdb.organization.*.network.*.poc_set.users",
permissions=0x01,
)
nsp.models.GroupPermission.objects.create(
group=guest_group,
namespace="peeringdb.organization.*.network.*.poc_set.public",
permissions=0x01,
)
super(ViewTestCase, cls).setUpTestData()
# create test users
for name in [
@@ -64,7 +38,7 @@ class ViewTestCase(TestCase):
models.User.objects.create_user(name, "%s@localhost" % name, name),
)
getattr(cls, name).set_password(name)
user_group.user_set.add(getattr(cls, name))
cls.user_group.user_set.add(getattr(cls, name))
# create test org
cls.org = models.Organization.objects.create(name="Test org", status="ok")
@@ -200,4 +174,4 @@ class TestNetworkView(ViewTestCase):
for q in ["as1", "asn1", "AS1", "ASN1"]:
resp = c.get(f"/search?q={q}", follow=True)
self.assertEqual(resp.status_code, 200)
self.assertEqual(resp.redirect_chain, [("/net/1", 302)])
self.assertEqual(resp.redirect_chain, [("/net/{}".format(self.net.id), 302)])