Esempio n. 1
0
def create_other_user(_step, name, course_admin):
    user = create_studio_user(uname=name, password=PASSWORD, email=(name + EMAIL_EXTENSION))
    if course_admin:
        location = world.scenario_dict["COURSE"].location
        for role in ("staff", "instructor"):
            group, __ = Group.objects.get_or_create(name=get_course_groupname_for_role(location, role))
            user.groups.add(group)
        user.save()
Esempio n. 2
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)
Esempio n. 3
0
def create_other_user(_step, name, has_extra_perms, role_name):
    email = name + EMAIL_EXTENSION
    user = create_studio_user(uname=name, password=PASSWORD, email=email)
    if has_extra_perms:
        location = world.scenario_dict["COURSE"].location
        if role_name == "admin":
            # admins get staff privileges, as well
            roles = ("staff", "instructor")
        else:
            roles = ("staff", )
        for role in roles:
            groupname = get_course_groupname_for_role(location, role)
            group, __ = Group.objects.get_or_create(name=groupname)
            user.groups.add(group)
        user.save()
Esempio n. 4
0
def create_other_user(_step, name, has_extra_perms, role_name):
    email = name + EMAIL_EXTENSION
    user = create_studio_user(uname=name, password=PASSWORD, email=email)
    if has_extra_perms:
        location = world.scenario_dict["COURSE"].location
        if role_name == "admin":
            # admins get staff privileges, as well
            roles = ("staff", "instructor")
        else:
            roles = ("staff",)
        for role in roles:
            groupname = get_course_groupname_for_role(location, role)
            group, __ = Group.objects.get_or_create(name=groupname)
            user.groups.add(group)
        user.save()
Esempio n. 5
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)
Esempio n. 6
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)
Esempio n. 7
0
def create_other_user(_step, name):
    create_studio_user(uname=name,
                       password=PASSWORD,
                       email=(name + EMAIL_EXTENSION))
Esempio n. 8
0
def create_other_user(_step, name):
    create_studio_user(uname=name, password=PASSWORD, email=(name + EMAIL_EXTENSION))