agent: save role slug during provisionning (#77487)
gitea/hobo/pipeline/head This commit looks good
Details
gitea/hobo/pipeline/head This commit looks good
Details
This commit is contained in:
parent
cc15770e78
commit
c03b743a58
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 3.2.18 on 2023-05-11 14:05
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
('common', '0005_userextraattributes'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='role',
|
||||
name='slug',
|
||||
field=models.SlugField(default='', max_length=256),
|
||||
preserve_default=False,
|
||||
),
|
||||
]
|
|
@ -7,6 +7,7 @@ from django.db.models import JSONField
|
|||
|
||||
class Role(Group):
|
||||
uuid = models.CharField(max_length=32, db_index=True)
|
||||
slug = models.SlugField(max_length=256)
|
||||
description = models.TextField(default='')
|
||||
details = models.TextField(default='')
|
||||
emails = ArrayField(models.CharField(max_length=128), default=list)
|
||||
|
|
|
@ -201,6 +201,7 @@ class NotificationProcessing:
|
|||
name=role_name,
|
||||
defaults={
|
||||
'uuid': o['uuid'],
|
||||
'slug': o['slug'],
|
||||
'description': o['description'],
|
||||
'details': o.get('details', ''),
|
||||
'emails': o.get('emails', []),
|
||||
|
@ -218,6 +219,9 @@ class NotificationProcessing:
|
|||
if role.uuid != o['uuid']:
|
||||
role.uuid = o['uuid']
|
||||
save = True
|
||||
if role.slug != o['slug']:
|
||||
role.slug = o['slug']
|
||||
save = True
|
||||
if role.description != o['description']:
|
||||
role.description = o['description']
|
||||
save = True
|
||||
|
|
|
@ -63,6 +63,7 @@ def test_hobo_notify_roles(caplog, tenants):
|
|||
role = Role.objects.get()
|
||||
assert role.uuid == '12345'
|
||||
assert role.name == 'Service petite enfance'
|
||||
assert role.slug == 'service-petite-enfance'
|
||||
assert role.description == 'Role du service petite enfance %s' % tenant.domain_url
|
||||
assert role.details == 'Some details'
|
||||
assert role.emails == ['foo@bar.com', 'test@entrouvert.org']
|
||||
|
|
Loading…
Reference in New Issue