Beispiel #1
0
def i_am_registered_for_the_course(coursenum, metadata, user='******'):
    # Create user
    if user == 'BetaTester':
        # Create the course
        now = datetime.datetime.now(pytz.UTC)
        tomorrow = now + datetime.timedelta(days=5)
        metadata.update({'days_early_for_beta': 5, 'start': tomorrow})
        create_course_for_lti(coursenum, metadata)
        course_descriptor = world.scenario_dict['COURSE']

        # create beta tester
        user = BetaTesterFactory(course_key=course_descriptor.id)
        normal_student = UserFactory()
        instructor = InstructorFactory(course_key=course_descriptor.id)

        assert not has_access(normal_student, 'load', course_descriptor)
        assert has_access(user, 'load', course_descriptor)
        assert has_access(instructor, 'load', course_descriptor)
    else:
        metadata.update({'start': datetime.datetime(1970, 1, 1, tzinfo=UTC)})
        create_course_for_lti(coursenum, metadata)
        course_descriptor = world.scenario_dict['COURSE']
        user = InstructorFactory(course_key=course_descriptor.id)

    # Enroll the user in the course and log them in
    if has_access(user, 'load', course_descriptor):
        world.enroll_user(user, course_descriptor.id)

    world.log_in(username=user.username, password='******')
Beispiel #2
0
def i_am_registered_for_the_course(coursenum, metadata, user='******'):
    # Create user
    if user == 'BetaTester':
        # Create the course
        now = datetime.datetime.now(pytz.UTC)
        tomorrow = now + datetime.timedelta(days=5)
        metadata.update({'days_early_for_beta': 5, 'start': tomorrow})
        create_course_for_lti(coursenum, metadata)
        course_descriptor = world.scenario_dict['COURSE']
        course_location = world.scenario_dict['COURSE'].location

        # create beta tester
        user = BetaTesterFactory(course=course_location)
        normal_student = UserFactory()
        instructor = InstructorFactory(course=course_location)

        assert not has_access(normal_student, course_descriptor, 'load')
        assert has_access(user, course_descriptor, 'load')
        assert has_access(instructor, course_descriptor, 'load')
    else:
        metadata.update({'start': datetime.datetime(1970, 1, 1, tzinfo=UTC)})
        create_course_for_lti(coursenum, metadata)
        course_descriptor = world.scenario_dict['COURSE']
        course_location = world.scenario_dict['COURSE'].location
        user = InstructorFactory(course=course_location)

    # Enroll the user in the course and log them in
    if has_access(user, course_descriptor, 'load'):
        world.enroll_user(user, course_id(coursenum))

    world.log_in(username=user.username, password='******')
Beispiel #3
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)
Beispiel #4
0
def log_into_studio(
        uname='robot',
        email='*****@*****.**',
        password='******'):

    world.log_in(username=uname, password=password, email=email, name='Robot Studio')
    # Navigate to the studio dashboard
    world.visit('/')
Beispiel #5
0
def log_into_studio(uname='robot',
                    email='*****@*****.**',
                    password='******',
                    name='Robot Studio'):

    world.log_in(username=uname, password=password, email=email, name=name)
    # Navigate to the studio dashboard
    world.visit('/')
    assert_in(uname, world.css_text('span.account-username', timeout=10))
Beispiel #6
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': ['*****@*****.**', '*****@*****.**', '*****@*****.**']
    }
Beispiel #7
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': ['*****@*****.**', '*****@*****.**', '*****@*****.**']
    }
Beispiel #8
0
def i_am_registered_for_the_course(course, metadata):
    # Create the course
    create_course(course, metadata)

    # Create an instructor
    instructor = InstructorFactory(course=world.scenario_dict['COURSE'].location)

    # Enroll the user in the course and log them in
    world.enroll_user(instructor, course_id(course))
    world.log_in(username=instructor.username, password='******')
Beispiel #9
0
def log_into_studio(
        uname='robot',
        email='*****@*****.**',
        password='******',
        name='Robot Studio'):

    world.log_in(username=uname, password=password, email=email, name=name)
    # Navigate to the studio dashboard
    world.visit('/')
    world.wait_for(lambda _driver: uname in world.css_find('h2.title')[0].text)
