0001-manager-fix-ics_filename-on-replace-50731.patch
chrono/manager/forms.py | ||
---|---|---|
540 | 540 |
if bool(self.instance.ics_file): |
541 | 541 |
self.instance.ics_file.delete() |
542 | 542 |
self.instance.ics_file = self.cleaned_data['ics_newfile'] |
543 |
self.instance.ics_filename = self.cleaned_data['ics_newfile'].name |
|
543 | 544 |
self.instance.save() |
544 | 545 | |
545 | 546 |
tests/test_manager.py | ||
---|---|---|
2804 | 2804 |
resp = app.get('/manage/agendas/%s/settings' % agenda.pk) |
2805 | 2805 |
resp = resp.click('manage exceptions') |
2806 | 2806 |
resp = resp.click(href='/manage/time-period-exceptions-source/%d/replace' % source.pk) |
2807 |
resp.form['ics_newfile'] = Upload('exceptions.ics', ics_file_content, 'text/calendar') |
|
2807 |
resp.form['ics_newfile'] = Upload('exceptions-bis.ics', ics_file_content, 'text/calendar')
|
|
2808 | 2808 |
resp = resp.form.submit().follow() |
2809 | 2809 |
source.refresh_from_db() |
2810 | 2810 |
assert source.ics_file.path != old_ics_file_path |
2811 |
assert source.ics_filename == 'exceptions-bis.ics' |
|
2811 | 2812 |
assert os.path.exists(old_ics_file_path) is False |
2812 | 2813 |
assert TimePeriodException.objects.count() == 2 |
2813 | 2814 |
assert source.timeperiodexception_set.count() == 2 |
2814 |
- |