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:
Martin Pépin 2017-10-26 11:38:11 +02:00
parent 36827cef6b
commit 0162f431d4
10 changed files with 22 additions and 29 deletions

View file

@ -2,10 +2,6 @@
{% block realcontent %} {% block realcontent %}
<h2>Inscription d'un nouveau membre</h2> <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"> <div id="form-placeholder">
{% include "cof/registration_form.html" %} {% include "cof/registration_form.html" %}
</div> </div>

View file

@ -604,7 +604,7 @@ def calendar_ics(request, token):
class ConfigUpdate(FormView): class ConfigUpdate(FormView):
form_class = GestioncofConfigForm form_class = GestioncofConfigForm
template_name = "gestioncof/banner_update.html" template_name = "cof/banner_update.html"
success_url = reverse_lazy("home") success_url = reverse_lazy("home")
def dispatch(self, request, *args, **kwargs): def dispatch(self, request, *args, **kwargs):

View file

@ -192,7 +192,7 @@ CAS_EMAIL_FORMAT = "%s@clipper.ens.fr"
AUTHENTICATION_BACKENDS = ( AUTHENTICATION_BACKENDS = (
'django.contrib.auth.backends.ModelBackend', 'django.contrib.auth.backends.ModelBackend',
'gestioncof.shared.COFCASBackend', 'gestion.shared.COFCASBackend',
'kfet.auth.backends.GenericBackend', 'kfet.auth.backends.GenericBackend',
) )

View file

@ -135,7 +135,7 @@ class GenericBackendTests(TestCase):
class GenericLoginViewTests(TestCase): class GenericLoginViewTests(TestCase):
def setUp(self): def setUp(self):
patcher_messages = mock.patch('gestioncof.signals.messages') patcher_messages = mock.patch('cof.signals.messages')
patcher_messages.start() patcher_messages.start()
self.addCleanup(patcher_messages.stop) self.addCleanup(patcher_messages.stop)
@ -280,7 +280,7 @@ class GenericLoginViewTests(TestCase):
class TemporaryAuthTests(TestCase): class TemporaryAuthTests(TestCase):
def setUp(self): def setUp(self):
patcher_messages = mock.patch('gestioncof.signals.messages') patcher_messages = mock.patch('cof.signals.messages')
patcher_messages.start() patcher_messages.start()
self.addCleanup(patcher_messages.stop) self.addCleanup(patcher_messages.stop)

View file

@ -12,11 +12,9 @@ from django.core.management import call_command
from cof.management.base import MyBaseCommand from cof.management.base import MyBaseCommand
from gestion.models import Profile from gestion.models import Profile
from kfet.models import Account, Article, OperationGroup, Operation, Checkout from kfet.models import (
from gestioncof.management.base import MyBaseCommand Account, Article, Checkout, CheckoutStatement, Supplier, SupplierArticle
from gestioncof.models import CofProfile )
from kfet.models import (Account, Checkout, CheckoutStatement, Supplier,
SupplierArticle, Article)
# Où sont stockés les fichiers json # Où sont stockés les fichiers json
DATA_DIR = os.path.join(os.path.dirname(os.path.dirname(__file__)), DATA_DIR = os.path.join(os.path.dirname(os.path.dirname(__file__)),
@ -99,11 +97,11 @@ class Command(MyBaseCommand):
# Root account if existing # Root account if existing
root_profile = CofProfile.objects.filter(user__username='root') root_profile = Profile.objects.filter(user__username='root')
if root_profile.exists(): if root_profile.exists():
self.stdout.write("Création du compte K-Fêt root") self.stdout.write("Création du compte K-Fêt root")
root_profile = root_profile.get() root_profile = root_profile.get()
Account.objects.get_or_create(cofprofile=root_profile, Account.objects.get_or_create(profile=root_profile,
trigramme='AAA') trigramme='AAA')
# --- # ---

View file

@ -120,7 +120,7 @@ class OpenKfetViewsTest(ChannelTestCase):
def setUp(self): def setUp(self):
# Need this (and here) because of '<client>.login' in setUp # 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() patcher_messages.start()
self.addCleanup(patcher_messages.stop) self.addCleanup(patcher_messages.stop)
@ -200,7 +200,7 @@ class OpenKfetConsumerTest(ChannelTestCase):
OpenKfetConsumer.group_send('kfet.open.team', {'test': 'plop'}) OpenKfetConsumer.group_send('kfet.open.team', {'test': 'plop'})
self.assertIsNone(c.receive()) self.assertIsNone(c.receive())
@mock.patch('gestioncof.signals.messages') @mock.patch('cof.signals.messages')
def test_team_user(self, mock_messages): def test_team_user(self, mock_messages):
"""Team user is added to kfet.open.team group.""" """Team user is added to kfet.open.team group."""
# setup team user and its client # setup team user and its client
@ -232,7 +232,7 @@ class OpenKfetScenarioTest(ChannelTestCase):
def setUp(self): def setUp(self):
# Need this (and here) because of '<client>.login' in setUp # 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() patcher_messages.start()
self.addCleanup(patcher_messages.stop) self.addCleanup(patcher_messages.stop)

View file

@ -1,16 +1,15 @@
# -*- coding: utf-8 -*- import djconfig
from decimal import Decimal from decimal import Decimal
from django.contrib.auth import get_user_model
from django.test import TestCase from django.test import TestCase
from django.utils import timezone from django.utils import timezone
import djconfig
from gestioncof.models import User
from kfet.config import kfet_config from kfet.config import kfet_config
from kfet.models import Account from kfet.models import Account
User = get_user_model()
class ConfigTest(TestCase): class ConfigTest(TestCase):
"""Tests suite for kfet configuration.""" """Tests suite for kfet configuration."""

View file

@ -10,7 +10,7 @@ from kfet.models import Account, Article, ArticleCategory
class TestStats(TestCase): class TestStats(TestCase):
@patch('gestioncof.signals.messages') @patch('cof.signals.messages')
def test_user_stats(self, mock_messages): def test_user_stats(self, mock_messages):
""" """
Checks that we can get the stat-related pages without any problem. Checks that we can get the stat-related pages without any problem.

View file

@ -3,7 +3,7 @@ from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django.test import TestCase from django.test import TestCase
from gestioncof.models import CofProfile from cof.models import CofProfile
from ..models import Account from ..models import Account
from .testcases import TestCaseMixin from .testcases import TestCaseMixin
@ -76,17 +76,17 @@ class PermHelpersTest(TestCaseMixin, TestCase):
) )
def test_get_perms(self): 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, { self.assertDictEqual(perms, {
'kfet.test_perm': self.perm1, 'kfet.test_perm': self.perm1,
'gestioncof.another_test_perm': self.perm2, 'cof.another_test_perm': self.perm2,
}) })
def test_user_add_perms(self): def test_user_add_perms(self):
user = User.objects.create_user(username='user', password='user') user = User.objects.create_user(username='user', password='user')
user.user_permissions.add(self.perm1) 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( self.assertQuerysetEqual(
user.user_permissions.all(), user.user_permissions.all(),

View file

@ -228,7 +228,7 @@ class ViewTestCaseMixin(TestCaseMixin):
# Signals handlers on login/logout send messages. # Signals handlers on login/logout send messages.
# Due to the way the Django' test Client performs login, this raise an # Due to the way the Django' test Client performs login, this raise an
# error. As workaround, we mock the Django' messages module. # 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() patcher_messages.start()
self.addCleanup(patcher_messages.stop) self.addCleanup(patcher_messages.stop)