Beispiel #10
0
def log_into_studio(uname='robot',
                    email='*****@*****.**',
                    password='******',
                    name='Robot Studio'):

    world.log_in(username=uname, password=password, email=email, name=name)
    # Navigate to the studio dashboard
    world.visit('/')

    assert uname in world.css_text('h2.title', max_attempts=15)
Beispiel #11
0
def log_into_studio(
        uname='robot',
        email='*****@*****.**',
        password='******',
        name='Robot Studio'):

    world.log_in(username=uname, password=password, email=email, name=name)
    # Navigate to the studio dashboard
    world.visit('/')
    assert_in(uname, world.css_text('span.account-username', timeout=10))
Beispiel #12
0
def log_into_studio(
        uname='robot',
        email='*****@*****.**',
        password='******',
        name='Robot Studio'):

    world.log_in(username=uname, password=password, email=email, name=name)
    # Navigate to the studio dashboard
    world.visit('/')

    assert uname in world.css_text('h2.title', max_attempts=15)
Beispiel #13
0
def i_am_registered_for_the_course(course, metadata):
    # Create the course
    create_course(course, metadata)

    # Create an instructor
    instructor = InstructorFactory(
        course=world.scenario_dict['COURSE'].location)

    # Enroll the user in the course and log them in
    world.enroll_user(instructor, course_id(course))
    world.log_in(username=instructor.username, password='******')
Beispiel #14
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.log_in(username='******', password='******')
Beispiel #15
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.log_in(username='******', password='******')
Beispiel #16
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='******')
Beispiel #17
0
def create_user_and_visit_course():
    world.create_user('robot', 'test')
    u = User.objects.get(username='******')

    CourseEnrollment.enroll(u, course_id(world.scenario_dict['COURSE'].number))

    world.log_in(username='******', password='******')
    chapter_name = (TEST_SECTION_NAME + "1").replace(" ", "_")
    section_name = (TEST_SUBSECTION_NAME + "1").replace(" ", "_")
    url = django_url('/courses/edx/model_course/Test_Course/courseware/%s/%s' %
                    (chapter_name, section_name))

    world.browser.visit(url)
Beispiel #18
0
def create_user_and_visit_course():
    world.create_user('robot', 'test')
    u = User.objects.get(username='******')

    CourseEnrollment.objects.get_or_create(user=u, course_id=course_id(world.scenario_dict['COURSE'].number))

    world.log_in(username='******', password='******')
    chapter_name = (TEST_SECTION_NAME + "1").replace(" ", "_")
    section_name = (TEST_SUBSECTION_NAME + "1").replace(" ", "_")
    url = django_url('/courses/edx/model_course/Test_Course/courseware/%s/%s' %
                    (chapter_name, section_name))

    world.browser.visit(url)
Beispiel #19
0
def i_am_registered_for_the_course(step, course):
    # Create the course
    create_course(step, course)

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

    # If the user is not already enrolled, enroll the user.
    # TODO: change to factory
    CourseEnrollment.objects.get_or_create(user=u, course_id=course_id(course))

    world.log_in('robot', 'test')
Beispiel #20
0
def create_user_and_visit_course():
    world.create_user('robot')
    u = User.objects.get(username='******')

    CourseEnrollment.objects.get_or_create(user=u, course_id=course_id("model_course"))

    world.log_in('robot', 'test')
    chapter_name = (TEST_SECTION_NAME + "1").replace(" ", "_")
    section_name = (TEST_SUBSECTION_NAME + "1").replace(" ", "_")
    url = django_url('/courses/edx/model_course/Test_Course/courseware/%s/%s' %
                    (chapter_name, section_name))

    world.browser.visit(url)
Beispiel #21
0
def i_am_staff_member_for_the_course(step, course_number):
    # Create the course
    create_course(step, course_number)
    course = get_course_by_id(course_id(course_number))

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

    # Add user as a course staff.
    allow_access(course, user, "staff")

    world.log_in(username='******', password='******')
Beispiel #22
0
def i_am_registered_for_the_course(step, course):
    # Create the course
    create_course(step, course)

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

    # If the user is not already enrolled, enroll the user.
    # TODO: change to factory
    CourseEnrollment.enroll(u, course_id(course))

    world.log_in(username='******', password='******')
