示例#1
0
def test_set_user_attendance_updates_user(roster):
    steve = User('1', 'Steve', '1', 'avatar1')
    roster.set_user_attendance(steve, True)

    steve2 = steve._replace(avatar='avatar2')
    roster.set_user_attendance(steve2, True)

    assert list(roster.attending_users()) == [steve2]
示例#2
0
def test_update_users_preserves_attendance(roster):
    bob = User('1', 'Bob', '1', 'avatar1')
    roster.set_user_attendance(bob, True)

    bob2 = bob._replace(avatar='avatar2')
    roster.update_users([bob2])
    assert list(roster.attending_users()) == [bob2]

    roster.set_user_attendance(bob, False)
    bob3 = bob2._replace(nick='Robert')
    roster.update_users([bob3])
    assert list(roster.attending_users()) == []