Exemple #1
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': ['*****@*****.**', '*****@*****.**', '*****@*****.**']
    }
Exemple #2
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': ['*****@*****.**', '*****@*****.**', '*****@*****.**']
    }
Exemple #3
0
def i_am_registered_for_the_course(course, metadata):
    # Create the course
    create_course(course, metadata)

    # Create the user
    world.create_user('robot', 'test')
    usr = User.objects.get(username='******')

    # If the user is not already enrolled, enroll the user.
    CourseEnrollment.enroll(usr, course_id(course))

    world.add_to_course_staff('robot', world.scenario_dict['COURSE'].number)
    world.log_in(username='******', password='******')
Exemple #4
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"
    )