示例#1
0
def create_cert_course():
    world.clear_courses()
    org = 'edx'
    number = '999'
    name = 'Certificates'
    course_id = '{org}/{number}/{name}'.format(
        org=org, number=number, name=name)
    world.scenario_dict['course_id'] = course_id
    world.scenario_dict['COURSE'] = world.CourseFactory.create(
        org=org, number=number, display_name=name)

    audit_mode = world.CourseModeFactory.create(
        course_id=course_id,
        mode_slug='audit',
        mode_display_name='audit course',
        min_price=0,
        )
    assert isinstance(audit_mode, CourseMode)

    verfied_mode = world.CourseModeFactory.create(
        course_id=course_id,
        mode_slug='verified',
        mode_display_name='verified cert course',
        min_price=16,
        suggested_prices='32,64,128',
        currency='usd',
        )
    assert isinstance(verfied_mode, CourseMode)
示例#2
0
def create_cert_course():
    world.clear_courses()
    org = 'edx'
    number = '999'
    name = 'Certificates'
    world.scenario_dict['COURSE'] = world.CourseFactory.create(
        org=org, number=number, display_name=name)
    world.scenario_dict['course_id'] = world.scenario_dict['COURSE'].id
    world.UPSELL_LINK_CSS = u'.message-upsell a.action-upgrade[href*="{}"]'.format(
        world.scenario_dict['course_id']
    )

    honor_mode = world.CourseModeFactory.create(
        course_id=world.scenario_dict['course_id'],
        mode_slug='honor',
        mode_display_name='honor mode',
        min_price=0,
    )

    verfied_mode = world.CourseModeFactory.create(
        course_id=world.scenario_dict['course_id'],
        mode_slug='verified',
        mode_display_name='verified cert course',
        min_price=16,
        suggested_prices='32,64,128',
        currency='usd',
        )
示例#3
0
def create_course(_step, course):

    # First clear the modulestore so we don't try to recreate
    # the same course twice
    # This also ensures that the necessary templates are loaded
    world.clear_courses()

    # Create the course
    # We always use the same org and display name,
    # but vary the course identifier (e.g. 600x or 191x)
    world.scenario_dict['COURSE'] = world.CourseFactory.create(
        org='edx',
        number=course,
        display_name='Test Course'
    )

    # Add a chapter to the course to contain problems
    world.scenario_dict['CHAPTER'] = world.ItemFactory.create(
        parent_location=world.scenario_dict['COURSE'].location,
        category='chapter',
        display_name='Test Chapter',
    )

    world.scenario_dict['SECTION'] = world.ItemFactory.create(
        parent_location=world.scenario_dict['CHAPTER'].location,
        category='sequential',
        display_name='Test Section',
    )
示例#4
0
def have_a_course_with_1_section(step):
    world.clear_courses()
    course = world.CourseFactory.create()
    section = world.ItemFactory.create(parent_location=course.location)
    subsection1 = world.ItemFactory.create(
        parent_location=section.location, category="sequential", display_name="Subsection One"
    )
示例#5
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_key = course.id

    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_key=world.bulk_email_course_key)
        world.enroll_user(world.bulk_email_instructor, world.bulk_email_course_key)

        # Make & register a staff member
        world.bulk_email_staff = StaffFactory(course_key=course.id)
        world.enroll_user(world.bulk_email_staff, world.bulk_email_course_key)

    # Make & register a student
    world.register_by_course_key(course.id, 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 + ["*****@*****.**"],
    }
示例#6
0
def create_course_for_lti(course, metadata):
    # First clear the modulestore so we don't try to recreate
    # the same course twice
    # This also ensures that the necessary templates are loaded
    world.clear_courses()

    weight = 0.1
    grading_policy = {
        "GRADER": [{"type": "Homework", "min_count": 1, "drop_count": 0, "short_label": "HW", "weight": weight}]
    }

    # Create the course
    # We always use the same org and display name,
    # but vary the course identifier (e.g. 600x or 191x)
    world.scenario_dict["COURSE"] = world.CourseFactory.create(
        org="edx", number=course, display_name="Test Course", metadata=metadata, grading_policy=grading_policy
    )

    # Add a section to the course to contain problems
    world.scenario_dict["CHAPTER"] = world.ItemFactory.create(
        parent_location=world.scenario_dict["COURSE"].location, category="chapter", display_name="Test Chapter"
    )
    world.scenario_dict["SECTION"] = world.ItemFactory.create(
        parent_location=world.scenario_dict["CHAPTER"].location,
        category="sequential",
        display_name="Test Section",
        metadata={"graded": True, "format": "Homework"},
    )
