Example #1
0
def navigate_to_an_openended_question_as_staff(step):
    world.register_by_course_id('MITx/3.091x/2012_Fall', True)
    world.log_in(email='*****@*****.**', password='******')
    problem = '/courses/MITx/3.091x/2012_Fall/courseware/Week_10/Polymer_Synthesis/'
    world.browser.visit(django_url(problem))
    tab_css = 'ol#sequence-list > li > a[data-element="5"]'
    world.css_click(tab_css)
def make_populated_course(step):  # pylint: disable=unused-argument
    ## This is different than the function defined in common.py because it enrolls
    ## a staff, instructor, and student member regardless of what `role` is, then
    ## logs `role` in. This is to ensure we have 3 class participants to email.

    # Clear existing courses to avoid conflicts
    world.clear_courses()

    # Create a new course
    course = world.CourseFactory.create(
        org='edx',
        number='888',
        display_name='Bulk Email Test Course'
    )
    world.bulk_email_course_id = 'edx/888/Bulk_Email_Test_Course'

    try:
        # See if we've defined the instructor & staff user yet
        world.bulk_email_instructor
    except AttributeError:
        # Make & register an instructor for the course
        world.bulk_email_instructor = InstructorFactory(course=course.location)
        world.enroll_user(world.bulk_email_instructor, world.bulk_email_course_id)

        # Make & register a staff member
        world.bulk_email_staff = StaffFactory(course=course.location)
        world.enroll_user(world.bulk_email_staff, world.bulk_email_course_id)

    # Make & register a student
    world.register_by_course_id(
        'edx/888/Bulk_Email_Test_Course',
        username='******',
        password='******',
        is_staff=False
    )

    # Store the expected recipients
    # given each "send to" option
    staff_emails = [world.bulk_email_staff.email, world.bulk_email_instructor.email]
    world.expected_addresses = {
        'course staff': staff_emails,
        'students, staff, and instructors': staff_emails + ['*****@*****.**']
    }
Example #3
0
def make_populated_course(step):  # pylint: disable=unused-argument
    ## This is different than the function defined in common.py because it enrolls
    ## a staff, instructor, and student member regardless of what `role` is, then
    ## logs `role` in. This is to ensure we have 3 class participants to email.

    # Clear existing courses to avoid conflicts
    world.clear_courses()

    # Create a new course
    course = world.CourseFactory.create(
        org='edx',
        number='888',
        display_name='Bulk Email Test Course'
    )
    world.bulk_email_course_id = 'edx/888/Bulk_Email_Test_Course'

    try:
        # See if we've defined the instructor & staff user yet
        world.bulk_email_instructor
    except AttributeError:
        # Make & register an instructor for the course
        world.bulk_email_instructor = InstructorFactory(course=course.location)
        world.enroll_user(world.bulk_email_instructor, world.bulk_email_course_id)

        # Make & register a staff member
        world.bulk_email_staff = StaffFactory(course=course.location)
        world.enroll_user(world.bulk_email_staff, world.bulk_email_course_id)

    # Make & register a student
    world.register_by_course_id(
        'edx/888/Bulk_Email_Test_Course',
        username='******',
        password='******',
        is_staff=False
    )

    # Store the expected recipients
    # given each "send to" option
    staff_emails = [world.bulk_email_staff.email, world.bulk_email_instructor.email]
    world.expected_addresses = {
        'course staff': staff_emails,
        'students, staff, and instructors': staff_emails + ['*****@*****.**']
    }
Example #4
0
def i_am_an_instructor(step, role):  # pylint: disable=W0613

    # Store the role
    assert_in(role, ['instructor', 'staff'])

    # Clear existing courses to avoid conflicts
    world.clear_courses()

    # Create a new course
    course = world.CourseFactory.create(
        org='edx',
        number='999',
        display_name='Test Course'
    )

    # Register the instructor as staff for the course
    world.register_by_course_id(
        'edx/999/Test_Course',
        username='******',
        password='******',
        is_staff=True
    )
    world.add_to_course_staff('instructor', '999')

    # Register another staff member
    world.register_by_course_id(
        'edx/999/Test_Course',
        username='******',
        password='******',
        is_staff=True
    )
    world.add_to_course_staff('staff', '999')

    # Register a student
    world.register_by_course_id(
        'edx/999/Test_Course',
        username='******',
        password='******',
        is_staff=False
    )

    # Log in as the an instructor or staff for the course
    world.log_in(
        username=role,
        password='******',
        email="*****@*****.**",
        name="Instructor"
    )

    # Store the expected recipients
    # given each "send to" option
    world.expected_addresses = {
        'myself': [role + '@edx.org'],
        'course staff': ['*****@*****.**', '*****@*****.**'],
        'students, staff, and instructors': ['*****@*****.**', '*****@*****.**', '*****@*****.**']
    }
Example #5
0
def i_am_an_instructor(step, role):  # pylint: disable=W0613

    # Store the role
    assert_in(role, ['instructor', 'staff'])

    # Clear existing courses to avoid conflicts
    world.clear_courses()

    # Create a new course
    course = world.CourseFactory.create(
        org='edx',
        number='999',
        display_name='Test Course'
    )

    # Register the instructor as staff for the course
    world.register_by_course_id(
        'edx/999/Test_Course',
        username='******',
        password='******',
        is_staff=True
    )
    world.add_to_course_staff('instructor', '999')

    # Register another staff member
    world.register_by_course_id(
        'edx/999/Test_Course',
        username='******',
        password='******',
        is_staff=True
    )
    world.add_to_course_staff('staff', '999')

    # Register a student
    world.register_by_course_id(
        'edx/999/Test_Course',
        username='******',
        password='******',
        is_staff=False
    )

    # Log in as the an instructor or staff for the course
    world.log_in(
        username=role,
        password='******',
        email="*****@*****.**",
        name="Instructor"
    )

    # Store the expected recipients
    # given each "send to" option
    world.expected_addresses = {
        'myself': [role + '@edx.org'],
        'course staff': ['*****@*****.**', '*****@*****.**'],
        'students, staff, and instructors': ['*****@*****.**', '*****@*****.**', '*****@*****.**']
    }
Example #6
0
def i_am_an_instructor(step):  # pylint: disable=W0613

    # Clear existing courses to avoid conflicts
    world.clear_courses()

    # Register the instructor as staff for the course
    world.register_by_course_id(
        'edx/999/Test_Course',
        username='******',
        password='******',
        is_staff=True
    )
    world.add_to_course_staff('instructor', '999')

    # Register another staff member
    world.register_by_course_id(
        'edx/999/Test_Course',
        username='******',
        password='******',
        is_staff=True
    )
    world.add_to_course_staff('staff', '999')

    # Register a student
    world.register_by_course_id(
        'edx/999/Test_Course',
        username='******',
        password='******',
        is_staff=False
    )

    # Log in as the instructor for the course
    world.log_in(
        username='******',
        password='******',
        email="*****@*****.**",
        name="Instructor"
    )
Example #7
0
def i_am_staff_for_course_by_id(step, course_id):
    world.register_by_course_id(course_id, True)
Example #8
0
def i_am_staff_for_course_by_id(step, course_id):
    world.register_by_course_id(course_id, True)
Example #9
0
def create_user_and_visit_course():
    world.register_by_course_id('edx/999/Test_Course')
    world.log_in()
    world.visit('/courses/edx/999/Test_Course/courseware/')
Example #10
0
def create_user_and_visit_course():
    world.register_by_course_id('edx/999/Test_Course')
    world.log_in()
    world.visit('/courses/edx/999/Test_Course/courseware/')