Beispiel #23
0
def i_am_staff_or_instructor(step, role):  # pylint: disable=unused-argument
    ## In summary: makes a test course, makes a new Staff or Instructor user
    ## (depending on `role`), and logs that user in to the course

    # 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'
    )

    world.course_key = course.id
    world.role = 'instructor'
    # Log in as the an instructor or staff for the course
    if role == 'instructor':
        # Make & register an instructor for the course
        world.instructor = InstructorFactory(course_key=world.course_key)
        world.enroll_user(world.instructor, world.course_key)

        world.log_in(
            username=world.instructor.username,
            password='******',
            email=world.instructor.email,
            name=world.instructor.profile.name
        )

    else:
        world.role = 'staff'
        # Make & register a staff member
        world.staff = StaffFactory(course_key=world.course_key)
        world.enroll_user(world.staff, world.course_key)

        world.log_in(
            username=world.staff.username,
            password='******',
            email=world.staff.email,
            name=world.staff.profile.name
        )
Beispiel #24
0
def i_am_staff_or_instructor(step, role):  # pylint: disable=unused-argument
    ## In summary: makes a test course, makes a new Staff or Instructor user
    ## (depending on `role`), and logs that user in to the course

    # 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'
    )

    world.course_key = course.id
    world.role = 'instructor'
    # Log in as the an instructor or staff for the course
    if role == 'instructor':
        # Make & register an instructor for the course
        world.instructor = InstructorFactory(course_key=world.course_key)
        world.enroll_user(world.instructor, world.course_key)

        world.log_in(
            username=world.instructor.username,
            password='******',
            email=world.instructor.email,
            name=world.instructor.profile.name
        )

    else:
        world.role = 'staff'
        # Make & register a staff member
        world.staff = StaffFactory(course_key=world.course_key)
        world.enroll_user(world.staff, world.course_key)

        world.log_in(
            username=world.staff.username,
            password='******',
            email=world.staff.email,
            name=world.staff.profile.name
        )
Beispiel #25
0
def log_into_the_course(step, role):  # pylint: disable=unused-argument
    # Store the role
    assert_in(role, ['instructor', 'staff'])

    # Log in as the an instructor or staff for the course
    my_email = world.bulk_email_instructor.email
    if role == 'instructor':
        world.log_in(username=world.bulk_email_instructor.username,
                     password='******',
                     email=my_email,
                     name=world.bulk_email_instructor.profile.name)
    else:
        my_email = world.bulk_email_staff.email
        world.log_in(username=world.bulk_email_staff.username,
                     password='******',
                     email=my_email,
                     name=world.bulk_email_staff.profile.name)

    # Store the "myself" send to option
    world.expected_addresses['myself'] = [my_email]
Beispiel #26
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"
    )
Beispiel #27
0
def i_am_staff_or_instructor(step, role):  # pylint: disable=unused-argument
    ## In summary: makes a test course, makes a new Staff or Instructor user
    ## (depending on `role`), and logs that user in to the course

    # 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")

    world.course_id = "edx/999/Test_Course"
    world.role = "instructor"
    # Log in as the an instructor or staff for the course
    if role == "instructor":
        # Make & register an instructor for the course
        world.instructor = InstructorFactory(course=course.location)
        world.enroll_user(world.instructor, world.course_id)

        world.log_in(
            username=world.instructor.username,
            password="******",
            email=world.instructor.email,
            name=world.instructor.profile.name,
        )

    else:
        world.role = "staff"
        # Make & register a staff member
        world.staff = StaffFactory(course=course.location)
        world.enroll_user(world.staff, world.course_id)

        world.log_in(
            username=world.staff.username, password="******", email=world.staff.email, name=world.staff.profile.name
        )
def log_into_the_course(step, role):  # pylint: disable=unused-argument
    # Store the role
    assert_in(role, ['instructor', 'staff'])

    # Log in as the an instructor or staff for the course
    my_email = world.bulk_email_instructor.email
    if role == 'instructor':
        world.log_in(
            username=world.bulk_email_instructor.username,
            password='******',
            email=my_email,
            name=world.bulk_email_instructor.profile.name
        )
    else:
        my_email = world.bulk_email_staff.email
        world.log_in(
            username=world.bulk_email_staff.username,
            password='******',
            email=my_email,
            name=world.bulk_email_staff.profile.name
        )

    # Store the "myself" send to option
    world.expected_addresses['myself'] = [my_email]
