forked from DGNum/gestioCOF
Some renamings gestioncof -> cof
The tests fail for an obscure reason: django.db.utils.OperationalError: no such column: cof_cofprofile.num
This commit is contained in:
parent
36827cef6b
commit
0162f431d4
10 changed files with 22 additions and 29 deletions
|
@ -2,10 +2,6 @@
|
|||
|
||||
{% block realcontent %}
|
||||
<h2>Inscription d'un nouveau membre</h2>
|
||||
{% if success %}
|
||||
<p class="success">L'inscription de {{ member.first_name }} {{ member.last_name }} (<tt>{{ member.username }}</tt>) a été enregistrée avec succès.
|
||||
{% if member.profile.is_cof %}Il est désormais membre du COF n°{{ member.profile.num }} !{% endif %}</p>
|
||||
{% endif %}
|
||||
<div id="form-placeholder">
|
||||
{% include "cof/registration_form.html" %}
|
||||
</div>
|
||||
|
|
|
@ -604,7 +604,7 @@ def calendar_ics(request, token):
|
|||
|
||||
class ConfigUpdate(FormView):
|
||||
form_class = GestioncofConfigForm
|
||||
template_name = "gestioncof/banner_update.html"
|
||||
template_name = "cof/banner_update.html"
|
||||
success_url = reverse_lazy("home")
|
||||
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
|
|
|
@ -192,7 +192,7 @@ CAS_EMAIL_FORMAT = "%s@clipper.ens.fr"
|
|||
|
||||
AUTHENTICATION_BACKENDS = (
|
||||
'django.contrib.auth.backends.ModelBackend',
|
||||
'gestioncof.shared.COFCASBackend',
|
||||
'gestion.shared.COFCASBackend',
|
||||
'kfet.auth.backends.GenericBackend',
|
||||
)
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ class GenericBackendTests(TestCase):
|
|||
class GenericLoginViewTests(TestCase):
|
||||
|
||||
def setUp(self):
|
||||
patcher_messages = mock.patch('gestioncof.signals.messages')
|
||||
patcher_messages = mock.patch('cof.signals.messages')
|
||||
patcher_messages.start()
|
||||
self.addCleanup(patcher_messages.stop)
|
||||
|
||||
|
@ -280,7 +280,7 @@ class GenericLoginViewTests(TestCase):
|
|||
class TemporaryAuthTests(TestCase):
|
||||
|
||||
def setUp(self):
|
||||
patcher_messages = mock.patch('gestioncof.signals.messages')
|
||||
patcher_messages = mock.patch('cof.signals.messages')
|
||||
patcher_messages.start()
|
||||
self.addCleanup(patcher_messages.stop)
|
||||
|
||||
|
|
|
@ -12,11 +12,9 @@ from django.core.management import call_command
|
|||
|
||||
from cof.management.base import MyBaseCommand
|
||||
from gestion.models import Profile
|
||||
from kfet.models import Account, Article, OperationGroup, Operation, Checkout
|
||||
from gestioncof.management.base import MyBaseCommand
|
||||
from gestioncof.models import CofProfile
|
||||
from kfet.models import (Account, Checkout, CheckoutStatement, Supplier,
|
||||
SupplierArticle, Article)
|
||||
from kfet.models import (
|
||||
Account, Article, Checkout, CheckoutStatement, Supplier, SupplierArticle
|
||||
)
|
||||
|
||||
# Où sont stockés les fichiers json
|
||||
DATA_DIR = os.path.join(os.path.dirname(os.path.dirname(__file__)),
|
||||
|
@ -99,11 +97,11 @@ class Command(MyBaseCommand):
|
|||
|
||||
# Root account if existing
|
||||
|
||||
root_profile = CofProfile.objects.filter(user__username='root')
|
||||
root_profile = Profile.objects.filter(user__username='root')
|
||||
if root_profile.exists():
|
||||
self.stdout.write("Création du compte K-Fêt root")
|
||||
root_profile = root_profile.get()
|
||||
Account.objects.get_or_create(cofprofile=root_profile,
|
||||
Account.objects.get_or_create(profile=root_profile,
|
||||
trigramme='AAA')
|
||||
|
||||
# ---
|
||||
|
|
|
@ -120,7 +120,7 @@ class OpenKfetViewsTest(ChannelTestCase):
|
|||
|
||||
def setUp(self):
|
||||
# Need this (and here) because of '<client>.login' in setUp
|
||||
patcher_messages = mock.patch('gestioncof.signals.messages')
|
||||
patcher_messages = mock.patch('cof.signals.messages')
|
||||
patcher_messages.start()
|
||||
self.addCleanup(patcher_messages.stop)
|
||||
|
||||
|
@ -200,7 +200,7 @@ class OpenKfetConsumerTest(ChannelTestCase):
|
|||
OpenKfetConsumer.group_send('kfet.open.team', {'test': 'plop'})
|
||||
self.assertIsNone(c.receive())
|
||||
|
||||
@mock.patch('gestioncof.signals.messages')
|
||||
@mock.patch('cof.signals.messages')
|
||||
def test_team_user(self, mock_messages):
|
||||
"""Team user is added to kfet.open.team group."""
|
||||
# setup team user and its client
|
||||
|
@ -232,7 +232,7 @@ class OpenKfetScenarioTest(ChannelTestCase):
|
|||
|
||||
def setUp(self):
|
||||
# Need this (and here) because of '<client>.login' in setUp
|
||||
patcher_messages = mock.patch('gestioncof.signals.messages')
|
||||
patcher_messages = mock.patch('cof.signals.messages')
|
||||
patcher_messages.start()
|
||||
self.addCleanup(patcher_messages.stop)
|
||||
|
||||
|
|
|
@ -1,16 +1,15 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import djconfig
|
||||
from decimal import Decimal
|
||||
|
||||
from django.contrib.auth import get_user_model
|
||||
from django.test import TestCase
|
||||
from django.utils import timezone
|
||||
|
||||
import djconfig
|
||||
|
||||
from gestioncof.models import User
|
||||
from kfet.config import kfet_config
|
||||
from kfet.models import Account
|
||||
|
||||
User = get_user_model()
|
||||
|
||||
|
||||
class ConfigTest(TestCase):
|
||||
"""Tests suite for kfet configuration."""
|
||||
|
|
|
@ -10,7 +10,7 @@ from kfet.models import Account, Article, ArticleCategory
|
|||
|
||||
class TestStats(TestCase):
|
||||
|
||||
@patch('gestioncof.signals.messages')
|
||||
@patch('cof.signals.messages')
|
||||
def test_user_stats(self, mock_messages):
|
||||
"""
|
||||
Checks that we can get the stat-related pages without any problem.
|
||||
|
|
|
@ -3,7 +3,7 @@ from django.contrib.auth.models import Permission
|
|||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.test import TestCase
|
||||
|
||||
from gestioncof.models import CofProfile
|
||||
from cof.models import CofProfile
|
||||
|
||||
from ..models import Account
|
||||
from .testcases import TestCaseMixin
|
||||
|
@ -76,17 +76,17 @@ class PermHelpersTest(TestCaseMixin, TestCase):
|
|||
)
|
||||
|
||||
def test_get_perms(self):
|
||||
perms = get_perms('kfet.test_perm', 'gestioncof.another_test_perm')
|
||||
perms = get_perms('kfet.test_perm', 'cof.another_test_perm')
|
||||
self.assertDictEqual(perms, {
|
||||
'kfet.test_perm': self.perm1,
|
||||
'gestioncof.another_test_perm': self.perm2,
|
||||
'cof.another_test_perm': self.perm2,
|
||||
})
|
||||
|
||||
def test_user_add_perms(self):
|
||||
user = User.objects.create_user(username='user', password='user')
|
||||
user.user_permissions.add(self.perm1)
|
||||
|
||||
user_add_perms(user, ['kfet.is_team', 'gestioncof.another_test_perm'])
|
||||
user_add_perms(user, ['kfet.is_team', 'cof.another_test_perm'])
|
||||
|
||||
self.assertQuerysetEqual(
|
||||
user.user_permissions.all(),
|
||||
|
|
|
@ -228,7 +228,7 @@ class ViewTestCaseMixin(TestCaseMixin):
|
|||
# Signals handlers on login/logout send messages.
|
||||
# Due to the way the Django' test Client performs login, this raise an
|
||||
# error. As workaround, we mock the Django' messages module.
|
||||
patcher_messages = mock.patch('gestioncof.signals.messages')
|
||||
patcher_messages = mock.patch('cof.signals.messages')
|
||||
patcher_messages.start()
|
||||
self.addCleanup(patcher_messages.stop)
|
||||
|
||||
|
|
Loading…
Reference in a new issue