Example #1
0
def test_none_listed_after_removal():
    test_creation()

    all_list = PendingEmail.ListAll()
    for pu in all_list:
        pu.delete()

    all_list = PendingEmail.ListAll()
    assert len(all_list) == 0
Example #2
0
def clear_old_emails():
    for pe in PendingEmail.ListAll():
        # deliberately a larger delta than we restrict against to avoid
        # accidentally removing vaild entries
        if pe.age > timedelta(days=3):
            log_action('expiring email change', pe)
            pe.delete()
Example #3
0
def clear_old_emails():
    # deliberately a larger delta than we restrict against to avoid
    # accidentally removing vaild entries
    email_change_days = config.getint('nemesis', 'email_change_days')
    email_change_days += 0.5
    max_age = timedelta(days=email_change_days)

    for pe in PendingEmail.ListAll():
        if pe.age > max_age:
            log_action('expiring email change', pe)
            pe.delete()
Example #4
0
def email_used(email):
    if User.email_used(email):
        return True

    if any(pe.new_email == email for pe in PendingEmail.ListAll()):
        return True

    if any(pu.email == email for pu in PendingUser.ListAll()):
        return True

    return False
Example #5
0
def test_one_listed():
    test_creation()

    all_list = PendingEmail.ListAll()
    assert len(all_list) == 1

    pe = all_list[0]

    assert type(pe) == PendingEmail

    assert pe.in_db
    assert pe.username == 'abc'
    assert pe.new_email == '*****@*****.**'
    assert pe.verify_code == 'bibble'
Example #6
0
def test_none_listed_at_start():
    all_list = PendingEmail.ListAll()
    assert len(all_list) == 0