Esempio n. 1
0
def test_none_listed_after_removal():
    test_creation()

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

    all_list = PendingUser.ListAll()
    assert len(all_list) == 0
Esempio n. 2
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
Esempio n. 3
0
def clear_old_registrations():
    for pu in PendingUser.ListAll():
        # deliberately a larger delta than we restrict against to avoid
        # accidentally removing vaild entries
        if pu.age > timedelta(days=3):
            log_action('expiring registration', pu)
            pu.delete()
            expired = User(pu.username)
            expired.delete()

            team_leader = User(pu.teacher_username)
            inform_team_lead_registration_expired(team_leader, expired)
Esempio n. 4
0
def clear_old_registrations():
    # deliberately a larger delta than we restrict against to avoid
    # accidentally removing vaild entries
    activation_days = config.getint('nemesis', 'activation_days')
    activation_days += 0.5
    max_age = timedelta(days=activation_days)

    for pu in PendingUser.ListAll():
        if pu.age > max_age:
            log_action('expiring registration', pu)
            pu.delete()
            expired = User(pu.username)
            expired.delete()

            inform_competitor_registration_expired(pu.email, expired)
            team_leader = User(pu.teacher_username)
            inform_team_lead_registration_expired(team_leader, expired)
Esempio n. 5
0
def test_one_listed():
    test_creation()

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

    pu = all_list[0]

    assert type(pu) == PendingUser

    assert pu.in_db
    assert pu.username == 'abc'
    assert pu.teacher_username == 'jim'
    assert pu.college == 'college-1'
    assert pu.team == 'team-ABC'
    assert pu.email == '*****@*****.**'
    assert pu.verify_code == 'bibble'
Esempio n. 6
0
def test_none_listed_at_start():
    all_list = PendingUser.ListAll()
    assert len(all_list) == 0