diff --git a/hobo/applications/migrations/0011_element_type.py b/hobo/applications/migrations/0011_element_type.py new file mode 100644 index 0000000..6e8afdb --- /dev/null +++ b/hobo/applications/migrations/0011_element_type.py @@ -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'), + ), + ] diff --git a/hobo/applications/models.py b/hobo/applications/models.py index ac0af41..8005c1b 100644 --- a/hobo/applications/models.py +++ b/hobo/applications/models.py @@ -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) diff --git a/tests/test_application.py b/tests/test_application.py index be2f013..43366e6 100644 --- a/tests/test_application.py +++ b/tests/test_application.py @@ -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/':