apiclient: make description non mandatory (#69524)
gitea/authentic/pipeline/head Build started...
Details
gitea/authentic/pipeline/head Build started...
Details
This commit is contained in:
parent
b806723bba
commit
41fa87af45
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 2.2.26 on 2022-09-27 12:51
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('authentic2', '0042_api_client'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='apiclient',
|
||||
name='description',
|
||||
field=models.TextField(blank=True, verbose_name='Description'),
|
||||
),
|
||||
]
|
|
@ -636,7 +636,7 @@ class Lock(models.Model):
|
|||
|
||||
class APIClient(models.Model):
|
||||
name = models.CharField(max_length=128, verbose_name=_('Name'))
|
||||
description = models.TextField(verbose_name=_('Description'))
|
||||
description = models.TextField(verbose_name=_('Description'), blank=True)
|
||||
identifier = models.CharField(max_length=256, verbose_name=_('Identifier'))
|
||||
password = models.CharField(max_length=256, verbose_name=_('Password'))
|
||||
restrict_to_anonymised_data = models.BooleanField(
|
||||
|
|
|
@ -118,6 +118,23 @@ def test_add(superuser, app):
|
|||
assert urlparse(response.request.url).path == api_client.get_absolute_url()
|
||||
|
||||
|
||||
def test_add_description_non_mandatory(superuser, app):
|
||||
assert APIClient.objects.count() == 0
|
||||
role_1 = Role.objects.create(name='role-1')
|
||||
role_2 = Role.objects.create(name='role-2')
|
||||
resp = login(app, superuser, 'a2-manager-api-client-add')
|
||||
form = resp.form
|
||||
form.set('name', 'api-client-name')
|
||||
form.set('identifier', 'api-client-identifier')
|
||||
form.set('password', 'api-client-password')
|
||||
form['apiclient_roles'].force_value([role_1.id, role_2.id])
|
||||
response = form.submit().follow()
|
||||
assert APIClient.objects.count() == 1
|
||||
api_client = APIClient.objects.get(name='api-client-name')
|
||||
assert set(api_client.apiclient_roles.all()) == {role_1, role_2}
|
||||
assert urlparse(response.request.url).path == api_client.get_absolute_url()
|
||||
|
||||
|
||||
def test_detail(superuser, app):
|
||||
role_1 = Role.objects.create(name='role-1')
|
||||
role_2 = Role.objects.create(name='role-2')
|
||||
|
|
Loading…
Reference in New Issue