mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-09 19:40:19 +00:00
Fix tests
This commit is contained in:
@ -40,7 +40,6 @@ Welcome to the wiki page!
|
||||
|
||||
# Here we add a lot of test datas, that are not necessary for the Sith, but that provide a basic development environment
|
||||
if not options['prod']:
|
||||
print("Dev mode, adding some test data")
|
||||
# Adding user Skia
|
||||
s = User(username='skia', last_name="Kia", first_name="S'",
|
||||
email="skia@git.an",
|
||||
@ -95,14 +94,14 @@ Cette page vise à documenter la syntaxe *Markdown* utilisée sur le site.
|
||||
guyut = Club(name="Guy'UT", unix_name="guyut",
|
||||
address="42 de la Boustifaille", parent=ae)
|
||||
guyut.save()
|
||||
troll = Club(name="Troll Penché", unix_name="troll",
|
||||
address="Terre Du Milieu", parent=ae)
|
||||
troll.save()
|
||||
Club(name="Woenzel'UT", unix_name="woenzel",
|
||||
address="Woenzel", parent=guyut).save()
|
||||
Club(name="BdF", unix_name="bdf",
|
||||
address="Guyéuéyuéyuyé").save()
|
||||
Membership(user=s, club=ae, role=3, description="").save()
|
||||
troll = Club(name="Troll Penché", unix_name="troll",
|
||||
address="Terre Du Milieu", parent=ae)
|
||||
troll.save()
|
||||
|
||||
# Accounting test values:
|
||||
Customer(user=s, account_id="6568j").save()
|
||||
|
@ -128,24 +128,25 @@ class User(AbstractBaseUser, PermissionsMixin):
|
||||
if group_name == settings.SITH_GROUPS['public']['name']:
|
||||
return True
|
||||
if group_name == settings.SITH_MAIN_MEMBERS_GROUP: # We check the subscription if asked
|
||||
try: # TODO: change for a test in settings.INSTALLED_APP
|
||||
if 'subscription' in settings.INSTALLED_APPS:
|
||||
from subscription import Subscriber
|
||||
s = Subscriber.objects.filter(pk=self.pk).first()
|
||||
if s is not None and s.is_subscribed():
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
except Exception as e:
|
||||
print(e)
|
||||
else:
|
||||
return False
|
||||
if group_name[-6:] == settings.SITH_BOARD_SUFFIX:
|
||||
try: # TODO: change for a test in settings.INSTALLED_APP
|
||||
if 'club' in settings.INSTALLED_APPS:
|
||||
from club.models import Club
|
||||
name = group_name[:-6]
|
||||
c = Club.objects.filter(unix_name=name).first()
|
||||
return c.get_membership_for(self).role >= 2
|
||||
except Exception as e:
|
||||
print(e)
|
||||
mem = c.get_membership_for(self)
|
||||
if mem:
|
||||
return mem.role >= 2
|
||||
return False
|
||||
else:
|
||||
return False
|
||||
return self.groups.filter(name=group_name).exists()
|
||||
|
||||
|
Reference in New Issue
Block a user