manager: fix site_json field label (#52200)

This commit is contained in:
Valentin Deniaud 2021-03-18 16:14:05 +01:00
parent 0676783c13
commit 5130aab946
2 changed files with 6 additions and 1 deletions

View File

@ -674,7 +674,11 @@ class UserChangeEmailForm(CssClass, FormWithRequest, forms.ModelForm):
class SiteImportForm(forms.Form):
file_field_label = _('Site Export File')
site_json = forms.FileField(label=file_field_label)
site_json = forms.FileField()
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields['site_json'].label = self.file_field_label
def clean_site_json(self):
try:

View File

@ -59,6 +59,7 @@ def test_manager_ou_import(app, admin, ou1, role_ou1, ou2, role_ou2):
resp = app.get('/manage/organizational-units/')
resp = resp.click('Import')
assert 'Organizational Units Export File' in resp.text
resp.form['site_json'] = Upload('export.json', json.dumps(export).encode(), 'application/json')
resp = resp.form.submit().follow()