This commit is contained in:
@@ -1 +1 @@
|
||||
default_app_config = 'dav_base.apps.AppConfig'
|
||||
default_app_config = 'dav_base.apps.AppConfig' # pylint: disable=invalid-name
|
||||
|
||||
@@ -9,5 +9,5 @@ DEFAULT_SETTINGS = (
|
||||
|
||||
class AppConfig(_AppConfig):
|
||||
name = 'dav_base'
|
||||
verbose_name = u'DAV Base App'
|
||||
verbose_name = 'DAV Base App'
|
||||
default_settings = DEFAULT_SETTINGS
|
||||
|
||||
@@ -7,7 +7,7 @@ from django.core.exceptions import ImproperlyConfigured
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class DefaultSetting(object):
|
||||
class DefaultSetting: # pylint: disable=too-few-public-methods
|
||||
def __init__(self, name, value, key_name=None, validator=None):
|
||||
self.name = name
|
||||
self.value = value
|
||||
@@ -27,7 +27,7 @@ class DefaultSetting(object):
|
||||
raise ImproperlyConfigured('Does not match /{re}/'.format(re=self.validator))
|
||||
|
||||
|
||||
class AppSettings(object):
|
||||
class AppSettings: # pylint: disable=too-few-public-methods
|
||||
def __init__(self, app_name, defaults):
|
||||
settings_name = 'main.settings-' + app_name
|
||||
|
||||
@@ -45,7 +45,7 @@ class AppSettings(object):
|
||||
msg = 'Invalid value of {key} in {module}: {cause}'.format(key=default.key_name,
|
||||
module=settings_name,
|
||||
cause=e)
|
||||
raise ImproperlyConfigured(msg)
|
||||
raise ImproperlyConfigured(msg) from e
|
||||
setattr(self, default.name, value)
|
||||
elif isinstance(default.value, ImproperlyConfigured):
|
||||
raise default.value
|
||||
@@ -59,13 +59,13 @@ class AppSettings(object):
|
||||
msg = '{key} must be defined in {module}'.format(key=default.key_name,
|
||||
module=settings_name)
|
||||
raise default.value(msg)
|
||||
else:
|
||||
setattr(self, default.name, default.value)
|
||||
|
||||
setattr(self, default.name, default.value)
|
||||
|
||||
|
||||
class AppConfig(_AppConfig):
|
||||
default_settings = ()
|
||||
|
||||
def __init__(self, app_name, app_module):
|
||||
super(AppConfig, self).__init__(app_name, app_module)
|
||||
super().__init__(app_name, app_module)
|
||||
self.settings = AppSettings(app_name, self.default_settings)
|
||||
|
||||
@@ -13,7 +13,7 @@ class ModuleConfigError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class ModuleMeta(object):
|
||||
class ModuleMeta:
|
||||
_json_file = 'module.json'
|
||||
_root_url_name = 'root'
|
||||
|
||||
@@ -73,7 +73,7 @@ class ModuleMeta(object):
|
||||
return d
|
||||
|
||||
|
||||
class ModuleConfig(object):
|
||||
class ModuleConfig:
|
||||
_lazy_load = True
|
||||
|
||||
def __init__(self, config_file_path=None, django_base_dir=None):
|
||||
@@ -83,7 +83,7 @@ class ModuleConfig(object):
|
||||
config_file_path = os.path.join(django_base_dir, DJANGO_MAIN_MODULE, MODULE_CONFIG_FILE_NAME)
|
||||
self._config_file_path = config_file_path
|
||||
|
||||
self._modules = dict()
|
||||
self._modules = {}
|
||||
|
||||
self._loaded = False
|
||||
if not self._lazy_load:
|
||||
@@ -96,13 +96,13 @@ class ModuleConfig(object):
|
||||
def _load(self):
|
||||
path = self._config_file_path
|
||||
|
||||
self._modules = dict()
|
||||
self._modules = {}
|
||||
|
||||
if os.path.exists(path):
|
||||
with open(path, 'r') as f:
|
||||
with open(path, 'r', encoding='ascii') as f:
|
||||
data = json.load(f)
|
||||
else:
|
||||
data = dict()
|
||||
data = {}
|
||||
|
||||
if 'modules' in data:
|
||||
for meta_dict in data['modules']:
|
||||
@@ -131,5 +131,5 @@ class ModuleConfig(object):
|
||||
for meta_obj in self._modules.values():
|
||||
data['modules'].append(meta_obj.dump_as_dict())
|
||||
|
||||
with open(path, 'w') as f:
|
||||
with open(path, 'w', encoding='ascii') as f:
|
||||
json.dump(data, f, indent=4)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import argparse
|
||||
import os
|
||||
import pkg_resources
|
||||
import posix
|
||||
import sys
|
||||
import pkg_resources
|
||||
from django.core.management import execute_from_command_line
|
||||
|
||||
from dav_base.config.modules import DJANGO_MAIN_MODULE, ModuleConfig
|
||||
@@ -10,7 +10,7 @@ from dav_base.config.modules import DJANGO_MAIN_MODULE, ModuleConfig
|
||||
VERSION = '0.1'
|
||||
|
||||
|
||||
class AdminCommand(object):
|
||||
class AdminCommand: # pylint: disable=too-few-public-methods
|
||||
def _setup_argparser(self):
|
||||
kwargs = {
|
||||
'description': 'Tool to manage the DAV django project installation.',
|
||||
@@ -60,7 +60,7 @@ class AdminCommand(object):
|
||||
def _subcmd_setup(self, cmd_args):
|
||||
django_main_module = DJANGO_MAIN_MODULE
|
||||
django_base_dir = cmd_args.path
|
||||
|
||||
|
||||
sys.stdout.write('Setup installation in \'{path}\'...\n'.format(path=django_base_dir))
|
||||
|
||||
if os.path.exists(django_base_dir):
|
||||
|
||||
@@ -9,8 +9,8 @@ app_config = apps.get_containing_app_config(__package__)
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class AbstractMail(object):
|
||||
_subject = u''
|
||||
class AbstractMail: # pylint: disable=too-few-public-methods
|
||||
_subject = ''
|
||||
_template_name = None
|
||||
|
||||
def _get_sender(self):
|
||||
@@ -20,7 +20,7 @@ class AbstractMail(object):
|
||||
if subject_fmt is None:
|
||||
subject_fmt = self._subject
|
||||
if app_config.settings.email_subject_prefix:
|
||||
subject_fmt = u'%s %s' % (app_config.settings.email_subject_prefix, subject_fmt)
|
||||
subject_fmt = '%s %s' % (app_config.settings.email_subject_prefix, subject_fmt)
|
||||
subject = subject_fmt.format(**kwargs)
|
||||
return subject
|
||||
|
||||
@@ -57,7 +57,7 @@ class AbstractMail(object):
|
||||
|
||||
email = EmailMessage(subject=subject, body=body, from_email=sender, to=recipients, reply_to=reply_to)
|
||||
if fail_silently:
|
||||
logger.info(u'Fake sending %s to %s', self.__class__.__name__, recipients)
|
||||
logger.info('Fake sending %s to %s', self.__class__.__name__, recipients)
|
||||
else:
|
||||
logger.info(u'Send %s to %s', self.__class__.__name__, recipients)
|
||||
logger.info('Send %s to %s', self.__class__.__name__, recipients)
|
||||
email.send(fail_silently=fail_silently)
|
||||
|
||||
@@ -7,7 +7,7 @@ register = template.Library()
|
||||
def do_include_if_exist(parser, token):
|
||||
"""
|
||||
Used to include a template, that maybe does not exist.
|
||||
|
||||
|
||||
include_if_exist support an optional keyword 'default', which must be followed by the name of a default template.
|
||||
The default template will be included, if the first template does not exist.
|
||||
If also the default template does not exist, the behaviour is the same as for the original (builtin) include tag.
|
||||
@@ -36,7 +36,7 @@ def do_include_if_exist(parser, token):
|
||||
except IndexError:
|
||||
raise template.TemplateSyntaxError("'default' keyword in %r tag requires another arguments:"
|
||||
" the name of the default template" % bits[0])
|
||||
|
||||
|
||||
try:
|
||||
include_node = template.loader_tags.do_include(parser, token)
|
||||
except template.TemplateDoesNotExist:
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import datetime
|
||||
import os
|
||||
from urllib.parse import quote
|
||||
from django.apps import apps
|
||||
from django.contrib.auth.models import AbstractUser
|
||||
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
|
||||
@@ -9,11 +10,10 @@ from django.test import SimpleTestCase, TestCase, tag
|
||||
from django.urls import reverse
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.support.ui import WebDriverWait
|
||||
from selenium.webdriver.support import expected_conditions as EC
|
||||
from six.moves.urllib.parse import quote
|
||||
from selenium.webdriver.support import expected_conditions as ExpectedConditions
|
||||
|
||||
|
||||
class AppSetting(object):
|
||||
class AppSetting: # pylint: disable=too-few-public-methods
|
||||
def __init__(self, name, of=None):
|
||||
self.name = name
|
||||
self.of = of
|
||||
@@ -24,7 +24,7 @@ class AppsTestCase(SimpleTestCase):
|
||||
settings = ()
|
||||
|
||||
def setUp(self):
|
||||
super(AppsTestCase, self).setUp()
|
||||
super().setUp()
|
||||
if self.app_config:
|
||||
self.configured_settings = self.app_config.settings
|
||||
else:
|
||||
@@ -41,7 +41,7 @@ class AppsTestCase(SimpleTestCase):
|
||||
self.assertIsInstance(value, of)
|
||||
|
||||
|
||||
class EmailTestMixin(object):
|
||||
class EmailTestMixin:
|
||||
email_sender = 'Automatic Software Test <root@localhost>'
|
||||
email_base_url = 'http://localhost'
|
||||
email_subject_prefix = '[Test]'
|
||||
@@ -55,29 +55,29 @@ class EmailTestMixin(object):
|
||||
|
||||
return mails
|
||||
|
||||
def assertSender(self, mail):
|
||||
def assertSender(self, mail): # pylint: disable=invalid-name
|
||||
self.assertEqual(mail.from_email, self.email_sender)
|
||||
|
||||
def assertReplyTo(self, mail, addresses):
|
||||
def assertReplyTo(self, mail, addresses): # pylint: disable=invalid-name
|
||||
self.assertEqual(len(mail.reply_to), len(addresses))
|
||||
for expected_address in addresses:
|
||||
if isinstance(expected_address, AbstractUser):
|
||||
expected_address = u'"%s" <%s>' % (expected_address.get_full_name(), expected_address.email)
|
||||
expected_address = '"%s" <%s>' % (expected_address.get_full_name(), expected_address.email)
|
||||
self.assertIn(expected_address, mail.reply_to)
|
||||
|
||||
def assertRecipients(self, mail, recipients):
|
||||
def assertRecipients(self, mail, recipients): # pylint: disable=invalid-name
|
||||
self.assertEqual(len(mail.recipients()), len(recipients))
|
||||
for expected_recipient in recipients:
|
||||
if isinstance(expected_recipient, AbstractUser):
|
||||
expected_recipient = u'"%s" <%s>' % (expected_recipient.get_full_name(), expected_recipient.email)
|
||||
expected_recipient = '"%s" <%s>' % (expected_recipient.get_full_name(), expected_recipient.email)
|
||||
recipients = mail.recipients()
|
||||
self.assertIn(expected_recipient, recipients)
|
||||
|
||||
def assertSubject(self, mail, subject):
|
||||
expected_subject = u'{} {}'.format(self.email_subject_prefix, subject)
|
||||
def assertSubject(self, mail, subject): # pylint: disable=invalid-name
|
||||
expected_subject = '{} {}'.format(self.email_subject_prefix, subject)
|
||||
self.assertEqual(mail.subject, expected_subject)
|
||||
|
||||
def assertBody(self, mail, body):
|
||||
def assertBody(self, mail, body): # pylint: disable=invalid-name
|
||||
expected_lines = body.splitlines()
|
||||
lines = mail.body.splitlines()
|
||||
i = 0
|
||||
@@ -93,14 +93,14 @@ class EmailTestMixin(object):
|
||||
self.fail('line %d: %s' % (i, e))
|
||||
self.assertEqual(mail.body, body)
|
||||
|
||||
def setUp(self):
|
||||
def setUp(self): # pylint: disable=invalid-name
|
||||
app_config = apps.get_app_config('dav_base')
|
||||
app_config.settings.email_sender = self.email_sender
|
||||
app_config.settings.email_base_url = self.email_base_url
|
||||
app_config.settings.email_subject_prefix = self.email_subject_prefix
|
||||
|
||||
|
||||
class FormDataSet(object):
|
||||
class FormDataSet: # pylint: disable=too-few-public-methods
|
||||
def __init__(self, data, expected_errors=None, form_kwargs=None):
|
||||
self.data = data
|
||||
self.expected_errors = expected_errors
|
||||
@@ -116,44 +116,46 @@ class FormsTestCase(TestCase):
|
||||
if form_class is None:
|
||||
form_class = self.form_class
|
||||
if form_class is None:
|
||||
return True
|
||||
return
|
||||
|
||||
if data_sets is None:
|
||||
data_sets = self.valid_data_sets
|
||||
|
||||
given_form_kwargs = form_kwargs
|
||||
for data_set in data_sets:
|
||||
fk = {}
|
||||
if form_kwargs is not None:
|
||||
fk.update(form_kwargs)
|
||||
form_kwargs = {}
|
||||
if given_form_kwargs is not None:
|
||||
form_kwargs.update(given_form_kwargs)
|
||||
if data_set.form_kwargs is not None:
|
||||
fk.update(data_set.form_kwargs)
|
||||
fk['data'] = data_set.data
|
||||
form = form_class(**fk)
|
||||
form_kwargs.update(data_set.form_kwargs)
|
||||
form_kwargs['data'] = data_set.data
|
||||
form = form_class(**form_kwargs)
|
||||
if not form.is_valid():
|
||||
errors = []
|
||||
for key in form.errors.as_data():
|
||||
for ve in form.errors[key].as_data():
|
||||
errors.append(u'%s (%s)' % (ve.code, ve.message))
|
||||
self.fail(u'Invalid form data \'%s\': %s' % (data_set.data, errors))
|
||||
for e in form.errors[key].as_data():
|
||||
errors.append('%s (%s)' % (e.code, e.message))
|
||||
self.fail('Invalid form data \'%s\': %s' % (data_set.data, errors))
|
||||
|
||||
def test_invalid_data(self, form_class=None, data_sets=None, form_kwargs=None):
|
||||
if form_class is None:
|
||||
form_class = self.form_class
|
||||
if form_class is None:
|
||||
return True
|
||||
return
|
||||
|
||||
if data_sets is None:
|
||||
data_sets = self.invalid_data_sets
|
||||
|
||||
given_form_kwargs = form_kwargs
|
||||
for data_set in data_sets:
|
||||
fk = {}
|
||||
if form_kwargs is not None:
|
||||
fk.update(form_kwargs)
|
||||
form_kwargs = {}
|
||||
if given_form_kwargs is not None:
|
||||
form_kwargs.update(given_form_kwargs)
|
||||
if data_set.form_kwargs is not None:
|
||||
fk.update(data_set.form_kwargs)
|
||||
fk['data'] = data_set.data
|
||||
form_kwargs.update(data_set.form_kwargs)
|
||||
form_kwargs['data'] = data_set.data
|
||||
|
||||
form = form_class(**fk)
|
||||
form = form_class(**form_kwargs)
|
||||
|
||||
if form.is_valid():
|
||||
self.fail('Valid form data: \'%s\'' % data_set.data)
|
||||
@@ -164,7 +166,7 @@ class FormsTestCase(TestCase):
|
||||
self.assertIn(code, error_codes)
|
||||
|
||||
|
||||
class Url(object):
|
||||
class Url: # pylint: disable=too-few-public-methods
|
||||
def __init__(self, location, name=None, func=None, **kwargs):
|
||||
self.location = location
|
||||
self.name = name
|
||||
@@ -210,15 +212,15 @@ class UrlsTestCase(TestCase):
|
||||
'Getting url named \'{}\' resolve to wrong function'.format(url.name))
|
||||
|
||||
|
||||
class ValidatorTestMixin(object):
|
||||
def assertValid(self, validator, data):
|
||||
class ValidatorTestMixin:
|
||||
def assertValid(self, validator, data): # pylint: disable=invalid-name
|
||||
for val in data:
|
||||
try:
|
||||
validator(val)
|
||||
except ValidationError as e: # pragma: no cover
|
||||
self.fail('%s: %s' % (val, e))
|
||||
|
||||
def assertInvalid(self, validator, data):
|
||||
def assertInvalid(self, validator, data): # pylint: disable=invalid-name
|
||||
for val in data:
|
||||
try:
|
||||
validator(val)
|
||||
@@ -234,7 +236,7 @@ class SeleniumTestCase(StaticLiveServerTestCase):
|
||||
window_height = 768
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(SeleniumTestCase, self).__init__(*args, **kwargs)
|
||||
super().__init__(*args, **kwargs)
|
||||
self._driver = None
|
||||
self._driver_options = webdriver.FirefoxOptions()
|
||||
self.quit_selenium = None
|
||||
@@ -254,7 +256,7 @@ class SeleniumTestCase(StaticLiveServerTestCase):
|
||||
def tearDown(self):
|
||||
if self.quit_selenium:
|
||||
self.selenium.quit()
|
||||
super(SeleniumTestCase, self).tearDown()
|
||||
super().tearDown()
|
||||
|
||||
def complete_url(self, location):
|
||||
base_url = self.live_server_url
|
||||
@@ -264,8 +266,8 @@ class SeleniumTestCase(StaticLiveServerTestCase):
|
||||
return self.selenium.get(self.complete_url(location))
|
||||
|
||||
def wait_on(self, driver, ec_name, ec_argument, timeout=30):
|
||||
ec = getattr(EC, ec_name)
|
||||
return WebDriverWait(driver, timeout).until(ec(ec_argument))
|
||||
expected_condition = getattr(ExpectedConditions, ec_name)
|
||||
return WebDriverWait(driver, timeout).until(expected_condition(ec_argument))
|
||||
|
||||
def wait_on_presence(self, driver, locator, timeout=30):
|
||||
ec_name = 'presence_of_element_located'
|
||||
@@ -281,7 +283,7 @@ class ScreenshotTestCase(SeleniumTestCase):
|
||||
locations = ()
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(ScreenshotTestCase, self).__init__(*args, **kwargs)
|
||||
super().__init__(*args, **kwargs)
|
||||
screenshot_base_dir = os.path.join('tmp', 'test-screenshots')
|
||||
self.screenshot_path = screenshot_base_dir
|
||||
self.screenshot_sequences = {}
|
||||
@@ -298,7 +300,7 @@ class ScreenshotTestCase(SeleniumTestCase):
|
||||
else:
|
||||
self.screenshot_sequences[sequence] = 1
|
||||
n = self.screenshot_sequences[sequence]
|
||||
sequence = u'%s-%04d-' % (sequence, n)
|
||||
sequence = '%s-%04d-' % (sequence, n)
|
||||
if title is None:
|
||||
location = self.selenium.current_url
|
||||
if location.startswith(self.live_server_url):
|
||||
@@ -308,7 +310,7 @@ class ScreenshotTestCase(SeleniumTestCase):
|
||||
location = 'root'
|
||||
title = location
|
||||
|
||||
base_name = u'{timestamp}-{prefix}{sequence}{title}.png'.format(
|
||||
base_name = '{timestamp}-{prefix}{sequence}{title}.png'.format(
|
||||
timestamp=datetime.datetime.now().strftime('%Y%m%d-%H%M%S.%f'),
|
||||
prefix=self.screenshot_prefix,
|
||||
sequence=sequence,
|
||||
|
||||
@@ -48,8 +48,8 @@ class DefaultSettingTestCase(SimpleTestCase):
|
||||
|
||||
re_validator = r'[a-z]'
|
||||
|
||||
valid_values = u'aocd'
|
||||
invalid_values = u'Aö1.'
|
||||
valid_values = 'aocd'
|
||||
invalid_values = 'Aö1.'
|
||||
|
||||
setting = DefaultSetting(name, None, validator=re_validator)
|
||||
for val in valid_values:
|
||||
@@ -89,7 +89,7 @@ class AppSettingsTestCase(SimpleTestCase):
|
||||
DefaultSetting('no_test_setting', ImproperlyConfigured),
|
||||
)
|
||||
with self.assertRaisesRegex(ImproperlyConfigured, 'NO_TEST_SETTING must be defined in main.settings-dav_base'):
|
||||
app_settings = AppSettings(self.app_name, default_settings)
|
||||
_ = AppSettings(self.app_name, default_settings)
|
||||
|
||||
def test_improperlyconfigured_by_instance(self):
|
||||
"""Test if mandatory but unset setting raise correct exception"""
|
||||
@@ -97,17 +97,17 @@ class AppSettingsTestCase(SimpleTestCase):
|
||||
DefaultSetting('no_test_setting', ImproperlyConfigured('Some Error Message')),
|
||||
)
|
||||
with self.assertRaisesRegex(ImproperlyConfigured, 'Some Error Message'):
|
||||
app_settings = AppSettings(self.app_name, default_settings)
|
||||
_ = AppSettings(self.app_name, default_settings)
|
||||
|
||||
def test_improperlyconfigured_by_func(self):
|
||||
"""Test if invalid setting raise correct exception"""
|
||||
def validator(value):
|
||||
def validator(value): # pylint: disable=unused-argument
|
||||
return False
|
||||
default_settings = (
|
||||
DefaultSetting('test_setting', 1, validator=validator),
|
||||
)
|
||||
with self.assertRaises(ImproperlyConfigured):
|
||||
app_settings = AppSettings(self.app_name, default_settings)
|
||||
_ = AppSettings(self.app_name, default_settings)
|
||||
|
||||
def test_improperlyconfigured_by_regex(self):
|
||||
"""Test if invalid setting raise correct exception"""
|
||||
@@ -115,7 +115,7 @@ class AppSettingsTestCase(SimpleTestCase):
|
||||
DefaultSetting('test_setting', 1, validator=r'^[01]$'),
|
||||
)
|
||||
with self.assertRaises(ImproperlyConfigured):
|
||||
app_settings = AppSettings(self.app_name, default_settings)
|
||||
_ = AppSettings(self.app_name, default_settings)
|
||||
|
||||
def test_settings_from_file(self):
|
||||
"""Test if value from settings file eliminate exception"""
|
||||
@@ -145,7 +145,7 @@ class AppSettingsTestCase(SimpleTestCase):
|
||||
class AppConfigTestCase(SimpleTestCase):
|
||||
def test_init(self):
|
||||
app_name = 'dav_base'
|
||||
import dav_base as app_module
|
||||
import dav_base as app_module # pylint: disable=import-outside-toplevel
|
||||
|
||||
test_default_settings = (
|
||||
DefaultSetting('test_setting', ImproperlyConfigured),
|
||||
@@ -154,7 +154,7 @@ class AppConfigTestCase(SimpleTestCase):
|
||||
|
||||
class TestAppConfig(AppConfig):
|
||||
name = 'not_dav_base'
|
||||
verbose_name = u'DAV Base App'
|
||||
verbose_name = 'DAV Base App'
|
||||
default_settings = test_default_settings
|
||||
|
||||
app_config = TestAppConfig(app_name, app_module)
|
||||
|
||||
@@ -10,7 +10,7 @@ MAIL_TEMPLATE = 'dav_base/tests/mail.txt'
|
||||
|
||||
class TestCase(EmailTestMixin, SimpleTestCase):
|
||||
def test_no_template_configured(self):
|
||||
class ConcreteMail(AbstractMail):
|
||||
class ConcreteMail(AbstractMail): # pylint: disable=abstract-method disable=too-few-public-methods
|
||||
pass
|
||||
|
||||
email = ConcreteMail()
|
||||
@@ -18,7 +18,7 @@ class TestCase(EmailTestMixin, SimpleTestCase):
|
||||
email.send()
|
||||
|
||||
def test_no_get_recipients_implemented(self):
|
||||
class ConcreteMail(AbstractMail):
|
||||
class ConcreteMail(AbstractMail): # pylint: disable=abstract-method disable=too-few-public-methods
|
||||
_template_name = MAIL_TEMPLATE
|
||||
|
||||
email = ConcreteMail()
|
||||
@@ -28,7 +28,7 @@ class TestCase(EmailTestMixin, SimpleTestCase):
|
||||
def test_send(self):
|
||||
recipient = 'root@localhost'
|
||||
|
||||
class ConcreteMail(AbstractMail):
|
||||
class ConcreteMail(AbstractMail): # pylint: disable=too-few-public-methods
|
||||
_template_name = MAIL_TEMPLATE
|
||||
|
||||
def _get_recipients(self):
|
||||
@@ -42,5 +42,5 @@ class TestCase(EmailTestMixin, SimpleTestCase):
|
||||
|
||||
self.assertSender(mail)
|
||||
self.assertRecipients(mail, [recipient])
|
||||
self.assertSubject(mail, u'')
|
||||
self.assertSubject(mail, '')
|
||||
self.assertBody(mail, 'MAILBODY')
|
||||
|
||||
@@ -5,7 +5,7 @@ from django.test import SimpleTestCase
|
||||
|
||||
class TemplatesTestCase(SimpleTestCase):
|
||||
def setUp(self):
|
||||
super(TemplatesTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.response_from_root_view = self.client.get('/')
|
||||
|
||||
def test_template_usage(self):
|
||||
|
||||
@@ -10,4 +10,4 @@ DAVNumberValidator = RegexValidator(r'^'
|
||||
r'(\*[0-9]{4}\*[0-9]{4})?'
|
||||
r'([* ][0-9]{8})?'
|
||||
r'$',
|
||||
_(u'Ungültiges Format.'))
|
||||
_('Ungültiges Format.'))
|
||||
|
||||
@@ -7,7 +7,7 @@ class RootView(generic.TemplateView):
|
||||
template_name = 'dav_base/root.html'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
c = super(RootView, self).get_context_data(**kwargs)
|
||||
c = super().get_context_data(**kwargs)
|
||||
root_urls = []
|
||||
for module_meta_obj in settings.MODULE_CONFIG.modules.values():
|
||||
root_url_name = 'root'
|
||||
|
||||
Reference in New Issue
Block a user