示例#7
0
def create_course_with_unit():
    """
    Prepare for tests by creating a course with a section, subsection, and unit.
    Performs the following:
        Clear out all courseware
        Create a course with a section, subsection, and unit
        Create a user and make that user a course author
        Log the user into studio
        Open the course from the dashboard
        Expand the section and click on the New Unit link
    The end result is the page where the user is editing the new unit
    """
    world.clear_courses()
    course = world.CourseFactory.create()
    world.scenario_dict["COURSE"] = course
    section = world.ItemFactory.create(parent_location=course.location)
    world.ItemFactory.create(parent_location=section.location, category="sequential", display_name="Subsection One")
    user = create_studio_user(is_staff=False)
    add_course_author(user, course)

    log_into_studio()
    world.css_click("a.course-link")

    world.wait_for_js_to_load()
    css_selectors = ["div.section-item a.expand-collapse", "a.new-unit-item"]
    for selector in css_selectors:
        world.css_click(selector)

    world.wait_for_mathjax()
    world.wait_for_xmodule()

    assert world.is_css_present("ul.new-component-type")
def have_a_course_with_1_section(step):
    world.clear_courses()
    course = world.CourseFactory.create()
    section = world.ItemFactory.create(parent_location=course.location)
    subsection1 = world.ItemFactory.create(
        parent_location=section.location,
        template='i4x://edx/templates/sequential/Empty',
        display_name='Subsection One',)
示例#9
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': ['*****@*****.**', '*****@*****.**', '*****@*****.**']
    }
示例#10
0
def create_course_for_lti(course, metadata):
    # First clear the modulestore so we don't try to recreate
    # the same course twice
    # This also ensures that the necessary templates are loaded
    world.clear_courses()

    weight = 0.1
    grading_policy = {
        "GRADER": [
            {
                "type": "Homework",
                "min_count": 1,
                "drop_count": 0,
                "short_label": "HW",
                "weight": weight
            },
        ]
    }
    metadata.update(grading_policy)

    # Create the course
    # We always use the same org and display name,
    # but vary the course identifier (e.g. 600x or 191x)
    world.scenario_dict['COURSE'] = world.CourseFactory.create(
        org='edx',
        number=course,
        display_name='Test Course',
        metadata=metadata,
        grading_policy={
            "GRADER": [
                {
                    "type": "Homework",
                    "min_count": 1,
                    "drop_count": 0,
                    "short_label": "HW",
                    "weight": weight
                },
            ]
        },
    )

    # Add a section to the course to contain problems
    world.scenario_dict['CHAPTER'] = world.ItemFactory.create(
        parent_location=world.scenario_dict['COURSE'].location,
        category='chapter',
        display_name='Test Chapter',
    )
    world.scenario_dict['SECTION'] = world.ItemFactory.create(
        parent_location=world.scenario_dict['CHAPTER'].location,
        category='sequential',
        display_name='Test Section',
        metadata={
            'graded': True,
            'format': 'Homework'
        })
