Remove bank, Kfet and add BDA and BDS (need to fix activity, permission and registration)
This commit is contained in:
parent
3a3e3be64c
commit
838bd2bb23
43 changed files with 128 additions and 639 deletions
|
|
@ -1,4 +1,4 @@
|
|||
# Generated by Django 2.2.16 on 2020-09-04 21:41
|
||||
# Generated by Django 2.2.28 on 2022-08-17 20:53
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ from django.utils.crypto import get_random_string
|
|||
from activity.models import Activity
|
||||
from member.models import Club, Membership
|
||||
from note.models import NoteUser
|
||||
from wei.models import WEIClub, Bus, WEIRegistration
|
||||
|
||||
|
||||
class TestPermissionDenied(TestCase):
|
||||
|
|
@ -79,56 +78,6 @@ class TestPermissionDenied(TestCase):
|
|||
response = self.client.get(reverse("member:club_renew_membership", kwargs=dict(pk=membership.pk)))
|
||||
self.assertEqual(response.status_code, 403)
|
||||
|
||||
def test_create_weiclub(self):
|
||||
response = self.client.get(reverse("wei:wei_create"))
|
||||
self.assertEqual(response.status_code, 403)
|
||||
|
||||
def test_create_wei_bus(self):
|
||||
wei = WEIClub.objects.create(
|
||||
membership_start=date.today(),
|
||||
date_start=date.today() + timedelta(days=1),
|
||||
date_end=date.today() + timedelta(days=1),
|
||||
)
|
||||
response = self.client.get(reverse("wei:add_bus", kwargs=dict(pk=wei.pk)))
|
||||
self.assertEqual(response.status_code, 403)
|
||||
|
||||
def test_create_wei_team(self):
|
||||
wei = WEIClub.objects.create(
|
||||
membership_start=date.today(),
|
||||
date_start=date.today() + timedelta(days=1),
|
||||
date_end=date.today() + timedelta(days=1),
|
||||
)
|
||||
bus = Bus.objects.create(wei=wei)
|
||||
response = self.client.get(reverse("wei:add_team", kwargs=dict(pk=bus.pk)))
|
||||
self.assertEqual(response.status_code, 403)
|
||||
|
||||
def test_create_1a_weiregistration(self):
|
||||
wei = WEIClub.objects.create(
|
||||
membership_start=date.today(),
|
||||
date_start=date.today() + timedelta(days=1),
|
||||
date_end=date.today() + timedelta(days=1),
|
||||
)
|
||||
response = self.client.get(reverse("wei:wei_register_1A", kwargs=dict(wei_pk=wei.pk)))
|
||||
self.assertEqual(response.status_code, 403)
|
||||
|
||||
def test_create_old_weiregistration(self):
|
||||
wei = WEIClub.objects.create(
|
||||
membership_start=date.today(),
|
||||
date_start=date.today() + timedelta(days=1),
|
||||
date_end=date.today() + timedelta(days=1),
|
||||
)
|
||||
response = self.client.get(reverse("wei:wei_register_2A", kwargs=dict(wei_pk=wei.pk)))
|
||||
self.assertEqual(response.status_code, 403)
|
||||
|
||||
def test_validate_weiregistration(self):
|
||||
wei = WEIClub.objects.create(
|
||||
membership_start=date.today(),
|
||||
date_start=date.today() + timedelta(days=1),
|
||||
date_end=date.today() + timedelta(days=1),
|
||||
)
|
||||
registration = WEIRegistration.objects.create(wei=wei, user=self.user, birth_date="2000-01-01")
|
||||
response = self.client.get(reverse("wei:validate_registration", kwargs=dict(pk=registration.pk)))
|
||||
self.assertEqual(response.status_code, 403)
|
||||
|
||||
def test_create_invoice(self):
|
||||
response = self.client.get(reverse("treasury:invoice_create"))
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ from django.test import TestCase
|
|||
from django.utils import timezone
|
||||
from member.models import Club, Membership
|
||||
from note.models import NoteUser, Note, NoteClub, NoteSpecial
|
||||
from wei.models import WEIMembership, WEIRegistration, WEIClub, Bus, BusTeam
|
||||
|
||||
|
||||
from ..models import Permission
|
||||
|
||||
|
|
@ -23,44 +23,16 @@ class PermissionQueryTestCase(TestCase):
|
|||
def setUpTestData(cls):
|
||||
user = User.objects.create(username="user")
|
||||
NoteUser.objects.create(user=user)
|
||||
wei = WEIClub.objects.create(
|
||||
name="wei",
|
||||
date_start=date.today(),
|
||||
date_end=date.today(),
|
||||
)
|
||||
NoteClub.objects.create(club=wei)
|
||||
weiregistration = WEIRegistration.objects.create(
|
||||
user=user,
|
||||
wei=wei,
|
||||
birth_date=date.today(),
|
||||
)
|
||||
bus = Bus.objects.create(
|
||||
name="bus",
|
||||
wei=wei,
|
||||
)
|
||||
team = BusTeam.objects.create(
|
||||
name="team",
|
||||
bus=bus,
|
||||
color=0xFFFFFF,
|
||||
)
|
||||
WEIMembership.objects.create(
|
||||
user=user,
|
||||
club=wei,
|
||||
registration=weiregistration,
|
||||
bus=bus,
|
||||
team=team,
|
||||
)
|
||||
|
||||
def test_permission_queries(self):
|
||||
"""
|
||||
Check for all permissions that the query is compilable and that the database can parse the query.
|
||||
We use a random user with a random WEIClub (to use permissions for the WEI) in a random team in a random bus.
|
||||
We use a random user.
|
||||
"""
|
||||
for perm in Permission.objects.all():
|
||||
try:
|
||||
instanced = perm.about(
|
||||
user=User.objects.get(),
|
||||
club=WEIClub.objects.get(),
|
||||
membership=Membership.objects.get(),
|
||||
User=User,
|
||||
Club=Club,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue