misc: apply double-quote-string-fixer (#79788)
This commit is contained in:
parent
029f77cb38
commit
9d8876e155
|
@ -388,9 +388,9 @@ class ChartNgCell(CellBase):
|
||||||
chart, data['series'][0]['data']
|
chart, data['series'][0]['data']
|
||||||
)
|
)
|
||||||
if self.chart_type == 'pie':
|
if self.chart_type == 'pie':
|
||||||
data["series"] = [
|
data['series'] = [
|
||||||
{"label": chart.config.x_value_formatter(label), "data": [data]}
|
{'label': chart.config.x_value_formatter(label), 'data': [data]}
|
||||||
for label, data in zip(chart.x_labels, data["series"][0]["data"])
|
for label, data in zip(chart.x_labels, data['series'][0]['data'])
|
||||||
if data
|
if data
|
||||||
]
|
]
|
||||||
elif self.chart_type == 'dot':
|
elif self.chart_type == 'dot':
|
||||||
|
|
|
@ -100,7 +100,7 @@ def lingo_check_request_signature(request):
|
||||||
|
|
||||||
class LocaleDecimal(Decimal):
|
class LocaleDecimal(Decimal):
|
||||||
# accept , instead of . for French users comfort
|
# accept , instead of . for French users comfort
|
||||||
def __new__(cls, value="0", *args, **kwargs):
|
def __new__(cls, value='0', *args, **kwargs):
|
||||||
if isinstance(value, str) and settings.LANGUAGE_CODE.startswith('fr-'):
|
if isinstance(value, str) and settings.LANGUAGE_CODE.startswith('fr-'):
|
||||||
value = value.replace(',', '.')
|
value = value.replace(',', '.')
|
||||||
return super().__new__(cls, value, *args, **kwargs)
|
return super().__new__(cls, value, *args, **kwargs)
|
||||||
|
@ -573,7 +573,7 @@ def get_payment_status_view(transaction_id=None, next_url=None):
|
||||||
params.append(('transaction-id', signing_dumps(transaction_id)))
|
params.append(('transaction-id', signing_dumps(transaction_id)))
|
||||||
if next_url:
|
if next_url:
|
||||||
params.append(('next', next_url))
|
params.append(('next', next_url))
|
||||||
return "%s?%s" % (url, urlencode(params))
|
return '%s?%s' % (url, urlencode(params))
|
||||||
|
|
||||||
|
|
||||||
class BasketItemPayView(PayMixin, View):
|
class BasketItemPayView(PayMixin, View):
|
||||||
|
@ -640,7 +640,7 @@ class PaymentView(View):
|
||||||
|
|
||||||
if not payment_backend:
|
if not payment_backend:
|
||||||
logger.error('lingo: payment backend not found on callback kwargs=%r', kwargs)
|
logger.error('lingo: payment backend not found on callback kwargs=%r', kwargs)
|
||||||
raise Http404("A payment backend or regie primary key or slug must be specified")
|
raise Http404('A payment backend or regie primary key or slug must be specified')
|
||||||
|
|
||||||
payment = payment_backend.make_eopayment(request=request)
|
payment = payment_backend.make_eopayment(request=request)
|
||||||
if not backend_response and not payment.has_empty_response:
|
if not backend_response and not payment.has_empty_response:
|
||||||
|
|
|
@ -173,7 +173,7 @@ class MapLayer(models.Model):
|
||||||
cache_duration = models.PositiveIntegerField(_('Cache duration'), default=60, help_text=_('In seconds.'))
|
cache_duration = models.PositiveIntegerField(_('Cache duration'), default=60, help_text=_('In seconds.'))
|
||||||
include_user_identifier = models.BooleanField(_('Include user identifier in request'), default=True)
|
include_user_identifier = models.BooleanField(_('Include user identifier in request'), default=True)
|
||||||
geojson_query_parameter = models.CharField(
|
geojson_query_parameter = models.CharField(
|
||||||
_("Query parameter for fulltext requests"),
|
_('Query parameter for fulltext requests'),
|
||||||
max_length=100,
|
max_length=100,
|
||||||
blank=True,
|
blank=True,
|
||||||
help_text=_('Name of the parameter to use for querying the GeoJSON layer (typically, q)'),
|
help_text=_('Name of the parameter to use for querying the GeoJSON layer (typically, q)'),
|
||||||
|
@ -268,7 +268,7 @@ class MapLayer(models.Model):
|
||||||
return {
|
return {
|
||||||
'type': 'FeatureCollection',
|
'type': 'FeatureCollection',
|
||||||
'features': [],
|
'features': [],
|
||||||
'_combo_err_desc': "Bad response from requested URL (%s)" % e,
|
'_combo_err_desc': 'Bad response from requested URL (%s)' % e,
|
||||||
}
|
}
|
||||||
try:
|
try:
|
||||||
data = response.json()
|
data = response.json()
|
||||||
|
@ -276,13 +276,13 @@ class MapLayer(models.Model):
|
||||||
return {
|
return {
|
||||||
'type': 'FeatureCollection',
|
'type': 'FeatureCollection',
|
||||||
'features': [],
|
'features': [],
|
||||||
'_combo_err_desc': "Non JSON response from requested URL",
|
'_combo_err_desc': 'Non JSON response from requested URL',
|
||||||
}
|
}
|
||||||
if data is None:
|
if data is None:
|
||||||
return {
|
return {
|
||||||
'type': 'FeatureCollection',
|
'type': 'FeatureCollection',
|
||||||
'features': [],
|
'features': [],
|
||||||
'_combo_err_desc': "Empty JSON response",
|
'_combo_err_desc': 'Empty JSON response',
|
||||||
}
|
}
|
||||||
if 'features' in data:
|
if 'features' in data:
|
||||||
features = data['features']
|
features = data['features']
|
||||||
|
@ -293,20 +293,20 @@ class MapLayer(models.Model):
|
||||||
return {
|
return {
|
||||||
'type': 'FeatureCollection',
|
'type': 'FeatureCollection',
|
||||||
'features': [],
|
'features': [],
|
||||||
'_combo_err_desc': "Wrong GeoJSON response",
|
'_combo_err_desc': 'Wrong GeoJSON response',
|
||||||
}
|
}
|
||||||
if features:
|
if features:
|
||||||
if not isinstance(features[0], dict):
|
if not isinstance(features[0], dict):
|
||||||
return {
|
return {
|
||||||
'type': 'FeatureCollection',
|
'type': 'FeatureCollection',
|
||||||
'features': [],
|
'features': [],
|
||||||
'_combo_err_desc': "Wrong GeoJSON response",
|
'_combo_err_desc': 'Wrong GeoJSON response',
|
||||||
}
|
}
|
||||||
if not ({'geometry', 'properties'} <= set(features[0].keys())):
|
if not ({'geometry', 'properties'} <= set(features[0].keys())):
|
||||||
return {
|
return {
|
||||||
'type': 'FeatureCollection',
|
'type': 'FeatureCollection',
|
||||||
'features': [],
|
'features': [],
|
||||||
'_combo_err_desc': "Wrong GeoJSON response",
|
'_combo_err_desc': 'Wrong GeoJSON response',
|
||||||
}
|
}
|
||||||
|
|
||||||
if properties:
|
if properties:
|
||||||
|
|
|
@ -71,7 +71,7 @@ class TextEngineSettingsForm(TextEngineSettingsUpdateForm):
|
||||||
label=_('Page'),
|
label=_('Page'),
|
||||||
required=False,
|
required=False,
|
||||||
queryset=Page.objects.none(),
|
queryset=Page.objects.none(),
|
||||||
help_text=_("Select a page to limit the search on this page and sub pages contents."),
|
help_text=_('Select a page to limit the search on this page and sub pages contents.'),
|
||||||
widget=SelectWithDisabled(),
|
widget=SelectWithDisabled(),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ class SearchCell(CellBase):
|
||||||
_search_services = JSONField(_('Search Services'), default=dict, blank=True)
|
_search_services = JSONField(_('Search Services'), default=dict, blank=True)
|
||||||
title = models.CharField(_('Title'), max_length=150, blank=True)
|
title = models.CharField(_('Title'), max_length=150, blank=True)
|
||||||
autofocus = models.BooleanField(_('Autofocus'), default=False)
|
autofocus = models.BooleanField(_('Autofocus'), default=False)
|
||||||
input_placeholder = models.CharField(_('Placeholder'), max_length=64, default="", blank=True)
|
input_placeholder = models.CharField(_('Placeholder'), max_length=64, default='', blank=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = _('Search')
|
verbose_name = _('Search')
|
||||||
|
|
|
@ -1108,7 +1108,7 @@ class CellBase(models.Model, metaclass=CellMeta):
|
||||||
return cells
|
return cells
|
||||||
|
|
||||||
def get_reference(self):
|
def get_reference(self):
|
||||||
"Returns a string that can serve as a unique reference to a cell" ""
|
'Returns a string that can serve as a unique reference to a cell' ''
|
||||||
return str('%s-%s' % (self.get_cell_type_str(), self.id))
|
return str('%s-%s' % (self.get_cell_type_str(), self.id))
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -1620,8 +1620,8 @@ class TextCell(CellBase):
|
||||||
|
|
||||||
text = re.sub(r'src="(.*?)"', sub_src, text)
|
text = re.sub(r'src="(.*?)"', sub_src, text)
|
||||||
text = re.sub(r'href="(.*?)"', sub_href, text)
|
text = re.sub(r'href="(.*?)"', sub_href, text)
|
||||||
extra_context["text"] = mark_safe(text)
|
extra_context['text'] = mark_safe(text)
|
||||||
extra_context["title"] = mark_safe(self.title) if self.title else None
|
extra_context['title'] = mark_safe(self.title) if self.title else None
|
||||||
return extra_context
|
return extra_context
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -179,7 +179,7 @@ def skeleton_extra_placeholder(parser, token):
|
||||||
try:
|
try:
|
||||||
dummy, placeholder_name = token.split_contents()
|
dummy, placeholder_name = token.split_contents()
|
||||||
except ValueError:
|
except ValueError:
|
||||||
raise template.TemplateSyntaxError("%r tag requires exactly one argument" % token.contents.split()[0])
|
raise template.TemplateSyntaxError('%r tag requires exactly one argument' % token.contents.split()[0])
|
||||||
|
|
||||||
tokens_copy = parser.tokens[:]
|
tokens_copy = parser.tokens[:]
|
||||||
if django.VERSION < (3,):
|
if django.VERSION < (3,):
|
||||||
|
|
|
@ -11,6 +11,6 @@ import os
|
||||||
|
|
||||||
from django.core.wsgi import get_wsgi_application
|
from django.core.wsgi import get_wsgi_application
|
||||||
|
|
||||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "combo.settings")
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'combo.settings')
|
||||||
|
|
||||||
application = get_wsgi_application()
|
application = get_wsgi_application()
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == '__main__':
|
||||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "combo.settings")
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'combo.settings')
|
||||||
|
|
||||||
from django.core.management import execute_from_command_line
|
from django.core.management import execute_from_command_line
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import tempfile
|
||||||
DATABASES = {
|
DATABASES = {
|
||||||
'default': {
|
'default': {
|
||||||
'ENGINE': os.environ.get('DB_ENGINE', 'django.db.backends.postgresql_psycopg2'),
|
'ENGINE': os.environ.get('DB_ENGINE', 'django.db.backends.postgresql_psycopg2'),
|
||||||
'NAME': 'combo-test-%s' % os.environ.get("BRANCH_NAME", "").replace('/', '-')[:35],
|
'NAME': 'combo-test-%s' % os.environ.get('BRANCH_NAME', '').replace('/', '-')[:35],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ USER_PROFILE_CONFIG = {
|
||||||
|
|
||||||
LEGACY_URLS_MAPPING = {'old.org': 'new.org'}
|
LEGACY_URLS_MAPPING = {'old.org': 'new.org'}
|
||||||
|
|
||||||
PASSWORD_HASHERS = ["django.contrib.auth.hashers.MD5PasswordHasher"]
|
PASSWORD_HASHERS = ['django.contrib.auth.hashers.MD5PasswordHasher']
|
||||||
|
|
||||||
REST_FRAMEWORK = {
|
REST_FRAMEWORK = {
|
||||||
# this is the default value but by explicitely setting it
|
# this is the default value but by explicitely setting it
|
||||||
|
|
|
@ -1027,7 +1027,7 @@ def test_config_json_cell_with_param_in_url(app):
|
||||||
'url': 'http://foo?var=[identifier]',
|
'url': 'http://foo?var=[identifier]',
|
||||||
'log_errors': False,
|
'log_errors': False,
|
||||||
'timeout': 42,
|
'timeout': 42,
|
||||||
'form': [{"varname": "identifier", "type": "string", "label": "Identifier"}],
|
'form': [{'varname': 'identifier', 'type': 'string', 'label': 'Identifier'}],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
TEMPLATES=templates_settings,
|
TEMPLATES=templates_settings,
|
||||||
|
@ -1060,8 +1060,8 @@ def test_config_json_cell_with_template_string(settings, context):
|
||||||
'name': 'Foobar',
|
'name': 'Foobar',
|
||||||
'url': 'http://foo',
|
'url': 'http://foo',
|
||||||
'form': [
|
'form': [
|
||||||
{"varname": "identifier", "type": "string", "label": "Identifier"},
|
{'varname': 'identifier', 'type': 'string', 'label': 'Identifier'},
|
||||||
{"varname": "template_string", "type": "text", "label": "Template"},
|
{'varname': 'template_string', 'type': 'text', 'label': 'Template'},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -1084,7 +1084,7 @@ def test_config_json_cell_with_template_string(settings, context):
|
||||||
'name': 'Foobar',
|
'name': 'Foobar',
|
||||||
'url': 'http://foo',
|
'url': 'http://foo',
|
||||||
'form': [
|
'form': [
|
||||||
{"varname": "identifier", "type": "string", "label": "Identifier"},
|
{'varname': 'identifier', 'type': 'string', 'label': 'Identifier'},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -1103,14 +1103,14 @@ def test_config_json_cell_with_global(settings, app):
|
||||||
'url': 'http://foo',
|
'url': 'http://foo',
|
||||||
'make_global': 'new_global_context',
|
'make_global': 'new_global_context',
|
||||||
'form': [
|
'form': [
|
||||||
{"varname": "template_string", "type": "text", "label": "Template"},
|
{'varname': 'template_string', 'type': 'text', 'label': 'Template'},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
'test-config-json-cell-2': {
|
'test-config-json-cell-2': {
|
||||||
'name': 'Foobar 2',
|
'name': 'Foobar 2',
|
||||||
'url': 'http://foo',
|
'url': 'http://foo',
|
||||||
'form': [
|
'form': [
|
||||||
{"varname": "template_string", "type": "text", "label": "Template"},
|
{'varname': 'template_string', 'type': 'text', 'label': 'Template'},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -1152,7 +1152,7 @@ def test_config_json_cell_with_repeat(settings, app):
|
||||||
'name': 'Foobar',
|
'name': 'Foobar',
|
||||||
'url': 'http://foo',
|
'url': 'http://foo',
|
||||||
'form': [
|
'form': [
|
||||||
{"varname": "template_string", "type": "text", "label": "Template"},
|
{'varname': 'template_string', 'type': 'text', 'label': 'Template'},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
'test-config-json-cell-2': {
|
'test-config-json-cell-2': {
|
||||||
|
@ -1160,7 +1160,7 @@ def test_config_json_cell_with_repeat(settings, app):
|
||||||
'url': 'http://foo',
|
'url': 'http://foo',
|
||||||
'repeat': '3',
|
'repeat': '3',
|
||||||
'form': [
|
'form': [
|
||||||
{"varname": "template_string", "type": "text", "label": "Template"},
|
{'varname': 'template_string', 'type': 'text', 'label': 'Template'},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -1574,8 +1574,8 @@ def test_page_cell_placeholder_restricted_visibility(app, admin_user):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
assert "<p>Public text</p>" in resp.text
|
assert '<p>Public text</p>' in resp.text
|
||||||
assert "<p>Private text</p>" not in resp.text
|
assert '<p>Private text</p>' not in resp.text
|
||||||
|
|
||||||
app = login(app)
|
app = login(app)
|
||||||
resp = app.get(
|
resp = app.get(
|
||||||
|
@ -1586,7 +1586,7 @@ def test_page_cell_placeholder_restricted_visibility(app, admin_user):
|
||||||
)
|
)
|
||||||
|
|
||||||
assert resp.pyquery('.shown-because-admin').text() == 'Public text'
|
assert resp.pyquery('.shown-because-admin').text() == 'Public text'
|
||||||
assert "<p>Private text</p>" in resp.text
|
assert '<p>Private text</p>' in resp.text
|
||||||
|
|
||||||
|
|
||||||
def test_page_cell_placeholder_text_cell_title(app, admin_user):
|
def test_page_cell_placeholder_text_cell_title(app, admin_user):
|
||||||
|
|
|
@ -416,34 +416,34 @@ STATISTICS_LIST = {
|
||||||
'url': 'https://authentic.example.com/api/statistics/one-serie/',
|
'url': 'https://authentic.example.com/api/statistics/one-serie/',
|
||||||
'name': 'One serie stat',
|
'name': 'One serie stat',
|
||||||
'id': 'one-serie',
|
'id': 'one-serie',
|
||||||
"filters": [
|
'filters': [
|
||||||
{
|
{
|
||||||
"default": "month",
|
'default': 'month',
|
||||||
"id": "time_interval",
|
'id': 'time_interval',
|
||||||
"label": "Time interval",
|
'label': 'Time interval',
|
||||||
"options": [
|
'options': [
|
||||||
{"id": "day", "label": "Day"},
|
{'id': 'day', 'label': 'Day'},
|
||||||
{"id": "month", "label": "Month"},
|
{'id': 'month', 'label': 'Month'},
|
||||||
{"id": "year", "label": "Year"},
|
{'id': 'year', 'label': 'Year'},
|
||||||
],
|
],
|
||||||
"required": True,
|
'required': True,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "ou",
|
'id': 'ou',
|
||||||
"label": "Organizational Unit",
|
'label': 'Organizational Unit',
|
||||||
"options": [
|
'options': [
|
||||||
{"id": "default", "label": "Default OU"},
|
{'id': 'default', 'label': 'Default OU'},
|
||||||
{"id": "other", "label": "Other OU"},
|
{'id': 'other', 'label': 'Other OU'},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "service",
|
'id': 'service',
|
||||||
"label": "Service",
|
'label': 'Service',
|
||||||
"options": [
|
'options': [
|
||||||
{"id": "chrono", "label": "Chrono"},
|
{'id': 'chrono', 'label': 'Chrono'},
|
||||||
{"id": "combo", "label": "Combo"},
|
{'id': 'combo', 'label': 'Combo'},
|
||||||
],
|
],
|
||||||
"default": "chrono",
|
'default': 'chrono',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
@ -466,15 +466,15 @@ STATISTICS_LIST = {
|
||||||
'url': 'https://authentic.example.com/api/statistics/daily/',
|
'url': 'https://authentic.example.com/api/statistics/daily/',
|
||||||
'name': 'Daily discontinuous serie',
|
'name': 'Daily discontinuous serie',
|
||||||
'id': 'daily',
|
'id': 'daily',
|
||||||
"filters": [
|
'filters': [
|
||||||
{
|
{
|
||||||
"default": "day",
|
'default': 'day',
|
||||||
"id": "time_interval",
|
'id': 'time_interval',
|
||||||
"label": "Time interval",
|
'label': 'Time interval',
|
||||||
"options": [
|
'options': [
|
||||||
{"id": "day", "label": "Day"},
|
{'id': 'day', 'label': 'Day'},
|
||||||
],
|
],
|
||||||
"required": True,
|
'required': True,
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
@ -482,15 +482,15 @@ STATISTICS_LIST = {
|
||||||
'url': 'https://authentic.example.com/api/statistics/leap-week/',
|
'url': 'https://authentic.example.com/api/statistics/leap-week/',
|
||||||
'name': 'Same week spanning two years',
|
'name': 'Same week spanning two years',
|
||||||
'id': 'leap-week',
|
'id': 'leap-week',
|
||||||
"filters": [
|
'filters': [
|
||||||
{
|
{
|
||||||
"default": "day",
|
'default': 'day',
|
||||||
"id": "time_interval",
|
'id': 'time_interval',
|
||||||
"label": "Time interval",
|
'label': 'Time interval',
|
||||||
"options": [
|
'options': [
|
||||||
{"id": "day", "label": "Day"},
|
{'id': 'day', 'label': 'Day'},
|
||||||
],
|
],
|
||||||
"required": True,
|
'required': True,
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
@ -498,16 +498,16 @@ STATISTICS_LIST = {
|
||||||
'url': 'https://authentic.example.com/api/statistics/filter-multiple/',
|
'url': 'https://authentic.example.com/api/statistics/filter-multiple/',
|
||||||
'name': 'Filter on multiple values',
|
'name': 'Filter on multiple values',
|
||||||
'id': 'filter-multiple',
|
'id': 'filter-multiple',
|
||||||
"filters": [
|
'filters': [
|
||||||
{
|
{
|
||||||
"id": "color",
|
'id': 'color',
|
||||||
"label": "Color",
|
'label': 'Color',
|
||||||
"options": [
|
'options': [
|
||||||
{"id": "red", "label": "Red"},
|
{'id': 'red', 'label': 'Red'},
|
||||||
{"id": "green", "label": "Green"},
|
{'id': 'green', 'label': 'Green'},
|
||||||
{"id": "blue", "label": "Blue"},
|
{'id': 'blue', 'label': 'Blue'},
|
||||||
],
|
],
|
||||||
"multiple": True,
|
'multiple': True,
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
@ -546,24 +546,24 @@ STATISTICS_LIST = {
|
||||||
'url': 'https://authentic.example.com/api/statistics/option-groups/',
|
'url': 'https://authentic.example.com/api/statistics/option-groups/',
|
||||||
'name': 'Option groups',
|
'name': 'Option groups',
|
||||||
'id': 'option-groups',
|
'id': 'option-groups',
|
||||||
"filters": [
|
'filters': [
|
||||||
{
|
{
|
||||||
"id": "form",
|
'id': 'form',
|
||||||
"label": "Form",
|
'label': 'Form',
|
||||||
"options": [
|
'options': [
|
||||||
[None, [{'id': 'all', 'label': 'All'}]],
|
[None, [{'id': 'all', 'label': 'All'}]],
|
||||||
['Category A', [{'id': 'test', 'label': 'Test'}]],
|
['Category A', [{'id': 'test', 'label': 'Test'}]],
|
||||||
['Category B', [{'id': 'test-2', 'label': 'test 2'}]],
|
['Category B', [{'id': 'test-2', 'label': 'test 2'}]],
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "cards_count",
|
'id': 'cards_count',
|
||||||
"label": "Cards",
|
'label': 'Cards',
|
||||||
"options": [
|
'options': [
|
||||||
['Category A', [{'id': 'test', 'label': 'Test'}]],
|
['Category A', [{'id': 'test', 'label': 'Test'}]],
|
||||||
['Category B', [{'id': 'test-2', 'label': 'test 2'}]],
|
['Category B', [{'id': 'test-2', 'label': 'test 2'}]],
|
||||||
],
|
],
|
||||||
"required": True,
|
'required': True,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
@ -571,12 +571,12 @@ STATISTICS_LIST = {
|
||||||
'url': 'https://authentic.example.com/api/statistics/option-groups-2/',
|
'url': 'https://authentic.example.com/api/statistics/option-groups-2/',
|
||||||
'name': 'Option groups 2',
|
'name': 'Option groups 2',
|
||||||
'id': 'option-groups-2',
|
'id': 'option-groups-2',
|
||||||
"filters": [
|
'filters': [
|
||||||
{
|
{
|
||||||
"id": "form",
|
'id': 'form',
|
||||||
"label": "Form",
|
'label': 'Form',
|
||||||
"required": True,
|
'required': True,
|
||||||
"options": [
|
'options': [
|
||||||
[None, [{'id': 'all', 'label': 'All'}]],
|
[None, [{'id': 'all', 'label': 'All'}]],
|
||||||
['Category A', [{'id': 'test', 'label': 'Test'}, {'id': 'other', 'label': 'Other'}]],
|
['Category A', [{'id': 'test', 'label': 'Test'}, {'id': 'other', 'label': 'Other'}]],
|
||||||
],
|
],
|
||||||
|
@ -587,10 +587,10 @@ STATISTICS_LIST = {
|
||||||
'url': 'https://authentic.example.com/api/statistics/deprecated-filter/',
|
'url': 'https://authentic.example.com/api/statistics/deprecated-filter/',
|
||||||
'name': 'Deprecated filter',
|
'name': 'Deprecated filter',
|
||||||
'id': 'deprecated-filter',
|
'id': 'deprecated-filter',
|
||||||
"filters": [
|
'filters': [
|
||||||
{
|
{
|
||||||
"id": "form",
|
'id': 'form',
|
||||||
"label": "Form",
|
'label': 'Form',
|
||||||
'deprecated': True,
|
'deprecated': True,
|
||||||
'deprecation_hint': 'This field should not be used',
|
'deprecation_hint': 'This field should not be used',
|
||||||
'options': [
|
'options': [
|
||||||
|
@ -599,8 +599,8 @@ STATISTICS_LIST = {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "card",
|
'id': 'card',
|
||||||
"label": "Card",
|
'label': 'Card',
|
||||||
'deprecated': True,
|
'deprecated': True,
|
||||||
'options': [
|
'options': [
|
||||||
{'id': 'one', 'label': 'One'},
|
{'id': 'one', 'label': 'One'},
|
||||||
|
@ -614,15 +614,15 @@ STATISTICS_LIST = {
|
||||||
'url': 'https://authentic.example.com/api/statistics/required-without-default/',
|
'url': 'https://authentic.example.com/api/statistics/required-without-default/',
|
||||||
'name': 'Required without default',
|
'name': 'Required without default',
|
||||||
'id': 'required-without-default',
|
'id': 'required-without-default',
|
||||||
"filters": [
|
'filters': [
|
||||||
{
|
{
|
||||||
"id": "test",
|
'id': 'test',
|
||||||
"label": "Test",
|
'label': 'Test',
|
||||||
"options": [
|
'options': [
|
||||||
{"id": "b", "label": "B"},
|
{'id': 'b', 'label': 'B'},
|
||||||
{"id": "a", "label": "A"},
|
{'id': 'a', 'label': 'A'},
|
||||||
],
|
],
|
||||||
"required": True,
|
'required': True,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
@ -652,16 +652,16 @@ STATISTICS_LIST = {
|
||||||
'url': 'https://authentic.example.com/api/statistics/required-boolean/',
|
'url': 'https://authentic.example.com/api/statistics/required-boolean/',
|
||||||
'name': 'Required boolean choices',
|
'name': 'Required boolean choices',
|
||||||
'id': 'required-boolean',
|
'id': 'required-boolean',
|
||||||
"filters": [
|
'filters': [
|
||||||
{
|
{
|
||||||
"id": "test",
|
'id': 'test',
|
||||||
"label": "Test",
|
'label': 'Test',
|
||||||
"options": [
|
'options': [
|
||||||
{"id": "true", "label": "True"},
|
{'id': 'true', 'label': 'True'},
|
||||||
{"id": "false", "label": "False"},
|
{'id': 'false', 'label': 'False'},
|
||||||
],
|
],
|
||||||
"default": "true",
|
'default': 'true',
|
||||||
"required": True,
|
'required': True,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
@ -742,11 +742,11 @@ def new_api_mock(url, request):
|
||||||
if 'form=food-request' in url.query:
|
if 'form=food-request' in url.query:
|
||||||
response['data']['subfilters'] = [
|
response['data']['subfilters'] = [
|
||||||
{
|
{
|
||||||
"id": "menu",
|
'id': 'menu',
|
||||||
"label": "Menu",
|
'label': 'Menu',
|
||||||
"options": [
|
'options': [
|
||||||
{"id": "meat", "label": "Meat"},
|
{'id': 'meat', 'label': 'Meat'},
|
||||||
{"id": "vegan", "label": "Vegan"},
|
{'id': 'vegan', 'label': 'Vegan'},
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -788,8 +788,8 @@ def new_api_mock(url, request):
|
||||||
@with_httmock(bijoe_mock)
|
@with_httmock(bijoe_mock)
|
||||||
def statistics(settings):
|
def statistics(settings):
|
||||||
settings.KNOWN_SERVICES = {
|
settings.KNOWN_SERVICES = {
|
||||||
"bijoe": {
|
'bijoe': {
|
||||||
"plop": {"title": "test", "url": "https://bijoe.example.com", "secret": "combo", "orig": "combo"}
|
'plop': {'title': 'test', 'url': 'https://bijoe.example.com', 'secret': 'combo', 'orig': 'combo'}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
settings.STATISTICS_PROVIDERS = ['bijoe']
|
settings.STATISTICS_PROVIDERS = ['bijoe']
|
||||||
|
|
|
@ -210,15 +210,15 @@ def test_tipi_cell():
|
||||||
cell = TipiPaymentFormCell()
|
cell = TipiPaymentFormCell()
|
||||||
cell.page = page
|
cell.page = page
|
||||||
cell.title = 'TIPI Payment'
|
cell.title = 'TIPI Payment'
|
||||||
cell.regies = "1234"
|
cell.regies = '1234'
|
||||||
cell.order = 0
|
cell.order = 0
|
||||||
cell.save()
|
cell.save()
|
||||||
assert cell.control_protocol == 'pesv2'
|
assert cell.control_protocol == 'pesv2'
|
||||||
assert cell.url == 'https://www.payfip.gouv.fr/tpa/paiement.web'
|
assert cell.url == 'https://www.payfip.gouv.fr/tpa/paiement.web'
|
||||||
assert cell.default_template_name == 'lingo/tipi_form.html'
|
assert cell.default_template_name == 'lingo/tipi_form.html'
|
||||||
html = cell.render({})
|
html = cell.render({})
|
||||||
assert "<h2>TIPI Payment</h2>" in html
|
assert '<h2>TIPI Payment</h2>' in html
|
||||||
assert "Community identifier" not in html
|
assert 'Community identifier' not in html
|
||||||
assert '<input type="hidden" id="numcli" value="1234" />' in html
|
assert '<input type="hidden" id="numcli" value="1234" />' in html
|
||||||
assert 'id="exer"' in html
|
assert 'id="exer"' in html
|
||||||
assert 'id="idpce"' in html
|
assert 'id="idpce"' in html
|
||||||
|
@ -229,12 +229,12 @@ def test_tipi_cell():
|
||||||
assert 'data-saisie="M"' in html
|
assert 'data-saisie="M"' in html
|
||||||
assert 'data-pesv2="True"' in html
|
assert 'data-pesv2="True"' in html
|
||||||
|
|
||||||
cell.regies = "1234 - test regie"
|
cell.regies = '1234 - test regie'
|
||||||
cell.save()
|
cell.save()
|
||||||
html = cell.render({})
|
html = cell.render({})
|
||||||
assert '<input type="hidden" id="numcli" value="1234" />' in html
|
assert '<input type="hidden" id="numcli" value="1234" />' in html
|
||||||
|
|
||||||
cell.regies = "test regie"
|
cell.regies = 'test regie'
|
||||||
cell.save()
|
cell.save()
|
||||||
html = cell.render({})
|
html = cell.render({})
|
||||||
assert '<input type="hidden" id="numcli" value="" />' in html
|
assert '<input type="hidden" id="numcli" value="" />' in html
|
||||||
|
@ -252,12 +252,12 @@ def test_tipi_cell():
|
||||||
assert 'data-pesv2="False"' in html
|
assert 'data-pesv2="False"' in html
|
||||||
|
|
||||||
cell_media = str(cell.media)
|
cell_media = str(cell.media)
|
||||||
assert "js/tipi.js" in cell_media
|
assert 'js/tipi.js' in cell_media
|
||||||
|
|
||||||
cell.regies = '1 regie1, 2- regie2,3 : regie3,4,5regie5 ,bad-format-regie 6'
|
cell.regies = '1 regie1, 2- regie2,3 : regie3,4,5regie5 ,bad-format-regie 6'
|
||||||
cell.save()
|
cell.save()
|
||||||
html = cell.render({})
|
html = cell.render({})
|
||||||
assert "Community identifier" in html
|
assert 'Community identifier' in html
|
||||||
assert '<select id="numcli">' in html
|
assert '<select id="numcli">' in html
|
||||||
assert '<option value="1">1 regie1</option>' in html
|
assert '<option value="1">1 regie1</option>' in html
|
||||||
assert '<option value="2">2- regie2</option>' in html
|
assert '<option value="2">2- regie2</option>' in html
|
||||||
|
|
|
@ -495,7 +495,7 @@ def test_basket_items_extra_info_no_basket(app, regie, basket_page, monkeypatch)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("invalid_capture_date", [8, '', 'not-a-date'])
|
@pytest.mark.parametrize('invalid_capture_date', [8, '', 'not-a-date'])
|
||||||
def test_add_basket_capture_date_format(app, user_name_id, regie, invalid_capture_date):
|
def test_add_basket_capture_date_format(app, user_name_id, regie, invalid_capture_date):
|
||||||
url = '%s?NameId=%s' % (reverse('api-add-basket-item'), user_name_id)
|
url = '%s?NameId=%s' % (reverse('api-add-basket-item'), user_name_id)
|
||||||
data = {'amount': 10, 'display_name': 'test item'}
|
data = {'amount': 10, 'display_name': 'test item'}
|
||||||
|
@ -547,7 +547,7 @@ def test_cant_pay_if_different_capture_date(mock_trigger_request, app, basket_pa
|
||||||
assert resp.status_code == 302
|
assert resp.status_code == 302
|
||||||
assert urllib.parse.urlparse(resp.location).path == '/test_basket_cell/'
|
assert urllib.parse.urlparse(resp.location).path == '/test_basket_cell/'
|
||||||
resp = resp.follow()
|
resp = resp.follow()
|
||||||
assert "Invalid grouping for basket items: different capture dates." in resp.text
|
assert 'Invalid grouping for basket items: different capture dates.' in resp.text
|
||||||
assert mock_trigger_request.call_count == 0
|
assert mock_trigger_request.call_count == 0
|
||||||
|
|
||||||
|
|
||||||
|
@ -1543,7 +1543,7 @@ def test_payment_callback_not_found(app, user, regie):
|
||||||
app.get(callback_url, params=data, status=404)
|
app.get(callback_url, params=data, status=404)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("authenticated", [True, False])
|
@pytest.mark.parametrize('authenticated', [True, False])
|
||||||
def test_payment_no_basket(app, user_name_id, regie, authenticated):
|
def test_payment_no_basket(app, user_name_id, regie, authenticated):
|
||||||
url = reverse('api-add-basket-item')
|
url = reverse('api-add-basket-item')
|
||||||
source_url = 'http://example.org/item/1/'
|
source_url = 'http://example.org/item/1/'
|
||||||
|
|
|
@ -150,10 +150,10 @@ def test_invoices_cell_get_payer_external_id(remote_regie):
|
||||||
assert cell.get_payer_external_id(context) is None
|
assert cell.get_payer_external_id(context) is None
|
||||||
|
|
||||||
cell.payer_external_id_template = '{{ "" }}' # empty
|
cell.payer_external_id_template = '{{ "" }}' # empty
|
||||||
assert cell.get_payer_external_id(context) == ""
|
assert cell.get_payer_external_id(context) == ''
|
||||||
|
|
||||||
cell.payer_external_id_template = '{{ "foo" }}' # something
|
cell.payer_external_id_template = '{{ "foo" }}' # something
|
||||||
assert cell.get_payer_external_id(context) == "foo"
|
assert cell.get_payer_external_id(context) == 'foo'
|
||||||
|
|
||||||
# check that cards|objects is working
|
# check that cards|objects is working
|
||||||
data = {'data': []}
|
data = {'data': []}
|
||||||
|
@ -162,7 +162,7 @@ def test_invoices_cell_get_payer_external_id(remote_regie):
|
||||||
cell.payer_external_id_template = (
|
cell.payer_external_id_template = (
|
||||||
'{{ cards|objects:"foo"|get_full|first|get:"fields"|get:"bar"|default:"baz" }}'
|
'{{ cards|objects:"foo"|get_full|first|get:"fields"|get:"bar"|default:"baz" }}'
|
||||||
)
|
)
|
||||||
assert cell.get_payer_external_id(context) == "baz"
|
assert cell.get_payer_external_id(context) == 'baz'
|
||||||
|
|
||||||
# syntax error
|
# syntax error
|
||||||
cell.payer_external_id_template = '{% for %}'
|
cell.payer_external_id_template = '{% for %}'
|
||||||
|
@ -181,10 +181,10 @@ def test_payments_cell_get_payer_external_id(remote_regie):
|
||||||
assert cell.get_payer_external_id(context) is None
|
assert cell.get_payer_external_id(context) is None
|
||||||
|
|
||||||
cell.payer_external_id_template = '{{ "" }}' # empty
|
cell.payer_external_id_template = '{{ "" }}' # empty
|
||||||
assert cell.get_payer_external_id(context) == ""
|
assert cell.get_payer_external_id(context) == ''
|
||||||
|
|
||||||
cell.payer_external_id_template = '{{ "foo" }}' # something
|
cell.payer_external_id_template = '{{ "foo" }}' # something
|
||||||
assert cell.get_payer_external_id(context) == "foo"
|
assert cell.get_payer_external_id(context) == 'foo'
|
||||||
|
|
||||||
# check that cards|objects is working
|
# check that cards|objects is working
|
||||||
data = {'data': []}
|
data = {'data': []}
|
||||||
|
@ -193,7 +193,7 @@ def test_payments_cell_get_payer_external_id(remote_regie):
|
||||||
cell.payer_external_id_template = (
|
cell.payer_external_id_template = (
|
||||||
'{{ cards|objects:"foo"|get_full|first|get:"fields"|get:"bar"|default:"baz" }}'
|
'{{ cards|objects:"foo"|get_full|first|get:"fields"|get:"bar"|default:"baz" }}'
|
||||||
)
|
)
|
||||||
assert cell.get_payer_external_id(context) == "baz"
|
assert cell.get_payer_external_id(context) == 'baz'
|
||||||
|
|
||||||
# syntax error
|
# syntax error
|
||||||
cell.payer_external_id_template = '{% for %}'
|
cell.payer_external_id_template = '{% for %}'
|
||||||
|
|
|
@ -1219,7 +1219,7 @@ def test_site_export_import_unknown_page(app, admin_user):
|
||||||
resp = app.get('/manage/site-import')
|
resp = app.get('/manage/site-import')
|
||||||
resp.form['site_file'] = Upload('site-export.json', force_bytes(json.dumps(payload)), 'application/json')
|
resp.form['site_file'] = Upload('site-export.json', force_bytes(json.dumps(payload)), 'application/json')
|
||||||
with mock.patch('combo.data.models.Page.load_serialized_pages') as mock_load:
|
with mock.patch('combo.data.models.Page.load_serialized_pages') as mock_load:
|
||||||
mock_load.side_effect = DeserializationError("Page matching query does not exist.")
|
mock_load.side_effect = DeserializationError('Page matching query does not exist.')
|
||||||
resp = resp.form.submit()
|
resp = resp.form.submit()
|
||||||
assert resp.context['form'].errors['site_file'] == ['Page matching query does not exist.']
|
assert resp.context['form'].errors['site_file'] == ['Page matching query does not exist.']
|
||||||
|
|
||||||
|
@ -2885,7 +2885,7 @@ def test_manager_link_cell_tabs(app, admin_user):
|
||||||
assert not resp.pyquery('#tab-%s-visibility.pk-tabs--button-marker' % cell.get_reference())
|
assert not resp.pyquery('#tab-%s-visibility.pk-tabs--button-marker' % cell.get_reference())
|
||||||
assert not resp.pyquery('[data-tab-slug="appearance"] input[name$="title"]')
|
assert not resp.pyquery('[data-tab-slug="appearance"] input[name$="title"]')
|
||||||
|
|
||||||
cell.title = "Custom"
|
cell.title = 'Custom'
|
||||||
cell.public = False
|
cell.public = False
|
||||||
cell.save()
|
cell.save()
|
||||||
resp = app.get('/manage/pages/%s/' % page.pk)
|
resp = app.get('/manage/pages/%s/' % page.pk)
|
||||||
|
|
|
@ -298,7 +298,7 @@ def test_get_geojson(app, layer, user):
|
||||||
# invalid url - missing scheme
|
# invalid url - missing scheme
|
||||||
resp = app.get(geojson_url)
|
resp = app.get(geojson_url)
|
||||||
assert len(resp.json['features']) == 0
|
assert len(resp.json['features']) == 0
|
||||||
assert resp.json['_combo_err_desc'].startswith("Bad response from requested URL (Invalid URL")
|
assert resp.json['_combo_err_desc'].startswith('Bad response from requested URL (Invalid URL')
|
||||||
|
|
||||||
layer.geojson_url = 'http://example.org/geojson?t1'
|
layer.geojson_url = 'http://example.org/geojson?t1'
|
||||||
layer.save()
|
layer.save()
|
||||||
|
|
|
@ -14,42 +14,42 @@ def test_page_snapshot_with_old_lingo_invoices_cells_migration(transactional_db)
|
||||||
|
|
||||||
snapshot = pagesnapshot_class.objects.create(
|
snapshot = pagesnapshot_class.objects.create(
|
||||||
serialization={
|
serialization={
|
||||||
"cells": [
|
'cells': [
|
||||||
{
|
{
|
||||||
"model": "lingo.activeitems",
|
'model': 'lingo.activeitems',
|
||||||
"fields": {
|
'fields': {
|
||||||
"slug": "foo",
|
'slug': 'foo',
|
||||||
"text": "Foo",
|
'text': 'Foo',
|
||||||
"order": 1,
|
'order': 1,
|
||||||
"regie": "blah",
|
'regie': 'blah',
|
||||||
"title": "Fooo",
|
'title': 'Fooo',
|
||||||
"groups": [],
|
'groups': [],
|
||||||
"public": True,
|
'public': True,
|
||||||
"condition": None,
|
'condition': None,
|
||||||
"placeholder": "content",
|
'placeholder': 'content',
|
||||||
"hide_if_empty": True,
|
'hide_if_empty': True,
|
||||||
"template_name": None,
|
'template_name': None,
|
||||||
"extra_css_class": "",
|
'extra_css_class': '',
|
||||||
"last_update_timestamp": "2023-04-11T15:28:14.052Z",
|
'last_update_timestamp': '2023-04-11T15:28:14.052Z',
|
||||||
"restricted_to_unlogged": False,
|
'restricted_to_unlogged': False,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"model": "lingo.itemshistory",
|
'model': 'lingo.itemshistory',
|
||||||
"fields": {
|
'fields': {
|
||||||
"slug": "bar",
|
'slug': 'bar',
|
||||||
"text": "Bar",
|
'text': 'Bar',
|
||||||
"order": 2,
|
'order': 2,
|
||||||
"regie": "blah",
|
'regie': 'blah',
|
||||||
"title": "Baar",
|
'title': 'Baar',
|
||||||
"groups": [],
|
'groups': [],
|
||||||
"public": True,
|
'public': True,
|
||||||
"condition": None,
|
'condition': None,
|
||||||
"placeholder": "content",
|
'placeholder': 'content',
|
||||||
"template_name": None,
|
'template_name': None,
|
||||||
"extra_css_class": "",
|
'extra_css_class': '',
|
||||||
"last_update_timestamp": "2023-04-11T15:28:27.174Z",
|
'last_update_timestamp': '2023-04-11T15:28:27.174Z',
|
||||||
"restricted_to_unlogged": False,
|
'restricted_to_unlogged': False,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
@ -65,46 +65,46 @@ def test_page_snapshot_with_old_lingo_invoices_cells_migration(transactional_db)
|
||||||
|
|
||||||
snapshot = pagesnapshot_class.objects.get()
|
snapshot = pagesnapshot_class.objects.get()
|
||||||
assert snapshot.serialization['cells'][0] == {
|
assert snapshot.serialization['cells'][0] == {
|
||||||
"model": "lingo.invoicescell",
|
'model': 'lingo.invoicescell',
|
||||||
"fields": {
|
'fields': {
|
||||||
"slug": "foo",
|
'slug': 'foo',
|
||||||
"text": "Foo",
|
'text': 'Foo',
|
||||||
"order": 1,
|
'order': 1,
|
||||||
"regie": "blah",
|
'regie': 'blah',
|
||||||
"title": "Fooo",
|
'title': 'Fooo',
|
||||||
"groups": [],
|
'groups': [],
|
||||||
"public": True,
|
'public': True,
|
||||||
"condition": None,
|
'condition': None,
|
||||||
"placeholder": "content",
|
'placeholder': 'content',
|
||||||
"hide_if_empty": True,
|
'hide_if_empty': True,
|
||||||
"template_name": None,
|
'template_name': None,
|
||||||
"extra_css_class": "",
|
'extra_css_class': '',
|
||||||
"last_update_timestamp": "2023-04-11T15:28:14.052Z",
|
'last_update_timestamp': '2023-04-11T15:28:14.052Z',
|
||||||
"restricted_to_unlogged": False,
|
'restricted_to_unlogged': False,
|
||||||
"display_mode": "active",
|
'display_mode': 'active',
|
||||||
"payer_external_id_template": "",
|
'payer_external_id_template': '',
|
||||||
"include_pay_button": True,
|
'include_pay_button': True,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
assert snapshot.serialization['cells'][1] == {
|
assert snapshot.serialization['cells'][1] == {
|
||||||
"model": "lingo.invoicescell",
|
'model': 'lingo.invoicescell',
|
||||||
"fields": {
|
'fields': {
|
||||||
"slug": "bar",
|
'slug': 'bar',
|
||||||
"text": "Bar",
|
'text': 'Bar',
|
||||||
"order": 2,
|
'order': 2,
|
||||||
"regie": "blah",
|
'regie': 'blah',
|
||||||
"title": "Baar",
|
'title': 'Baar',
|
||||||
"groups": [],
|
'groups': [],
|
||||||
"public": True,
|
'public': True,
|
||||||
"condition": None,
|
'condition': None,
|
||||||
"placeholder": "content",
|
'placeholder': 'content',
|
||||||
"hide_if_empty": False,
|
'hide_if_empty': False,
|
||||||
"template_name": None,
|
'template_name': None,
|
||||||
"extra_css_class": "",
|
'extra_css_class': '',
|
||||||
"last_update_timestamp": "2023-04-11T15:28:27.174Z",
|
'last_update_timestamp': '2023-04-11T15:28:27.174Z',
|
||||||
"restricted_to_unlogged": False,
|
'restricted_to_unlogged': False,
|
||||||
"display_mode": "historical",
|
'display_mode': 'historical',
|
||||||
"payer_external_id_template": "",
|
'payer_external_id_template': '',
|
||||||
"include_pay_button": True,
|
'include_pay_button': True,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -294,9 +294,9 @@ def test_notify_remote_items(mock_get, app, john_doe, jane_doe, regie, monkeypat
|
||||||
invoice_now = now()
|
invoice_now = now()
|
||||||
invoice_now = freezer()
|
invoice_now = freezer()
|
||||||
FAKE_PENDING_INVOICES = {
|
FAKE_PENDING_INVOICES = {
|
||||||
"data": {
|
'data': {
|
||||||
john_doe.username: {
|
john_doe.username: {
|
||||||
"invoices": [
|
'invoices': [
|
||||||
{
|
{
|
||||||
'id': '01',
|
'id': '01',
|
||||||
'label': '010101',
|
'label': '010101',
|
||||||
|
|
|
@ -421,7 +421,7 @@ def test_get_placeholders():
|
||||||
|
|
||||||
def test_render(app):
|
def test_render(app):
|
||||||
page = Page(
|
page = Page(
|
||||||
title='foo', slug='foo', template_name='standard-sidebar', order=0, description="page description"
|
title='foo', slug='foo', template_name='standard-sidebar', order=0, description='page description'
|
||||||
)
|
)
|
||||||
page.save()
|
page.save()
|
||||||
response = app.get(page.get_online_url())
|
response = app.get(page.get_online_url())
|
||||||
|
@ -431,7 +431,7 @@ def test_render(app):
|
||||||
|
|
||||||
def test_render_cell_having_href_template_error(app):
|
def test_render_cell_having_href_template_error(app):
|
||||||
page = Page(
|
page = Page(
|
||||||
title='foo', slug='foo', template_name='standard-sidebar', order=0, description="page description"
|
title='foo', slug='foo', template_name='standard-sidebar', order=0, description='page description'
|
||||||
)
|
)
|
||||||
page.save()
|
page.save()
|
||||||
cell = TextCell(
|
cell = TextCell(
|
||||||
|
@ -439,7 +439,7 @@ def test_render_cell_having_href_template_error(app):
|
||||||
)
|
)
|
||||||
cell.save()
|
cell.save()
|
||||||
response = app.get(page.get_online_url())
|
response = app.get(page.get_online_url())
|
||||||
assert "{{e-service_url}}backoffice/..." in response.text # href not rendered
|
assert '{{e-service_url}}backoffice/...' in response.text # href not rendered
|
||||||
|
|
||||||
|
|
||||||
def test_cell_maintain_page_cell_cache(freezer):
|
def test_cell_maintain_page_cell_cache(freezer):
|
||||||
|
|
|
@ -508,7 +508,7 @@ def test_page_skeleton(app):
|
||||||
cell.save()
|
cell.save()
|
||||||
|
|
||||||
resp = app.get('/__skeleton__/?source=%s' % quote('http://example.net/foo/bar'))
|
resp = app.get('/__skeleton__/?source=%s' % quote('http://example.net/foo/bar'))
|
||||||
assert "Foobar2" in resp.text
|
assert 'Foobar2' in resp.text
|
||||||
|
|
||||||
|
|
||||||
def test_page_skeleton_missing_template(app):
|
def test_page_skeleton_missing_template(app):
|
||||||
|
@ -655,7 +655,7 @@ def test_404(app):
|
||||||
cell.save()
|
cell.save()
|
||||||
resp = app.get('/foobar/', status=404)
|
resp = app.get('/foobar/', status=404)
|
||||||
assert "This page doesn't exist" in resp.text
|
assert "This page doesn't exist" in resp.text
|
||||||
assert "FOOBAR" in resp.text
|
assert 'FOOBAR' in resp.text
|
||||||
index_page.delete()
|
index_page.delete()
|
||||||
|
|
||||||
# check decidated custom page
|
# check decidated custom page
|
||||||
|
@ -668,7 +668,7 @@ def test_404(app):
|
||||||
with override_settings(DEBUG=True):
|
with override_settings(DEBUG=True):
|
||||||
# check error page provides an hint when debugging
|
# check error page provides an hint when debugging
|
||||||
resp = app.get('/foobar/', status=404)
|
resp = app.get('/foobar/', status=404)
|
||||||
assert "find the requested page" in resp.text
|
assert 'find the requested page' in resp.text
|
||||||
|
|
||||||
# check native django handler is used if all pages are private
|
# check native django handler is used if all pages are private
|
||||||
page.public = False
|
page.public = False
|
||||||
|
|
|
@ -41,8 +41,8 @@ def test_service_worker(app):
|
||||||
|
|
||||||
# check legacy settings are still supported
|
# check legacy settings are still supported
|
||||||
with override_settings(
|
with override_settings(
|
||||||
PWA_VAPID_PUBLIK_KEY="BFzvUdXB...",
|
PWA_VAPID_PUBLIK_KEY='BFzvUdXB...',
|
||||||
PWA_VAPID_PRIVATE_KEY="4WbCnBF...",
|
PWA_VAPID_PRIVATE_KEY='4WbCnBF...',
|
||||||
PWA_VAPID_CLAIMS={'sub': 'mailto:admin@entrouvert.com'},
|
PWA_VAPID_CLAIMS={'sub': 'mailto:admin@entrouvert.com'},
|
||||||
):
|
):
|
||||||
resp = app.get('/service-worker-registration.js', status=200)
|
resp = app.get('/service-worker-registration.js', status=200)
|
||||||
|
@ -92,8 +92,8 @@ def test_webpush_notification(app, john_doe):
|
||||||
|
|
||||||
# check legacy settings are still supported
|
# check legacy settings are still supported
|
||||||
with override_settings(
|
with override_settings(
|
||||||
PWA_VAPID_PUBLIK_KEY="BFzvUdXB...",
|
PWA_VAPID_PUBLIK_KEY='BFzvUdXB...',
|
||||||
PWA_VAPID_PRIVATE_KEY="4WbCnBF...",
|
PWA_VAPID_PRIVATE_KEY='4WbCnBF...',
|
||||||
PWA_VAPID_CLAIMS={'sub': 'mailto:admin@entrouvert.com'},
|
PWA_VAPID_CLAIMS={'sub': 'mailto:admin@entrouvert.com'},
|
||||||
):
|
):
|
||||||
with mock.patch('pywebpush.webpush') as webpush:
|
with mock.patch('pywebpush.webpush') as webpush:
|
||||||
|
|
|
@ -185,8 +185,8 @@ def test_category_cell_render(mock_send, settings):
|
||||||
|
|
||||||
context = {'synchronous': True} # to get fresh content
|
context = {'synchronous': True} # to get fresh content
|
||||||
result = cell.render(context)
|
result = cell.render(context)
|
||||||
assert "Test 3" in result
|
assert 'Test 3' in result
|
||||||
assert "category 3 description" in result
|
assert 'category 3 description' in result
|
||||||
|
|
||||||
|
|
||||||
@mock.patch('requests.Session.send', side_effect=mocked_requests_send)
|
@mock.patch('requests.Session.send', side_effect=mocked_requests_send)
|
||||||
|
|
|
@ -683,8 +683,8 @@ def test_manager_card_cell(mock_send, app, admin_user):
|
||||||
placeholder='content',
|
placeholder='content',
|
||||||
order=2,
|
order=2,
|
||||||
carddef_reference='default:card_e',
|
carddef_reference='default:card_e',
|
||||||
slug="sluge-again",
|
slug='sluge-again',
|
||||||
card_ids="42",
|
card_ids='42',
|
||||||
related_card_path='',
|
related_card_path='',
|
||||||
)
|
)
|
||||||
resp = app.get('/manage/pages/%s/' % page.pk)
|
resp = app.get('/manage/pages/%s/' % page.pk)
|
||||||
|
@ -943,7 +943,7 @@ def test_card_cell_table_mode_render_custom_schema_card_field(mock_send, context
|
||||||
'file.pdf',
|
'file.pdf',
|
||||||
'', # it's an image !
|
'', # it's an image !
|
||||||
"lorem<strong>ipsum hello'world", # no multiline support for now
|
"lorem<strong>ipsum hello'world", # no multiline support for now
|
||||||
"lorem<strong>ipsum hello world",
|
'lorem<strong>ipsum hello world',
|
||||||
'test@localhost',
|
'test@localhost',
|
||||||
'https://www.example.net/',
|
'https://www.example.net/',
|
||||||
"loremipsum\nhello'world",
|
"loremipsum\nhello'world",
|
||||||
|
@ -1295,25 +1295,25 @@ def test_card_cell_table_mode_render_with_headers(mock_send, context, with_heade
|
||||||
custom_schema={
|
custom_schema={
|
||||||
'grid_headers': with_headers,
|
'grid_headers': with_headers,
|
||||||
'cells': [
|
'cells': [
|
||||||
{'varname': '@custom@', 'template': "foo bar"},
|
{'varname': '@custom@', 'template': 'foo bar'},
|
||||||
{'varname': '@custom@', 'template': "foo bar bis", "header": "My Custom Header"},
|
{'varname': '@custom@', 'template': 'foo bar bis', 'header': 'My Custom Header'},
|
||||||
{'varname': '@custom@', 'template': ""}, # not displayed
|
{'varname': '@custom@', 'template': ''}, # not displayed
|
||||||
{'varname': 'fieldb'},
|
{'varname': 'fieldb'},
|
||||||
{'varname': 'user:name'},
|
{'varname': 'user:name'},
|
||||||
{'varname': 'user:email'},
|
{'varname': 'user:email'},
|
||||||
{'varname': 'user:first_name'},
|
{'varname': 'user:first_name'},
|
||||||
{'varname': 'user:last_name'},
|
{'varname': 'user:last_name'},
|
||||||
{'varname': '@link@', 'template': "Foo", 'url_template': 'http://foo/bar', 'header': 'Link'},
|
{'varname': '@link@', 'template': 'Foo', 'url_template': 'http://foo/bar', 'header': 'Link'},
|
||||||
{'varname': '@link@', 'template': "Bar", 'url_template': '{# empty #}', 'header': 'Link Bis'},
|
{'varname': '@link@', 'template': 'Bar', 'url_template': '{# empty #}', 'header': 'Link Bis'},
|
||||||
{
|
{
|
||||||
'varname': '@link@',
|
'varname': '@link@',
|
||||||
'template': "",
|
'template': '',
|
||||||
'url_template': 'http://foo/bar',
|
'url_template': 'http://foo/bar',
|
||||||
'header': 'Link Not Displayed',
|
'header': 'Link Not Displayed',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'varname': '@link@',
|
'varname': '@link@',
|
||||||
'template': "Bar",
|
'template': 'Bar',
|
||||||
'url_template': '',
|
'url_template': '',
|
||||||
'header': 'Link Bis Not Displayed',
|
'header': 'Link Bis Not Displayed',
|
||||||
},
|
},
|
||||||
|
|
|
@ -34,10 +34,10 @@ def mocked_requests_send(request, **kwargs):
|
||||||
@mock.patch('requests.Session.send', side_effect=mocked_requests_send)
|
@mock.patch('requests.Session.send', side_effect=mocked_requests_send)
|
||||||
def test_publik_django_templatetags_integration(mock_send, context, nocache):
|
def test_publik_django_templatetags_integration(mock_send, context, nocache):
|
||||||
t = Template('{{ cards|objects:"foo"|count }}')
|
t = Template('{{ cards|objects:"foo"|count }}')
|
||||||
assert t.render(context) == "2"
|
assert t.render(context) == '2'
|
||||||
|
|
||||||
|
|
||||||
@mock.patch('requests.Session.send', side_effect=mocked_requests_send)
|
@mock.patch('requests.Session.send', side_effect=mocked_requests_send)
|
||||||
def test_with_explicit_load_wcs(mock_send, context, nocache):
|
def test_with_explicit_load_wcs(mock_send, context, nocache):
|
||||||
t = Template('{% load wcs %}{{ cards|objects:"foo"|count }}')
|
t = Template('{% load wcs %}{{ cards|objects:"foo"|count }}')
|
||||||
assert t.render(context) == "2"
|
assert t.render(context) == '2'
|
||||||
|
|
Loading…
Reference in New Issue