Project

General

Profile

0001-python3-prevent-reuse-of-map-return-40760.patch

Valentin Deniaud, 16 March 2020 05:05 PM

Download (1.95 KB)

View differences:

Subject: [PATCH] python3: prevent reuse of map return (#40760)

 .../management/commands/clean-unused-accounts.py           | 3 +--
 tests/test_commands.py                                     | 7 +++++++
 2 files changed, 8 insertions(+), 2 deletions(-)
src/authentic2/management/commands/clean-unused-accounts.py
104 104
                    raise CommandError('invalid --filter %s' % f)
105 105
        if options['alert_thresholds']:
106 106
            alert_thresholds = options['alert_thresholds']
107
            alert_thresholds = alert_thresholds.split(',')
108 107
            try:
109
                alert_thresholds = map(int, alert_thresholds)
108
                alert_thresholds = [int(x) for x in alert_thresholds.split(',')]
110 109
            except ValueError:
111 110
                raise CommandError('alert_thresholds must be a comma separated list of integers')
112 111
            for threshold in alert_thresholds:
tests/test_commands.py
54 54
    assert DeletedUser.objects.get(user=simple_user)
55 55

  
56 56

  
57
def test_clean_unused_account_alert_email(simple_user, mailoutbox, settings):
58
    simple_user.last_login = now() - datetime.timedelta(days=180)
59
    simple_user.save()
60
    management.call_command('clean-unused-accounts', 730, '--alert-thresholds', '180')
61
    assert len(mailoutbox) == 1
62

  
63

  
57 64
def test_cleanupauthentic(db):
58 65
    management.call_command('cleanupauthentic')
59 66

  
60
-