Пример #1
0
def test_not_logged_in(event):
    """
    Test when the admin is not logged in.
    """
    admin, event_id = event
    log_out(admin.username)
    expect_error(remove_user, AuthError, admin.username, "A", event_id)
Пример #2
0
def test_remove_self(event):
    """
    Test that the admin cannot remove themself.
    """
    admin, event_id = event
    expect_error(remove_user, InputError,
                 admin.username, admin.username, event_id)
Пример #3
0
def test_invalid_event(event, bot):
    """
    Test when the admin is not actually the event admin.
    """
    admin, event_id = event
    expect_error(remove_user, AuthError,
                 bot.username, admin.username, event_id)
def test_date_before_creation(event_member):
    """
    Test when the date selected is a date before the event creation date.
    """
    _, member, event_id = event_member
    expect_error(edit, InputError, member.username, event_id, True,
                 date(2000, 1, 1))
Пример #5
0
def test_not_logged_in(event_member):
    """
    Test when the user is not logged in.
    """
    _, member, event_id = event_member
    log_out(member.username)
    expect_error(find_best_times, AuthError, member.username, event_id)
Пример #6
0
def test_already_logged_in(logged_out_bot):
    """
    Test logging in when already logged in.
    """
    log_in(logged_out_bot.username, BOT_PASSWORD)

    expect_error(log_in, InputError, logged_out_bot.username, BOT_PASSWORD)
Пример #7
0
def test_not_admin(event, bot):
    """
    Test when the admin is not actually an admin.
    """
    admin, event_id = event
    expect_error(invite_user, AuthError, bot.username, admin.username,
                 event_id)
Пример #8
0
def test_invalid_interval(event):
    """
    Test when the end time is before or at the start time.
    """
    admin, event_id = event
    expect_error(edit, InputError, admin.username, event_id, True, MON,
                 time(2), time(1))
Пример #9
0
def test_not_logged_in(event):
    """
    Test when admin_username is not logged in.
    """
    admin, event_id = event
    log_out(admin.username)
    expect_error(edit, AuthError, admin.username, date.today(), event_id)
Пример #10
0
def test_invalid_day(event):
    """
    Test an invalid day.
    """
    admin, event_id = event
    expect_error(edit, InputError, admin.username, event_id, True, 8, time(1),
                 time(2))
Пример #11
0
def test_not_member(event, bot):
    """
    Test when the user is not a member of the event.
    """
    _, event_id = event
    expect_error(edit, InputError, bot.username, event_id, True, SUN, time(1),
                 time(2))
def test_not_logged_in(event):
    """
    Test that the user must be logged in.
    """
    admin, event_id = event
    log_out(admin.username)
    expect_error(edit, AuthError, admin.username, event_id, False, None)
Пример #13
0
def test_invalid_date(event):
    """
    Test when the new event deadline is a date in the past.
    """
    admin, event_id = event
    past_date = date.today() - timedelta(days=2)
    expect_error(edit, InputError, admin.username, past_date, event_id)
def test_not_logged_in(event_member):
    """
    Test when the user is not logged in.
    """
    admin, member, event_id = event_member
    log_out(member.username)
    expect_error(edit, AuthError, member.username, event_id, True, None, None)
Пример #15
0
def test_not_logged_in(event, bot):
    """
    Test when the admin is not logged in.
    """
    admin, event_id = event
    log_out(admin.username)
    expect_error(invite_user, AuthError, admin.username, bot.username,
                 event_id)
Пример #16
0
def test_not_logged_in(event):
    """
    Test when the user is not logged in.
    """
    admin, event_id = event
    log_out(admin.username)
    expect_error(edit, AuthError, admin.username, event_id, False, TUE,
                 time(1), time(2))
def test_date_after_creation_60_days(event_member):
    """
    Test when the date selected is a date at least 60 days after the
    event creation date.
    """
    _, member, event_id = event_member
    expect_error(edit, InputError, member.username, event_id, True,
                 date.today() + timedelta(days=(MAX_DAYS)))
Пример #18
0
def test_not_logged_in(event, bot):
    """
    Test when the user is not logged in.
    """
    admin, event_id = event
    log_out(bot.username)
    invite_user(admin.username, bot.username, event_id)
    expect_error(leave_event, AuthError, bot.username, event_id)
Пример #19
0
def test_long_name():
    """
    Test names that are too long.
    """
    expect_error(register, InputError, "a", "abcdef", "a" * (MAX_NAME + 1),
                 "a", "a")
    expect_error(register, InputError, "a", "abcdef", "a",
                 "a" * (MAX_NAME + 1), "a")
Пример #20
0
def test_invalid_event_length(bot, length):
    """
    Test when the event length is invalid.
    """
    expect_error(create_event,
                 InputError,
                 bot.username,
                 "a", [],
                 event_length=length)
def test_invalid_time_in_past(event_member):
    """
    Test when the start or end time is a time before the event creation.
    """
    _, member, event_id = event_member
    past = date.today() - timedelta(days=5)
    start = datetime.combine(past, time(15, 0))
    end = start + timedelta(days=8)
    expect_error(edit, InputError, member.username, event_id,
                 True, start, end)
def test_invalid_time_range(event_member):
    """
    Test when the end time is before or equal to the start time.
    """
    _, member, event_id = event_member
    current = date.today() + timedelta(days=6)
    start = datetime.combine(current, time(12, 30))
    end = start - timedelta(days=1)
    expect_error(edit, InputError, member.username, event_id,
                 True, start, end)
Пример #23
0
def test_invalid_event_deadline(bot):
    """
    Test when the event deadline is a time in the past.
    """
    expect_error(create_event,
                 InputError,
                 bot.username,
                 "a", [],
                 event_length=3,
                 event_deadline=date(2021, 1, 19))
def test_invalid_time_too_late(event_member):
    """
    Test when the time range set is valid but too late.
    """
    _, member, event_id = event_member
    current = date.today() + timedelta(days=1)
    start = (datetime.combine(current, time(16, 30)) +
             timedelta(days=(MAX_DAYS - 2)))
    end =  start + timedelta(days=5)
    expect_error(edit, InputError, member.username, event_id,
                 True, start, end)
def test_not_member(bot, event):
    """
    Test when the user is not a member of the event.
    """
    _, event_id = event
    expect_error(edit, InputError, bot.username, event_id, False, None, None)
def test_invalid_event(bot):
    """
    Test a non-existent event.
    """
    expect_error(edit, InputError, bot.username, 1, False, None, None)
def test_invalid_username():
    """
    Test a non-existent username.
    """
    expect_error(edit, InputError, "aaa", 1, True, None, None)
Пример #28
0
def test_not_admin(event, bot):
    """
    Test when the event length editor is not the admin.
    """
    _, event_id = event
    expect_error(edit, AuthError, bot.username, date.today(), event_id)
Пример #29
0
def test_invalid_event(bot):
    """
    Test a non-existent event.
    """
    expect_error(edit, InputError, bot.username, date.today(), 1)
Пример #30
0
def test_invalid_username():
    """
    Test when admin_username does not exist.
    """
    expect_error(edit, InputError, "a", date.today(), 1)