Beispiel #29
0
def i_am_logged_in(step):
    world.create_user('robot', 'test')
    world.log_in(username='******', password='******')
    world.browser.visit(lettuce.django.django_url('/'))
    dash_css = '.container.dashboard'
    assert world.is_css_present(dash_css)
Beispiel #30
0
def i_am_logged_in(step):
    world.create_user('robot', 'test')
    world.log_in(username='******', password='******')
    world.browser.visit(django_url('/'))
    # You should not see the login link
    assert world.is_css_not_present('a#login')
Beispiel #31
0
def i_log_in(step):
    world.log_in(username='******', password='******')
Beispiel #32
0
def i_am_logged_in_user(step):
    world.create_user('robot', 'test')
    world.log_in(username='******', password='******')
Beispiel #33
0
def i_am_logged_in_user(step):
    world.create_user('robot')
    world.log_in('robot', 'test')
Beispiel #34
0
def i_log_in(step):
    world.log_in('robot', 'test')
Beispiel #35
0
def i_am_logged_in_user(step):
    world.create_user('robot', 'test')
    world.log_in(username='******', password='******')
Beispiel #36
0
def create_user_and_visit_course():
    # TODO:  this needs to update our mocked storage
    world.register_by_course_key(world.scenario_dict['COURSE'].id)
    world.log_in()
    world.visit(u'/courses/{}/courseware/'.format(
        world.scenario_dict['COURSE'].id))
Beispiel #37
0
def create_user_and_visit_course():
    world.register_by_course_key(
        SlashSeparatedCourseKey('edx', '999', 'Test_Course'))
    world.log_in()
    world.visit('/courses/edx/999/Test_Course/courseware/')
Beispiel #38
0
def create_user_and_visit_course():
    world.register_by_course_key(world.scenario_dict['COURSE'].id)
    world.log_in()
    world.visit(u'/courses/{}/courseware/'.format(world.scenario_dict['COURSE'].id))
Beispiel #39
0
def create_user_and_visit_course():
    world.register_by_course_key(SlashSeparatedCourseKey('edx', '999', 'Test_Course'))
    world.log_in()
    world.visit('/courses/edx/999/Test_Course/courseware/')
Beispiel #40
0
def i_am_logged_in(step):
    world.create_user('robot', 'test')
    world.log_in(username='******', password='******')
    world.browser.visit(django_url('/'))
    # You should not see the login link
    assert_equals(world.browser.find_by_css('a#login'), [])
Beispiel #41
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/')
Beispiel #42
0
def i_am_logged_in(step):
    world.create_user('robot', 'test')
    world.log_in(username='******', password='******')
    world.browser.visit(django_url('/'))
    # You should not see the login link
    assert_equals(world.browser.find_by_css('a#login'), [])
Beispiel #43
0
def i_am_staff_or_instructor(step, role):  # pylint: disable=unused-argument
    ## In summary: makes a test course, makes a new Staff or Instructor user
    ## (depending on `role`), and logs that user in to the course

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

    # Clear existing courses to avoid conflicts
    delete_pgreport_csv("edx/999/Test_Course")
    world.clear_courses()

    # Create a new course
    world.scenario_dict['COURSE'] = world.CourseFactory.create(
        org='edx', number='999', display_name='Test Course')
    section1 = world.ItemFactory.create(
        parent_location=world.scenario_dict['COURSE'].location,
        category='chapter',
        display_name="Test Section 1")
    subsec1 = world.ItemFactory.create(parent_location=section1.location,
                                       category='sequential',
                                       display_name="Test Subsection 1")
    vertical1 = world.ItemFactory.create(
        parent_location=subsec1.location,
        category='vertical',
        display_name="Test Vertical 1",
    )
    problem_xml = PROBLEM_DICT['drop down']['factory'].build_xml(
        **PROBLEM_DICT['drop down']['kwargs'])
    problem1 = world.ItemFactory.create(parent_location=vertical1.location,
                                        category='problem',
                                        display_name="Problem 1",
                                        data=problem_xml)

    world.course_id = world.scenario_dict['COURSE'].id

    if not ProgressModules.objects.filter(location=problem1.location).exists():
        world.pgmodule = world.ProgressModulesFactory.create(
            location=problem1.location,
            course_id=world.course_id,
            display_name="Problem 1")

    world.role = 'instructor'
    # Log in as the an instructor or staff for the course
    if role == 'instructor':
        # Make & register an instructor for the course
        world.instructor = InstructorFactory(
            course_key=world.scenario_dict['COURSE'].course_key)
        world.enroll_user(world.instructor, world.course_key)

        world.log_in(username=world.instructor.username,
                     password='******',
                     email=world.instructor.email,
                     name=world.instructor.profile.name)

    else:
        world.role = 'staff'
        # Make & register a staff member
        world.staff = StaffFactory(
            course_key=world.scenario_dict['COURSE'].course_key)
        world.enroll_user(world.staff, world.course_key)

        world.log_in(username=world.staff.username,
                     password='******',
                     email=world.staff.email,
                     name=world.staff.profile.name)

    create_pgreport_csv(world.course_id)