示例#11
0
def create_course(course, metadata):

    # First clear the modulestore so we don't try to recreate
    # the same course twice
    # This also ensures that the necessary templates are loaded
    world.clear_courses()

    weight = 0.1
    grading_policy = {
        "GRADER": [
            {
                "type": "Homework",
                "min_count": 1,
                "drop_count": 0,
                "short_label": "HW",
                "weight": weight
            },
        ]
    }
    metadata.update(grading_policy)

    # Create the course
    # We always use the same org and display name,
    # but vary the course identifier (e.g. 600x or 191x)
    world.scenario_dict['COURSE'] = world.CourseFactory.create(
        org='edx',
        number=course,
        display_name='Test Course',
        metadata=metadata,
        grading_policy={
            "GRADER": [
                {
                    "type": "Homework",
                    "min_count": 1,
                    "drop_count": 0,
                    "short_label": "HW",
                    "weight": weight
                },
            ]
        },
    )

    # Add a section to the course to contain problems
    world.scenario_dict['CHAPTER'] = world.ItemFactory.create(
        parent_location=world.scenario_dict['COURSE'].location,
        category='chapter',
        display_name='Test Chapter',
    )
    world.scenario_dict['SECTION'] = world.ItemFactory.create(
        parent_location=world.scenario_dict['CHAPTER'].location,
        category='sequential',
        display_name='Test Section',
        metadata={'graded': True, 'format': 'Homework'})
示例#12
0
def add_unit(step):
    world.clear_courses()
    course = world.CourseFactory.create()
    section = world.ItemFactory.create(parent_location=course.location)
    world.ItemFactory.create(
        parent_location=section.location,
        category='sequential',
        display_name='Subsection One',)
    user = create_studio_user(is_staff=False)
    add_course_author(user, course)
    log_into_studio()
    css_selectors = ['a.course-link', 'div.section-item a.expand-collapse-icon', 'a.new-unit-item']
    for selector in css_selectors:
        world.css_click(selector)
示例#13
0
def have_a_course_with_two_sections(step):
    world.clear_courses()
    course = world.CourseFactory.create()
    section = world.ItemFactory.create(parent_location=course.location)
    subsection1 = world.ItemFactory.create(
        parent_location=section.location, category="sequential", display_name="Subsection One"
    )
    section2 = world.ItemFactory.create(parent_location=course.location, display_name="Section Two")
    subsection2 = world.ItemFactory.create(
        parent_location=section2.location, category="sequential", display_name="Subsection Alpha"
    )
    subsection3 = world.ItemFactory.create(
        parent_location=section2.location, category="sequential", display_name="Subsection Beta"
    )
示例#14
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':
        ['*****@*****.**', '*****@*****.**', '*****@*****.**']
    }
示例#15
0
def i_have_populated_a_new_course(_step):
    world.clear_courses()
    course = world.CourseFactory.create()
    world.scenario_dict['COURSE'] = course
    section = world.ItemFactory.create(parent_location=course.location)
    world.ItemFactory.create(
        parent_location=section.location,
        category='sequential',
        display_name='Subsection One',
    )
    user = create_studio_user(is_staff=False)
    add_course_author(user, course)

    log_into_studio()

    world.css_click('a.course-link')
    world.wait_for_js_to_load()
示例#16
0
def i_have_populated_a_new_course(_step):
    world.clear_courses()
    course = world.CourseFactory.create()
    world.scenario_dict['COURSE'] = course
    section = world.ItemFactory.create(parent_location=course.location)
    world.ItemFactory.create(
        parent_location=section.location,
        category='sequential',
        display_name='Subsection One',
    )
    user = create_studio_user(is_staff=False)
    add_course_author(user, course)

    log_into_studio()

    world.css_click('a.course-link')
    world.wait_for_js_to_load()
示例#17
0
def add_unit(step):
    world.clear_courses()
    course = world.CourseFactory.create()
    section = world.ItemFactory.create(parent_location=course.location)
    world.ItemFactory.create(
        parent_location=section.location,
        category='sequential',
        display_name='Subsection One',
    )
    user = create_studio_user(is_staff=False)
    add_course_author(user, course)
    log_into_studio()
    css_selectors = [
        'a.course-link', 'div.section-item a.expand-collapse-icon',
        'a.new-unit-item'
    ]
    for selector in css_selectors:
        world.css_click(selector)
示例#18
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
        )
示例#19
0
文件: common.py 项目: gopinath81/vmss
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
        )
