This commit is contained in:
parent
229479409e
commit
98dccb4964
|
@ -1,8 +0,0 @@
|
|||
import django.apps
|
||||
|
||||
|
||||
class AppConfig(django.apps.AppConfig):
|
||||
name = 'docbow_project.docbow'
|
||||
|
||||
def ready(self):
|
||||
pass
|
|
@ -1,3 +1,6 @@
|
|||
import sys
|
||||
|
||||
|
||||
class AppSettings:
|
||||
__DEFAULTS = {
|
||||
'PERSONAL_EMAIL': True,
|
||||
|
@ -67,8 +70,6 @@ class AppSettings:
|
|||
return getattr(settings, self.__prefix + name, self.__DEFAULTS[name])
|
||||
|
||||
|
||||
import sys
|
||||
|
||||
app_settings = AppSettings(prefix='DOCBOW_')
|
||||
app_settings.__name__ = __name__
|
||||
sys.modules[__name__] = app_settings
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
import django.apps
|
||||
|
||||
|
||||
class AppConfig(django.apps.AppConfig):
|
||||
name = 'docbow_project.docbow'
|
||||
|
||||
def ready(self):
|
||||
from . import signals # noqa: F401
|
|
@ -4,6 +4,7 @@ import hashlib
|
|||
import hmac
|
||||
import logging
|
||||
import os.path
|
||||
import unicodedata
|
||||
import urllib.parse
|
||||
|
||||
from django import forms
|
||||
|
@ -11,9 +12,12 @@ from django.conf import settings
|
|||
from django.contrib.admin.widgets import FilteredSelectMultiple as AdminFilteredSelectMultiple
|
||||
from django.contrib.auth.forms import PasswordChangeForm, PasswordResetForm
|
||||
from django.contrib.auth.models import User
|
||||
from django.contrib.auth.tokens import default_token_generator
|
||||
from django.contrib.sites.shortcuts import get_current_site
|
||||
from django.db.models.query import Q
|
||||
from django.forms import CharField, EmailField, Form, ModelChoiceField, ModelForm, Textarea, ValidationError
|
||||
from django.utils.encoding import force_str
|
||||
from django.utils.encoding import force_bytes, force_str
|
||||
from django.utils.http import urlsafe_base64_encode
|
||||
from django.utils.translation import gettext as _
|
||||
from django_journal import journal as django_journal
|
||||
|
||||
|
@ -483,14 +487,6 @@ class ProfileForm(ModelForm):
|
|||
return instance
|
||||
|
||||
|
||||
import unicodedata
|
||||
|
||||
from django.contrib.auth.tokens import default_token_generator
|
||||
from django.contrib.sites.shortcuts import get_current_site
|
||||
from django.utils.encoding import force_bytes
|
||||
from django.utils.http import urlsafe_base64_encode
|
||||
|
||||
|
||||
def _unicode_ci_compare(s1, s2):
|
||||
"""
|
||||
Perform case-insensitive comparison of two identifiers, using the
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import locale
|
||||
|
||||
from django.contrib.auth.models import User
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.db import transaction
|
||||
from django.utils.encoding import force_str
|
||||
|
||||
|
@ -43,21 +43,15 @@ class Command(BaseCommand):
|
|||
mailing_list, created = MailingList.objects.get_or_create(
|
||||
name=force_str(options['ml_name'], locale_encoding)
|
||||
)
|
||||
try:
|
||||
for l in options['add_list']:
|
||||
l = get_object(MailingList, l)
|
||||
mailing_list.mailing_list_members.add(l)
|
||||
for l in options['remove_list']:
|
||||
l = get_object(MailingList, l)
|
||||
mailing_list.mailing_list_members.remove(l)
|
||||
except MailingList.DoesNotExist:
|
||||
raise CommandError('list %r does not exist' % l)
|
||||
try:
|
||||
for g in options['add_user']:
|
||||
g = get_object(User, g)
|
||||
mailing_list.members.add(g)
|
||||
for g in options['remove_user']:
|
||||
g = get_object(User, g)
|
||||
mailing_list.members.remove(g)
|
||||
except User.DoesNotExist:
|
||||
raise CommandError('user %r does not exist' % g)
|
||||
for name in options['add_list']:
|
||||
ml = get_object(MailingList, name)
|
||||
mailing_list.mailing_list_members.add(ml)
|
||||
for name in options['remove_list']:
|
||||
ml = get_object(MailingList, name)
|
||||
mailing_list.mailing_list_members.remove(ml)
|
||||
for g in options['add_user']:
|
||||
g = get_object(User, g)
|
||||
mailing_list.members.add(g)
|
||||
for g in options['remove_user']:
|
||||
g = get_object(User, g)
|
||||
mailing_list.members.remove(g)
|
||||
|
|
|
@ -58,24 +58,18 @@ List and groups can be referred by name or by id.
|
|||
user.is_active = options['activate']
|
||||
if options['superuser'] is not None:
|
||||
user.is_superuser = options['superuser']
|
||||
try:
|
||||
for l in options['add_list']:
|
||||
l = get_object(MailingList, l)
|
||||
l.members.add(user)
|
||||
for l in options['remove_list']:
|
||||
l = get_object(MailingList, l)
|
||||
l.members.remove(user)
|
||||
except MailingList.DoesNotExist:
|
||||
raise CommandError('list %r does not exist' % l)
|
||||
try:
|
||||
for g in options['add_group']:
|
||||
g = get_object(Group, g)
|
||||
user.groups.add(g)
|
||||
for g in options['remove_group']:
|
||||
g = get_object(Group, g)
|
||||
user.groups.remove(g)
|
||||
except Group.DoesNotExist:
|
||||
raise CommandError('group %r does not exist' % g)
|
||||
for name in options['add_list']:
|
||||
ml = get_object(MailingList, name)
|
||||
ml.members.add(user)
|
||||
for name in options['remove_list']:
|
||||
ml = get_object(MailingList, name)
|
||||
ml.members.remove(user)
|
||||
for g in options['add_group']:
|
||||
g = get_object(Group, g)
|
||||
user.groups.add(g)
|
||||
for g in options['remove_group']:
|
||||
g = get_object(Group, g)
|
||||
user.groups.remove(g)
|
||||
profile, created = DocbowProfile.objects.get_or_create(user=user)
|
||||
if options['mobile_phone']:
|
||||
profile.mobile_phone = force_str(options['mobile_phone'], 'utf-8')
|
||||
|
|
|
@ -58,7 +58,7 @@ class Command(BaseCommand):
|
|||
|
||||
def timestamp_logs(self, path):
|
||||
with open(os.path.join(path, 'log-timestamp.der'), 'w') as f:
|
||||
with open(os.path.join(path, 'log.csv')) as log_handle:
|
||||
with open(os.path.join(path, 'log.csv')):
|
||||
tst = str(time.time())
|
||||
f.write(tst)
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import csv
|
||||
import functools
|
||||
import os.path
|
||||
import random
|
||||
import sys
|
||||
|
@ -108,7 +109,7 @@ class Command(BaseCommand):
|
|||
d = dict(zip(first, line))
|
||||
self.synthesis(d, **options)
|
||||
all_users.append(d)
|
||||
all_profiles = set(reduce(list.__add__, [x['profil'] for x in all_users]))
|
||||
all_profiles = set(functools.reduce(list.__add__, [x['profil'] for x in all_users]))
|
||||
profiles = dict()
|
||||
count_created, count_modified = 0, 0
|
||||
for profile in filter(None, all_profiles):
|
||||
|
@ -134,7 +135,9 @@ class Command(BaseCommand):
|
|||
lambda x: auth_models.Group.objects.get_or_create(name=x)[0], user['groupe']
|
||||
)
|
||||
user_instance.groups = user_groups
|
||||
user_instance.is_staff = reduce(bool.__or__, ['Administrateur' in x for x in user['groupe']])
|
||||
user_instance.is_staff = functools.reduce(
|
||||
bool.__or__, ['Administrateur' in x for x in user['groupe']]
|
||||
)
|
||||
if user.get('password'):
|
||||
password = user.get('password')
|
||||
if password.startswith('sha1$'):
|
||||
|
|
|
@ -40,19 +40,13 @@ class Command(BaseCommand):
|
|||
except User.DoesNotExist:
|
||||
raise CommandError('user %r does not exist' % options['sender'])
|
||||
to_lists = []
|
||||
try:
|
||||
for l in options.get('to_list') or []:
|
||||
l = get_object(MailingList, force_str(l, locale_encoding))
|
||||
to_lists.append(l)
|
||||
except MailingList.DoesNotExist:
|
||||
raise CommandError('list %r does not exist' % l)
|
||||
for name in options.get('to_list') or []:
|
||||
ml = get_object(MailingList, force_str(name, locale_encoding))
|
||||
to_lists.append(ml)
|
||||
to_users = []
|
||||
try:
|
||||
for l in options.get('to_user') or []:
|
||||
l = get_object(User, force_str(l, locale_encoding), 'username')
|
||||
to_users.append(l)
|
||||
except User.DoesNotExist:
|
||||
raise CommandError('user %r does not exist' % l)
|
||||
for username in options.get('to_user') or []:
|
||||
user = get_object(User, force_str(username, locale_encoding), 'username')
|
||||
to_users.append(user)
|
||||
if 'filetype' not in options:
|
||||
raise CommandError('missing --filetype parameter')
|
||||
try:
|
||||
|
|
|
@ -8,6 +8,7 @@ import time
|
|||
import urllib.parse
|
||||
from collections import defaultdict
|
||||
|
||||
import watson.search as watson
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.models import Group, User
|
||||
from django.db.models import (
|
||||
|
@ -327,7 +328,7 @@ class Document(Model):
|
|||
It can differ from ``to()`` if the members of a recipient
|
||||
mailing-list changed.
|
||||
"""
|
||||
return [m.owner for m in self.mailboxes.all() if m.outbox == False]
|
||||
return [m.owner for m in self.mailboxes.all() if m.outbox is False]
|
||||
|
||||
def timestamp(self, to=None):
|
||||
if not self._timestamp:
|
||||
|
@ -488,15 +489,15 @@ class DocumentForwarded(Model):
|
|||
)
|
||||
|
||||
|
||||
def list_to_csv(l, mapping_func=None):
|
||||
def list_to_csv(_list, mapping_func=None):
|
||||
"""Convert a list to a comma separated string of its unicode values.
|
||||
|
||||
A mapping_func function can be passed to transform the list prior to the
|
||||
formatting.
|
||||
"""
|
||||
if mapping_func:
|
||||
l = map(mapping_func, l)
|
||||
return ', '.join(map(force_str, l))
|
||||
_list = map(mapping_func, _list)
|
||||
return ', '.join(map(force_str, _list))
|
||||
|
||||
|
||||
class AutomaticForwarding(Model):
|
||||
|
@ -602,7 +603,7 @@ class AttachedFile(Model):
|
|||
prefix, true_filename = filename.split('_', 1)
|
||||
if prefix.isdigit():
|
||||
return true_filename
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
return filename
|
||||
|
@ -659,7 +660,7 @@ class Delegation(Model):
|
|||
def guest_delegate(self):
|
||||
try:
|
||||
return self.to.docbowprofile.is_guest
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
|
||||
|
@ -904,9 +905,6 @@ def non_guest_users():
|
|||
return User.objects.exclude(docbowprofile__is_guest=True).filter(is_active=True)
|
||||
|
||||
|
||||
import watson.search as watson
|
||||
|
||||
|
||||
class DocumentAdapter(watson.SearchAdapter):
|
||||
def gather_strings(self, obj):
|
||||
yield obj.comment
|
||||
|
|
|
@ -109,7 +109,7 @@ class WorkSheet:
|
|||
|
||||
class WorkCell:
|
||||
def __init__(self, worksheet, value, hint=None):
|
||||
if type(value) is not str:
|
||||
if not isinstance(value, str):
|
||||
value = force_str(value, 'utf-8')
|
||||
self.value = value
|
||||
self.worksheet = worksheet
|
||||
|
|
|
@ -7,8 +7,10 @@ import zipfile
|
|||
from itertools import chain
|
||||
|
||||
import django.contrib.auth as auth
|
||||
from django import http
|
||||
from django.conf import settings
|
||||
from django.contrib import messages
|
||||
from django.contrib.auth import BACKEND_SESSION_KEY, SESSION_KEY
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.contrib.auth.models import User
|
||||
from django.core.files.base import File
|
||||
|
@ -61,7 +63,9 @@ from docbow_project.docbow.models import (
|
|||
)
|
||||
from docbow_project.docbow.utils import date_to_aware_datetime
|
||||
|
||||
gettext_noop = lambda x: x
|
||||
|
||||
def gettext_noop(x):
|
||||
return x
|
||||
|
||||
|
||||
@login_required
|
||||
|
@ -560,10 +564,6 @@ def restore(request, doc_id, outbox=False):
|
|||
return redirect(return_view)
|
||||
|
||||
|
||||
from django import http
|
||||
from django.contrib.auth import BACKEND_SESSION_KEY, SESSION_KEY
|
||||
|
||||
|
||||
def su(request, username, redirect_url='/'):
|
||||
"""Allows changing user for super-users. Super-user status is kept using a
|
||||
flag on the session.
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
import django.apps
|
||||
|
||||
|
||||
class AppConfig(django.apps.AppConfig):
|
||||
name = 'docbow_project.pfwb'
|
||||
|
||||
def ready(self):
|
||||
pass
|
|
@ -1,3 +1,6 @@
|
|||
import sys
|
||||
|
||||
|
||||
class AppSettings:
|
||||
'''Thanks django-allauth'''
|
||||
|
||||
|
@ -43,6 +46,5 @@ class AppSettings:
|
|||
app_settings = AppSettings('DOCBOW_')
|
||||
app_settings.__name__ = __name__
|
||||
app_settings.__file__ = __file__
|
||||
import sys
|
||||
|
||||
sys.modules[__name__] = app_settings
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
import django.apps
|
||||
|
||||
|
||||
class AppConfig(django.apps.AppConfig):
|
||||
name = 'docbow_project.pfwb'
|
||||
|
||||
def ready(self):
|
||||
from . import signals # noqa: F401
|
|
@ -71,7 +71,7 @@ In case of failure the following return value is returned:
|
|||
try:
|
||||
mbox = mailbox.mbox(settings.SENDMAIL_DEBUG_MBOX)
|
||||
mbox.add(mail)
|
||||
except:
|
||||
except Exception:
|
||||
logger.exception('mbox exception')
|
||||
try:
|
||||
self.handle_mail(mail, (options['recipient'],), **options)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from docbow_project.settings import *
|
||||
from docbow_project.settings import * # noqa: F403
|
||||
|
||||
DOCBOW_EDIT_EMAIL = True
|
||||
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
import django.apps
|
||||
|
||||
|
||||
class AppConfig(django.apps.AppConfig):
|
||||
name = 'docbow_project.pw'
|
|
@ -73,7 +73,7 @@ In case of failure the following return value is returned:
|
|||
try:
|
||||
mbox = mailbox.mbox(settings.SENDMAIL_DEBUG_MBOX)
|
||||
mbox.add(mail)
|
||||
except:
|
||||
except Exception:
|
||||
logger.exception('mbox exception')
|
||||
try:
|
||||
self.handle_mail(mail, (options['recipient'],), **options)
|
||||
|
|
|
@ -7,7 +7,7 @@ try:
|
|||
from authentic2.custom_user.models import User as A2User
|
||||
except ImportError:
|
||||
pass
|
||||
except:
|
||||
else:
|
||||
# when user is created or deleted on Docbow, create or delete on authentic
|
||||
# when first_name, last_name, email or password change on docbow, write it on authentic
|
||||
|
||||
|
@ -36,7 +36,6 @@ except:
|
|||
try:
|
||||
user = A2User.objects.using('authentic').get(username=username)
|
||||
except A2User.DoesNotExist:
|
||||
update_password = True
|
||||
user = A2User()
|
||||
user.username = instance.username
|
||||
user.first_name = instance.first_name
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import os
|
||||
|
||||
from docbow_project.settings import *
|
||||
from docbow_project.settings import * # noqa: F403
|
||||
|
||||
DEFAULT_FROM_EMAIL = 'gestionnaire@courrier.parlement-wallon.be'
|
||||
CONTACT_SUBJECT_PREFIX = 'Contact depuis courrier.parlement-wallon.be: '
|
||||
|
@ -14,7 +14,7 @@ DOCBOW_DELEGATE_TO_EXISTING_USER = False
|
|||
DOCBOW_DEFAULT_ACCEPT_NOTIFICATIONS_FOR_GUEST = False
|
||||
|
||||
if 'USE_SAML' in os.environ:
|
||||
INSTALLED_APPS += ('mellon',)
|
||||
INSTALLED_APPS += ('mellon',) # noqa: F405
|
||||
LOGIN_URL = 'mellon_login'
|
||||
LOGOUT_URL = 'mellon_logout'
|
||||
AUTHENTICATION_BACKENDS = ('mellon.backends.SAMLBackend',)
|
||||
|
@ -33,19 +33,19 @@ if 'USE_SAML' in os.environ:
|
|||
MELLON_USERNAME_TEMPLATE = '{attributes[name_id_content]}'
|
||||
|
||||
if 'AUTHENTIC_DATABASE_ENGINE' in os.environ:
|
||||
DATABASES['authentic'] = {
|
||||
DATABASES['authentic'] = { # noqa: F405
|
||||
'ENGINE': os.environ.get('AUTHENTIC_DATABASE_ENGINE'),
|
||||
'NAME': os.environ.get('AUTHENTIC_DATABASE_NAME'),
|
||||
'USER': os.environ.get('AUTHENTIC_DATABASE_USER'),
|
||||
}
|
||||
|
||||
JOURNAL_DB_FOR_ERROR_ALIAS = 'journal'
|
||||
DATABASES['journal'] = DATABASES['default'].copy()
|
||||
DATABASES['journal']['TEST_MIRROR'] = 'default'
|
||||
DATABASES['journal'] = DATABASES['default'].copy() # noqa: F405
|
||||
DATABASES['journal']['TEST_MIRROR'] = 'default' # noqa: F405
|
||||
BASE_URL = 'https://courrier.parlement-wallon.be'
|
||||
EMAIL_SUBJECT_PREFIX = ''
|
||||
|
||||
if PLATFORM == 'test':
|
||||
if PLATFORM == 'test': # noqa: F405
|
||||
BASE_URL = 'https://pes-pw.dev.entrouvert.org'
|
||||
DEFAULT_FROM_EMAIL = 'gestionnaire@pes-pw.dev.entrouvert.org'
|
||||
CONTACT_SUBJECT_PREFIX = 'Contact depuis pes-pw.dev.entrouvert.org: '
|
||||
|
@ -53,6 +53,6 @@ if PLATFORM == 'test':
|
|||
HELP_DIR = '/usr/share/doc/docbow/build-pw'
|
||||
|
||||
try:
|
||||
from local_settings import *
|
||||
from local_settings import * # noqa: F403
|
||||
except ImportError:
|
||||
pass
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
import logging.handlers
|
||||
import os
|
||||
|
||||
gettext_noop = lambda s: s
|
||||
|
||||
def gettext_noop(s):
|
||||
return s
|
||||
|
||||
|
||||
BASE_DIR = os.path.dirname(__file__)
|
||||
PROJECT_NAME = 'docbow'
|
||||
|
|
|
@ -8,7 +8,7 @@ import docbow_project.docbow.views
|
|||
|
||||
admin.autodiscover()
|
||||
|
||||
from .docbow.admin import site as docbow_admin_site
|
||||
from .docbow.admin import site as docbow_admin_site # noqa: E402
|
||||
|
||||
urlpatterns = [
|
||||
path('', include('docbow_project.docbow.urls')),
|
||||
|
|
|
@ -13,10 +13,6 @@ middleware here, or combine a Django application with an application of another
|
|||
framework.
|
||||
|
||||
"""
|
||||
import os
|
||||
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'docbow_project.settings')
|
||||
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
|
||||
application = get_wsgi_application()
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# AUTHENTIC URL and credentials are used
|
||||
# to manage guest users.
|
||||
|
||||
INSTALLED_APPS += ('mellon',)
|
||||
INSTALLED_APPS += ('mellon',) # noqa: F821
|
||||
|
||||
AUTHENTICATION_BACKENDS = (
|
||||
'docbow_project.docbow.auth_backend.DocbowMellonAuthBackend' 'django.contrib.auth.backends.ModelBackend'
|
||||
|
|
|
@ -12,7 +12,15 @@ from functools import wraps
|
|||
from io import StringIO
|
||||
from unittest import mock
|
||||
|
||||
from django.contrib.auth.models import User
|
||||
from django.core import management
|
||||
from django.test import TestCase
|
||||
from django.test.utils import override_settings
|
||||
from django.utils.encoding import force_bytes, force_str
|
||||
from django_journal.models import Journal
|
||||
|
||||
from docbow_project.docbow.models import AttachedFile, Document, FileType, MailingList
|
||||
from docbow_project.pfwb.models import PloneFileType, TabellioDocType
|
||||
|
||||
MEDIA_ROOT = tempfile.mkdtemp()
|
||||
|
||||
|
@ -58,15 +66,6 @@ class stdout_output:
|
|||
return f
|
||||
|
||||
|
||||
from django.contrib.auth.models import User
|
||||
from django.core import management
|
||||
from django.test import TestCase
|
||||
from django.test.utils import override_settings
|
||||
from django_journal.models import Journal
|
||||
|
||||
from docbow_project.docbow.models import AttachedFile, Document, FileType, MailingList
|
||||
from docbow_project.pfwb.models import PloneFileType, TabellioDocType
|
||||
|
||||
EXPEDITION_EMAIL = 'expedition@example.com'
|
||||
RECIPIENT_EMAIL = 'recipient@example.com'
|
||||
RECIPIENT_LIST_EMAIL = 'liste-ma-liste@example.com'
|
||||
|
@ -403,10 +402,10 @@ class ArchiveTestCase(TestCase):
|
|||
|
||||
with captured_output() as (out, err):
|
||||
management.call_command('archive2', self.archive_dir, 0)
|
||||
l = glob.glob(os.path.join(self.archive_dir, '*'))
|
||||
assert len(l) == 1
|
||||
self.assertTrue(l[0].split('T')[0], datetime.datetime.today().isoformat())
|
||||
archive_dir = os.path.join(self.archive_dir, l[0])
|
||||
file_list = glob.glob(os.path.join(self.archive_dir, '*'))
|
||||
assert len(file_list) == 1
|
||||
self.assertTrue(file_list[0].split('T')[0], datetime.datetime.today().isoformat())
|
||||
archive_dir = os.path.join(self.archive_dir, file_list[0])
|
||||
self.assertTrue(os.path.exists(os.path.join(archive_dir, 'doc')))
|
||||
self.assertTrue(os.path.exists(os.path.join(archive_dir, 'doc', str(self.document.id))))
|
||||
self.assertTrue(
|
||||
|
@ -428,9 +427,9 @@ def test_send_mail_truncate_filename(db, settings):
|
|||
settings.MEDIA_ROOT = MEDIA_ROOT
|
||||
|
||||
pjd_filetype = FileType.objects.create(name='PJD', id=2)
|
||||
tabellio_doc_type = TabellioDocType.objects.create(filetype=pjd_filetype, tabellio_doc_type='PJD')
|
||||
expedition_user = User.objects.create(username='expedition', id=1)
|
||||
to_user = User.objects.create(username='recipient', email=RECIPIENT_EMAIL, id=2)
|
||||
TabellioDocType.objects.create(filetype=pjd_filetype, tabellio_doc_type='PJD')
|
||||
User.objects.create(username='expedition', id=1)
|
||||
User.objects.create(username='recipient', email=RECIPIENT_EMAIL, id=2)
|
||||
|
||||
subject = 'foo: ' + 'aaaa M.' + 'b' * 300
|
||||
content = '''\
|
||||
|
|
|
@ -2,7 +2,7 @@ import os
|
|||
|
||||
SECRET_KEY = 'coin'
|
||||
|
||||
INSTALLED_APPS += ('mellon', 'docbow_project.pfwb')
|
||||
INSTALLED_APPS += ('mellon', 'docbow_project.pfwb') # noqa: F821
|
||||
|
||||
MELLON_ADAPTER = ('docbow_project.pfwb.mellon_adapter.PFWBMellonAdapter',)
|
||||
|
||||
|
|
|
@ -11,8 +11,14 @@ from contextlib import contextmanager
|
|||
from functools import wraps
|
||||
from io import StringIO
|
||||
|
||||
from django.contrib.auth.models import User
|
||||
from django.core import management
|
||||
from django.test import TestCase
|
||||
from django.test.utils import override_settings
|
||||
from django.utils.encoding import force_bytes, force_str
|
||||
|
||||
from docbow_project.docbow.models import Document, FileType, MailingList
|
||||
|
||||
MEDIA_ROOT = tempfile.mkdtemp()
|
||||
|
||||
|
||||
|
@ -57,13 +63,6 @@ class stdout_output:
|
|||
return f
|
||||
|
||||
|
||||
from django.contrib.auth.models import User
|
||||
from django.core import management
|
||||
from django.test import TestCase
|
||||
from django.test.utils import override_settings
|
||||
|
||||
from docbow_project.docbow.models import Document, FileType, MailingList
|
||||
|
||||
EXPEDITION_EMAIL = 'expedition@example.com'
|
||||
RECIPIENT_EMAIL = 'recipient@example.com'
|
||||
PRIVATE_RECIPIENT_EMAIL = 'recipient-private@example.com'
|
||||
|
|
|
@ -16,7 +16,7 @@ DATABASES = {
|
|||
PARLEMENT = os.environ['PARLEMENT']
|
||||
|
||||
if PARLEMENT == 'pfwb':
|
||||
INSTALLED_APPS += ('docbow_project.pfwb',)
|
||||
INSTALLED_APPS += ('docbow_project.pfwb',) # noqa: F821
|
||||
DOCBOW_EDIT_EMAIL = True
|
||||
TABELLIO_DBNAME = 'tabellio-test-%s' % os.environ.get('BRANCH_NAME', '').replace('/', '-')[:63]
|
||||
TABELLIO_DBHOST = ''
|
||||
|
|
|
@ -2,7 +2,7 @@ import os
|
|||
|
||||
SECRET_KEY = 'coin'
|
||||
|
||||
INSTALLED_APPS += ('mellon',)
|
||||
INSTALLED_APPS += ('mellon',) # noqa: F821
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
|
|
|
@ -118,7 +118,7 @@ def test_delete_delegate_sso(a2settings, client, monkeypatch, user):
|
|||
|
||||
mock_resp = MockResp(json={})
|
||||
mock_delete = mock.Mock(return_value=mock_resp)
|
||||
monkeypatch.setattr(docbow_project.docbow.profile_views.requests, 'delete', mock_delete)
|
||||
monkeypatch.setattr(docbow_project.docbow.utils.requests, 'delete', mock_delete)
|
||||
|
||||
delegate = User.objects.create(
|
||||
first_name='john', last_name='doe', username='john.doe-1', email='john@localhost'
|
||||
|
|
Loading…
Reference in New Issue