0001-clean-user-exports-prevent-crash-when-missing-direct.patch
src/authentic2/management/commands/clean-user-exports.py | ||
---|---|---|
27 | 27 | |
28 | 28 |
def handle(self, **options): |
29 | 29 |
path = default_storage.path('user_exports') |
30 |
if not os.path.exists(path): |
|
31 |
return |
|
32 | ||
30 | 33 |
for directory in os.listdir(path): |
31 | 34 |
dir_path = os.path.join(path, directory) |
32 | 35 |
modification_timestamp = os.path.getmtime(dir_path) |
tests/test_commands.py | ||
---|---|---|
410 | 410 |
users = [User(username='user%s' % i) for i in range(10)] |
411 | 411 |
User.objects.bulk_create(users) |
412 | 412 | |
413 |
# export directory does not exist yet |
|
414 |
call_command('clean-user-exports') |
|
415 | ||
413 | 416 |
resp = login(app, superuser, '/manage/users/') |
414 | 417 |
resp = resp.click('CSV').follow() |
415 | 418 |
file_creation_time = now() |
416 |
- |