示例#20
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_key = course.id

    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_key=world.bulk_email_course_key)
        world.enroll_user(world.bulk_email_instructor,
                          world.bulk_email_course_key)

        # Make & register a staff member
        world.bulk_email_staff = StaffFactory(course_key=course.id)
        world.enroll_user(world.bulk_email_staff, world.bulk_email_course_key)

    # Make & register a student
    world.register_by_course_key(course.id,
                                 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 + ['*****@*****.**']
    }
示例#21
0
def have_a_course_with_two_sections(step):
    world.clear_courses()
    course = world.CourseFactory.create()
    section = world.ItemFactory.create(parent_location=course.location)
    subsection1 = world.ItemFactory.create(
        parent_location=section.location,
        category='sequential',
        display_name='Subsection One',)
    section2 = world.ItemFactory.create(
        parent_location=course.location,
        display_name='Section Two',)
    subsection2 = world.ItemFactory.create(
        parent_location=section2.location,
        category='sequential',
        display_name='Subsection Alpha',)
    subsection3 = world.ItemFactory.create(
        parent_location=section2.location,
        category='sequential',
        display_name='Subsection Beta',)
示例#22
0
def create_course(step, course):

    # First clear the modulestore so we don't try to recreate
    # the same course twice
    # This also ensures that the necessary templates are loaded
    world.clear_courses()

    # Create the course
    # We always use the same org and display name,
    # but vary the course identifier (e.g. 600x or 191x)
    course = world.CourseFactory.create(org=TEST_COURSE_ORG,
                                        number=course,
                                        display_name=TEST_COURSE_NAME)

    # Add a section to the course to contain problems
    section = world.ItemFactory.create(parent_location=course.location,
                                       display_name=TEST_SECTION_NAME)

    problem_section = world.ItemFactory.create(parent_location=section.location,
                                               template='i4x://edx/templates/sequential/Empty',
                                               display_name=TEST_SECTION_NAME)
示例#23
0
def create_course(step, course):

    # First clear the modulestore so we don't try to recreate
    # the same course twice
    # This also ensures that the necessary templates are loaded
    world.clear_courses()

    # Create the course
    # We always use the same org and display name,
    # but vary the course identifier (e.g. 600x or 191x)
    course = world.CourseFactory.create(org=TEST_COURSE_ORG,
                                        number=course,
                                        display_name=TEST_COURSE_NAME)

    # Add a section to the course to contain problems
    section = world.ItemFactory.create(parent_location=course.location,
                                       display_name=TEST_SECTION_NAME)

    problem_section = world.ItemFactory.create(parent_location=section.location,
                                               template='i4x://edx/templates/sequential/Empty',
                                               display_name=TEST_SECTION_NAME)
示例#24
0
def add_unit(step):
    world.clear_courses()
    course = world.CourseFactory.create()
    section = world.ItemFactory.create(parent_location=course.location)
    world.ItemFactory.create(
        parent_location=section.location,
        category='sequential',
        display_name='Subsection One',)
    user = create_studio_user(is_staff=False)
    add_course_author(user, course)
    log_into_studio()
    world.wait_for_requirejs([
        "jquery", "gettext", "js/models/course", "coffee/src/models/module",
        "coffee/src/views/unit", "jquery.ui",
    ])
    world.wait_for_mathjax()
    css_selectors = [
        'a.course-link', 'div.section-item a.expand-collapse-icon',
        'a.new-unit-item',
    ]
    for selector in css_selectors:
        world.css_click(selector)
示例#25
0
def create_course(_step, course):

    # First clear the modulestore so we don't try to recreate
    # the same course twice
    # This also ensures that the necessary templates are loaded
    world.clear_courses()

    # Create the course
    # We always use the same org and display name,
    # but vary the course identifier (e.g. 600x or 191x)
    world.scenario_dict['COURSE'] = world.CourseFactory.create(org='edx',
                                        number=course,
                                        display_name='Test Course')

    # Add a section to the course to contain problems
    world.scenario_dict['SECTION'] = world.ItemFactory.create(parent_location=world.scenario_dict['COURSE'].location,
                                       display_name='Test Section')

    world.ItemFactory.create(
        parent_location=world.scenario_dict['SECTION'].location,
        category='sequential',
        display_name='Test Section')
示例#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"
    )
