applications: enable chrono components (#82703) #87

Merged
lguerin merged 2 commits from wip/82703-applification-chrono into main 2023-10-27 15:52:31 +02:00
3 changed files with 26 additions and 3 deletions

View File

@ -109,6 +109,8 @@ class Application(models.Model):
modules = ['wcs']
if settings.HOBO_APPLICATION_COMBO_SUPPORT:
modules.append('combo')
if settings.HOBO_APPLICATION_CHRONO_SUPPORT:
modules.append('chrono')
return modules
def save(self, *args, **kwargs):
@ -569,11 +571,11 @@ class AsyncJob(models.Model):
no_history = collections.defaultdict(list)
for service in self.details.values():
for data in service.values():
for diff in data.get('differences'):
for diff in data.get('differences') or []:
diffs[diff['type']][diff['slug']] = diff['url']
for unknown in data.get('unknown_elements'):
for unknown in data.get('unknown_elements') or []:
not_found[unknown['type']].append(unknown['slug'])
for history in data.get('no_history_elements'):
for history in data.get('no_history_elements') or []:
no_history[history['type']].append(history['slug'])
result_diffs = []
result_not_found = []

View File

@ -247,6 +247,9 @@ HOBO_SERVICES_ENABLED = []
# Support for combo elements in applications
HOBO_APPLICATION_COMBO_SUPPORT = False
# Support for chrono elements in applications
HOBO_APPLICATION_CHRONO_SUPPORT = False
# Phone prefixes by country for phone number as authentication identifier
PHONE_COUNTRY_CODES = {
'32': {'region': 'BE', 'region_desc': _('Belgium')},

View File

@ -1182,6 +1182,24 @@ def test_update_application(app, admin_user, settings, app_bundle):
]
assert 'Error checking local changes, update can not be run.' in resp
def response_content(url, request): # noqa pylint: disable=function-redefined
if url.path == '/api/export-import/bundle-check/':
return {
'content': json.dumps({'data': {}}),
'status_code': 200,
}
return mocked_http(url, request)
resp = app.get('/applications/manifest/test/update/')
resp.form['bundle'] = Upload('app.tar', app_bundle, 'application/x-tar')
with StatefulHTTMock(response_content):
resp = resp.form.submit()
assert resp.location.endswith(
'/applications/manifest/test/confirm/%s/' % Version.objects.latest('pk').pk
)
resp = resp.follow()
assert 'No local changes found.' in resp
def test_get_version_to_check(app):
application = Application.objects.create(name='Test', slug='test')