Beispiel #44
0
def i_log_in(step):
    world.log_in(username='******', password='******')
Beispiel #45
0
def create_user_and_visit_course():
    world.register_by_course_key(world.scenario_dict['COURSE'].id)
    world.log_in()
    world.visit(u'/courses/{}/courseware/'.format(
        world.scenario_dict['COURSE'].id))
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/')
Beispiel #47
0
def i_log_in(step):
    world.log_in('robot', 'test')
Beispiel #48
0
def i_am_logged_in_user(step):
    world.create_user('robot')
    world.log_in('robot', 'test')
Beispiel #49
0
def log_into_studio(uname="robot", email="*****@*****.**", password="******", name="Robot Studio"):

    world.log_in(username=uname, password=password, email=email, name=name)
    # Navigate to the studio dashboard
    world.visit("/")
    assert_in(uname, world.css_text("h2.title", timeout=10))
Beispiel #50
0
def i_am_logged_in(step):
    world.create_user('robot', 'test')
    world.log_in(username='******', password='******')
    world.browser.visit(lettuce.django.django_url('/'))
    dash_css = '.dashboard'
    assert world.is_css_present(dash_css)
Beispiel #51
0
def i_am_staff_or_instructor(step, role):  # pylint: disable=unused-argument
    ## In summary: makes a test course, makes a new Staff or Instructor user
    ## (depending on `role`), and logs that user in to the course

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

    # Clear existing courses to avoid conflicts
    delete_pgreport_csv("edx/999/Test_Course")
    world.clear_courses()

    # Create a new course
    world.scenario_dict['COURSE'] = world.CourseFactory.create(
        org='edx',
        number='999',
        display_name='Test Course'
    )
    section1 = world.ItemFactory.create(
        parent_location=world.scenario_dict['COURSE'].location,
        category='chapter',
        display_name="Test Section 1"
    )
    subsec1 = world.ItemFactory.create(
        parent_location=section1.location,
        category='sequential',
        display_name="Test Subsection 1"
    )
    vertical1 = world.ItemFactory.create(
        parent_location=subsec1.location,
        category='vertical',
        display_name="Test Vertical 1",
    )
    problem_xml = PROBLEM_DICT['drop down']['factory'].build_xml(
        **PROBLEM_DICT['drop down']['kwargs'])
    problem1 = world.ItemFactory.create(
        parent_location=vertical1.location,
        category='problem',
        display_name="Problem 1",
        data=problem_xml
    )

    world.course_id = world.scenario_dict['COURSE'].id

    if not ProgressModules.objects.filter(location=problem1.location).exists():
        world.pgmodule = world.ProgressModulesFactory.create(
            location=problem1.location,
            course_id=world.course_id,
            display_name="Problem 1"
        )

    world.role = 'instructor'
    # Log in as the an instructor or staff for the course
    if role == 'instructor':
        # Make & register an instructor for the course
        world.instructor = InstructorFactory(
            course_key=world.scenario_dict['COURSE'].course_key)
        world.enroll_user(world.instructor, world.course_key)

        world.log_in(
            username=world.instructor.username,
            password='******',
            email=world.instructor.email,
            name=world.instructor.profile.name
        )

    else:
        world.role = 'staff'
        # Make & register a staff member
        world.staff = StaffFactory(
            course_key=world.scenario_dict['COURSE'].course_key)
        world.enroll_user(world.staff, world.course_key)

        world.log_in(
            username=world.staff.username,
            password='******',
            email=world.staff.email,
            name=world.staff.profile.name
        )

    create_pgreport_csv(world.course_id)