示例#27
0
def create_course_with_unit():
    """
    Prepare for tests by creating a course with a section, subsection, and unit.
    Performs the following:
        Clear out all courseware
        Create a course with a section, subsection, and unit
        Create a user and make that user a course author
        Log the user into studio
        Open the course from the dashboard
        Expand the section and click on the New Unit link
    The end result is the page where the user is editing the new unit
    """
    world.clear_courses()
    course = world.CourseFactory.create()
    world.scenario_dict['COURSE'] = course
    section = world.ItemFactory.create(parent_location=course.location)
    world.ItemFactory.create(
        parent_location=section.location,
        category='sequential',
        display_name='Subsection One',
    )
    user = create_studio_user(is_staff=False)
    add_course_author(user, course)

    log_into_studio()
    world.css_click('a.course-link')

    world.wait_for_js_to_load()
    css_selectors = [
        'div.section-item a.expand-collapse-icon', 'a.new-unit-item'
    ]
    for selector in css_selectors:
        world.css_click(selector)

    world.wait_for_mathjax()
    world.wait_for_xmodule()

    assert world.is_css_present('ul.new-component-type')
示例#28
0
def create_cert_course():
    world.clear_courses()
    org = "edx"
    number = "999"
    name = "Certificates"
    course_id = "{org}/{number}/{name}".format(org=org, number=number, name=name)
    world.scenario_dict["course_id"] = course_id
    world.scenario_dict["COURSE"] = world.CourseFactory.create(org=org, number=number, display_name=name)

    audit_mode = world.CourseModeFactory.create(
        course_id=course_id, mode_slug="audit", mode_display_name="audit course", min_price=0
    )
    assert isinstance(audit_mode, CourseMode)

    verfied_mode = world.CourseModeFactory.create(
        course_id=course_id,
        mode_slug="verified",
        mode_display_name="verified cert course",
        min_price=16,
        suggested_prices="32,64,128",
        currency="usd",
    )
    assert isinstance(verfied_mode, CourseMode)
示例#29
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
        )
示例#30
0
def create_course():
    world.clear_courses()

    world.scenario_dict['COURSE'] = world.CourseFactory.create(org='edx', number='model_course', display_name='Test Course')
示例#31
0
def create_course():
    world.clear_courses()

    world.CourseFactory.create(org=TEST_COURSE_ORG,
                                        number="model_course",
                                        display_name=TEST_COURSE_NAME)
示例#32
0
def have_a_course(step):
    world.clear_courses()
    course = world.CourseFactory.create()
示例#33
0
def create_course():
    world.clear_courses()
    world.scenario_dict["COURSE"] = world.CourseFactory.create(org="edx", number="999", display_name="Test Course")
示例#34
0
def no_courses(step):
    world.clear_courses()
    create_studio_user()
示例#35
0
def no_courses(step):
    world.clear_courses()
示例#36
0
def open_new_course():
    world.clear_courses()
    log_into_studio()
    create_a_course()
示例#37
0
def i_have_opened_a_new_course(step):
    world.clear_courses()
    log_into_studio()
    create_a_course()
示例#38
0
def no_courses(step):
    world.clear_courses()
示例#39
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)
示例#40
0
def create_course():
    world.clear_courses()
    world.scenario_dict['COURSE'] = world.CourseFactory.create(
        org='edx', number='999', display_name='Test Course')
示例#41
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)
示例#42
0
def create_course(is_marketo_course):
    world.clear_courses()
    name = is_marketo_course and 'Marketo Test' or 'No Marketo'
    world.scenario_dict['COURSE'] = world.CourseFactory.create(
        org='testorg', number='101', display_name=name)
示例#43
0
def open_new_course():
    world.clear_courses()
    create_studio_user()
    log_into_studio()
    create_a_course()
示例#44
0
def no_courses(step):
    world.clear_courses()
    create_studio_user()
示例#45
0
def have_a_course(step):
    world.clear_courses()
    course = world.CourseFactory.create()
示例#46
0
def i_have_opened_a_new_course_section(step):
    world.clear_courses()
    log_into_studio()
    create_a_course()
    add_section()