applications: fix Element type size (#74233)
gitea-wip/hobo/pipeline/pr-main This commit looks good Details

This commit is contained in:
Lauréline Guérin 2023-02-06 17:50:05 +01:00
parent 88d1681a12
commit 13f0821c66
No known key found for this signature in database
GPG Key ID: 1FAB9B9B4F93D473
3 changed files with 35 additions and 5 deletions

View File

@ -0,0 +1,16 @@
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('applications', '0010_relation_error'),
]
operations = [
migrations.AlterField(
model_name='element',
name='type',
field=models.CharField(max_length=100, verbose_name='Type'),
),
]

View File

@ -182,7 +182,7 @@ class Application(models.Model):
class Element(models.Model):
type = models.CharField(max_length=25, verbose_name=_('Type'))
type = models.CharField(max_length=100, verbose_name=_('Type'))
slug = models.SlugField(max_length=500, verbose_name=_('Slug'))
name = models.CharField(max_length=500, verbose_name=_('Name'))
cache = JSONField(blank=True, default=dict)

View File

@ -66,6 +66,13 @@ WCS_AVAILABLE_OBJECTS = {
"minor": True,
"urls": {"list": "https://wcs.example.invalid/api/export-import/mail-templates/"},
},
{
"id": "comment-templates-categories",
"text": "Categories (comment templates)",
"singular": "Category (comment templates)",
"minor": True,
"urls": {"list": "https://wcs.example.invalid/api/export-import/comment-templates-categories/"},
},
{
"id": "wscalls",
"text": "Webservice Calls",
@ -775,6 +782,12 @@ def get_bundle(with_icon=False):
{'type': 'forms', 'slug': 'test', 'name': 'test', 'auto-dependency': False},
{'type': 'blocks', 'slug': 'test', 'name': 'test', 'auto-dependency': True},
{'type': 'workflows', 'slug': 'test', 'name': 'test', 'auto-dependency': True},
{
'type': 'comment-templates-categories',
'slug': 'test',
'name': 'test',
'auto-dependency': True,
},
],
}
manifest_fd = io.BytesIO(json.dumps(manifest_json, indent=2).encode())
@ -833,7 +846,7 @@ def test_deploy_application(app, admin_user, settings, app_bundle, app_bundle_wi
else:
assert version.number == '42.0'
assert version.notes == 'foo bar blah'
assert application.elements.count() == 3
assert application.elements.count() == 4
job = AsyncJob.objects.latest('pk')
assert job.status == 'completed'
assert job.progression_urls == {'wcs': {'Foobar': 'https://wcs.example.invalid/api/jobs/job-uuid/'}}
@ -914,10 +927,11 @@ def test_deploy_application(app, admin_user, settings, app_bundle, app_bundle_wi
resp.form.submit()
application = Application.objects.get(slug='test')
elements = application.elements.all().order_by('type')
assert len(elements) == 3
assert len(elements) == 4
assert elements[0].cache == {}
assert elements[1].cache == form_def
assert elements[2].cache == {}
assert elements[1].cache == {}
assert elements[2].cache == form_def
assert elements[3].cache == {}
def response_content(url, request):
if url.path == '/api/export-import/forms/':