Ejemplo n.º 1
0
def test_get_announcement_recipients_tutors(announcements, users):
    tutors = announcements[4]
    assert tutors.subject == 'subject 05 (to tutors)'

    recipients = get_announcement_recipients(tutors)
    usernames = sorted(['tutor.a', 'tutor.b'])
    assert usernames == sorted([r.username for r in recipients])
Ejemplo n.º 2
0
def test_get_announcement_recipients_students(announcements, users):
    students = announcements[2]
    assert students.subject == 'subject 03 (to students)'

    recipients = get_announcement_recipients(students)
    usernames = sorted(['student.a', 'student.b', 'student.c', 'student.d'])
    assert usernames == sorted([r.username for r in recipients])
Ejemplo n.º 3
0
def test_get_announcement_recipients_all(announcements, users):
    all = announcements[0]
    assert all.subject == 'subject 01 (to all)'

    recipients = get_announcement_recipients(all)
    usernames = sorted([u.username for u in users if u.username != 'inactive'])
    assert usernames == sorted([r.username for r in recipients])
Ejemplo n.º 4
0
def test_get_announcement_recipients_students_and_tutors_on_programme_3(
        announcements, users):
    students_and_tutors_p3 = announcements[7]
    assert students_and_tutors_p3.subject == 'subject 08 (to students and tutors on programme 3)'

    recipients = get_announcement_recipients(students_and_tutors_p3)
    usernames = sorted(['student.b', 'tutor.b'])
    assert usernames == sorted([r.username for r in recipients])
Ejemplo n.º 5
0
def test_get_announcement_recipients_tutors_on_programme_2(
        announcements, users):
    tutors_p2 = announcements[6]
    assert tutors_p2.subject == 'subject 07 (to tutors on programme 2)'

    recipients = get_announcement_recipients(tutors_p2)
    usernames = sorted(['tutor.b'])
    assert usernames == sorted([r.username for r in recipients])
Ejemplo n.º 6
0
def test_get_announcement_recipients_students_on_programme_1(
        announcements, users):
    students_p1 = announcements[5]
    assert students_p1.subject == 'subject 06 (to students on programme 1)'

    recipients = get_announcement_recipients(students_p1)
    usernames = sorted(['student.b', 'student.c', 'student.d'])
    assert usernames == sorted([r.username for r in recipients])
Ejemplo n.º 7
0
def test_get_announcement_recipients_tutors_and_students(announcements, users):
    students_and_tutors = announcements[3]
    assert students_and_tutors.subject == 'subject 04 (to students and tutors)'

    recipients = get_announcement_recipients(students_and_tutors)
    usernames = sorted([
        'student.a', 'student.b', 'student.c', 'student.d', 'tutor.a',
        'tutor.b'
    ])
    assert usernames == sorted([r.username for r in recipients])