예제 #1
0
def view_video(_step, player_mode):

    i_am_registered_for_the_course(_step, coursenum)

    # Make sure we have a video
    add_video_to_course(coursenum, player_mode.lower())
    visit_scenario_item('SECTION')
예제 #2
0
def view_video(_step, player_mode):

    i_am_registered_for_the_course(_step, coursenum)

    # Make sure we have a video
    add_video_to_course(coursenum, player_mode.lower())
    visit_scenario_item('SECTION')
예제 #3
0
    def setup_conditional(self, step, condition_type, condition, cond_value):
        r'that a course has a Conditional conditioned on (?P<condition_type>\w+) (?P<condition>\w+)=(?P<cond_value>\w+)$'

        i_am_registered_for_the_course(step, self.COURSE_NUM)

        world.scenario_dict['VERTICAL'] = world.ItemFactory(
            parent_location=world.scenario_dict['SECTION'].location,
            category='vertical',
            display_name="Test Vertical",
        )

        world.scenario_dict['WRAPPER'] = world.ItemFactory(
            parent_location=world.scenario_dict['VERTICAL'].location,
            category='wrapper',
            display_name="Test Poll Wrapper")

        if condition_type == 'problem':
            world.scenario_dict['CONDITION_SOURCE'] = add_problem_to_course(
                self.COURSE_NUM, 'string')
        elif condition_type == 'poll':
            world.scenario_dict['CONDITION_SOURCE'] = world.ItemFactory(
                parent_location=world.scenario_dict['WRAPPER'].location,
                category='poll_question',
                display_name='Conditional Poll',
                data={
                    'question':
                    'Is this a good poll?',
                    'answers': [{
                        'id': 'yes',
                        'text': 'Yes, of course'
                    }, {
                        'id': 'no',
                        'text': 'Of course not!'
                    }],
                })
        else:
            raise Exception(
                "Unknown condition type: {!r}".format(condition_type))

        metadata = {
            'xml_attributes': {
                'sources':
                world.scenario_dict['CONDITION_SOURCE'].location.url()
            }
        }
        metadata['xml_attributes'][condition] = cond_value

        world.scenario_dict['CONDITIONAL'] = world.ItemFactory(
            parent_location=world.scenario_dict['WRAPPER'].location,
            category='conditional',
            display_name="Test Conditional",
            metadata=metadata)

        world.ItemFactory(
            parent_location=world.scenario_dict['CONDITIONAL'].location,
            category='html',
            display_name='Conditional Contents',
            data='<html><div class="hidden-contents">Hidden Contents</p></html>'
        )
예제 #4
0
def _view_problem(step, problem_type, problem_settings=None):
    i_am_registered_for_the_course(step, 'model_course')

    # Ensure that the course has this problem type
    add_problem_to_course(world.scenario_dict['COURSE'].number, problem_type, problem_settings)

    # Go to the one section in the factory-created course
    # which should be loaded with the correct problem
    visit_scenario_item('SECTION')
예제 #5
0
    def setup_conditional(self, step, condition_type, condition, cond_value):
        r'that a course has a Conditional conditioned on (?P<condition_type>\w+) (?P<condition>\w+)=(?P<cond_value>\w+)$'

        i_am_registered_for_the_course(step, self.COURSE_NUM)

        world.scenario_dict['VERTICAL'] = world.ItemFactory(
            parent_location=world.scenario_dict['SECTION'].location,
            category='vertical',
            display_name="Test Vertical",
        )

        world.scenario_dict['WRAPPER'] = world.ItemFactory(
            parent_location=world.scenario_dict['VERTICAL'].location,
            category='wrapper',
            display_name="Test Poll Wrapper"
        )

        if condition_type == 'problem':
            world.scenario_dict['CONDITION_SOURCE'] = add_problem_to_course(self.COURSE_NUM, 'string')
        elif condition_type == 'poll':
            world.scenario_dict['CONDITION_SOURCE'] = world.ItemFactory(
                parent_location=world.scenario_dict['WRAPPER'].location,
                category='poll_question',
                display_name='Conditional Poll',
                data={
                    'question': 'Is this a good poll?',
                    'answers': [
                        {'id': 'yes', 'text': 'Yes, of course'},
                        {'id': 'no', 'text': 'Of course not!'}
                    ],
                }
            )
        else:
            raise Exception("Unknown condition type: {!r}".format(condition_type))

        metadata = {
            'xml_attributes': {
                condition: cond_value
            }
        }

        world.scenario_dict['CONDITIONAL'] = world.ItemFactory(
            parent_location=world.scenario_dict['WRAPPER'].location,
            category='conditional',
            display_name="Test Conditional",
            metadata=metadata,
            sources_list=[world.scenario_dict['CONDITION_SOURCE'].location],
        )

        world.ItemFactory(
            parent_location=world.scenario_dict['CONDITIONAL'].location,
            category='html',
            display_name='Conditional Contents',
            data='<html><div class="hidden-contents">Hidden Contents</p></html>'
        )

        publish(world.scenario_dict['VERTICAL'].location)
예제 #6
0
파일: gst.py 프로젝트: jswope00/griffinx
    def setup_gst(self, step):
        r'that I have a course with a Graphical Slider Tool$'

        i_am_registered_for_the_course(step, self.COURSE_NUM)

        world.scenario_dict['GST'] = world.ItemFactory(
            parent_location=world.scenario_dict['SECTION'].location,
            category='graphical_slider_tool',
            display_name="Test GST",
            data=DEFAULT_DATA)
예제 #7
0
파일: gst.py 프로젝트: 6thfdwp/edx-platform
    def setup_gst(self, step):
        r'that I have a course with a Graphical Slider Tool$'

        i_am_registered_for_the_course(step, self.COURSE_NUM)

        world.scenario_dict['GST'] = world.ItemFactory(
            parent_location=world.scenario_dict['SECTION'].location,
            category='graphical_slider_tool',
            display_name="Test GST",
            data=DEFAULT_DATA
        )
예제 #8
0
def view_videoalpha(step):
    coursename = TEST_COURSE_NAME.replace(" ", "_")
    i_am_registered_for_the_course(step, coursename)

    # Make sure we have a videoalpha
    add_videoalpha_to_course(coursename)
    chapter_name = TEST_SECTION_NAME.replace(" ", "_")
    section_name = chapter_name
    url = django_url("/courses/edx/Test_Course/Test_Course/courseware/%s/%s" % (chapter_name, section_name))

    world.browser.visit(url)
예제 #9
0
def view_video(_step, player_mode):
    coursenum = 'test_course'
    i_am_registered_for_the_course(step, coursenum)

    # Make sure we have a video
    add_video_to_course(coursenum, player_mode.lower())
    chapter_name = world.scenario_dict['SECTION'].display_name.replace(" ", "_")
    section_name = chapter_name
    url = django_url('/courses/%s/%s/%s/courseware/%s/%s' %
                    (world.scenario_dict['COURSE'].org, world.scenario_dict['COURSE'].number, world.scenario_dict['COURSE'].display_name.replace(' ', '_'),
                        chapter_name, section_name,))
    world.browser.visit(url)
예제 #10
0
def view_video(_step, player_mode):
    coursenum = 'test_course'
    i_am_registered_for_the_course(step, coursenum)

    # Make sure we have a video
    add_video_to_course(coursenum, player_mode.lower())
    chapter_name = world.scenario_dict['SECTION'].display_name.replace(" ", "_")
    section_name = chapter_name
    url = django_url('/courses/%s/%s/%s/courseware/%s/%s' %
                    (world.scenario_dict['COURSE'].org, world.scenario_dict['COURSE'].number, world.scenario_dict['COURSE'].display_name.replace(' ', '_'),
                        chapter_name, section_name,))
    world.browser.visit(url)
예제 #11
0
파일: video.py 프로젝트: samH99/LexisNexis
def view_video(step):
    coursename = TEST_COURSE_NAME.replace(' ', '_')
    i_am_registered_for_the_course(step, coursename)

    # Make sure we have a video
    add_video_to_course(coursename)
    chapter_name = TEST_SECTION_NAME.replace(" ", "_")
    section_name = chapter_name
    url = django_url('/courses/edx/Test_Course/Test_Course/courseware/%s/%s' %
                     (chapter_name, section_name))

    world.browser.visit(url)
예제 #12
0
def view_problem(step, problem_type):
    i_am_registered_for_the_course(step, 'model_course')

    # Ensure that the course has this problem type
    add_problem_to_course('model_course', problem_type)

    # Go to the one section in the factory-created course
    # which should be loaded with the correct problem
    chapter_name = world.scenario_dict['SECTION'].display_name.replace(" ", "_")
    section_name = chapter_name
    url = django_url('/courses/%s/%s/%s/courseware/%s/%s' %
                    (world.scenario_dict['COURSE'].org, world.scenario_dict['COURSE'].number, world.scenario_dict['COURSE'].display_name.replace(' ', '_'),
                        chapter_name, section_name,))
    world.browser.visit(url)
예제 #13
0
def view_problem(step, problem_type):
    i_am_registered_for_the_course(step, 'model_course')

    # Ensure that the course has this problem type
    add_problem_to_course('model_course', problem_type)

    # Go to the one section in the factory-created course
    # which should be loaded with the correct problem
    chapter_name = TEST_SECTION_NAME.replace(" ", "_")
    section_name = chapter_name
    url = django_url('/courses/edx/model_course/Test_Course/courseware/%s/%s' %
                     (chapter_name, section_name))

    world.browser.visit(url)
예제 #14
0
def view_problem(step, problem_type):
    i_am_registered_for_the_course(step, 'model_course')

    # Ensure that the course has this problem type
    add_problem_to_course('model_course', problem_type)

    # Go to the one section in the factory-created course
    # which should be loaded with the correct problem
    chapter_name = TEST_SECTION_NAME.replace(" ", "_")
    section_name = chapter_name
    url = django_url('/courses/edx/model_course/Test_Course/courseware/%s/%s' %
                    (chapter_name, section_name))

    world.browser.visit(url)
예제 #15
0
def view_word_cloud(_step):
    coursenum = 'test_course'
    i_am_registered_for_the_course(_step, coursenum)

    add_word_cloud_to_course(coursenum)
    chapter_name = world.scenario_dict['SECTION'].display_name.replace(
        " ", "_")
    section_name = chapter_name
    url = django_url('/courses/%s/%s/%s/courseware/%s/%s' % (
        world.scenario_dict['COURSE'].org,
        world.scenario_dict['COURSE'].number,
        world.scenario_dict['COURSE'].display_name.replace(' ', '_'),
        chapter_name, section_name,)
    )
    world.browser.visit(url)
예제 #16
0
def view_word_cloud(_step):
    coursenum = 'test_course'
    i_am_registered_for_the_course(_step, coursenum)

    add_word_cloud_to_course(coursenum)
    chapter_name = world.scenario_dict['SECTION'].display_name.replace(
        " ", "_")
    section_name = chapter_name
    url = django_url('/courses/%s/%s/%s/courseware/%s/%s' % (
        world.scenario_dict['COURSE'].org,
        world.scenario_dict['COURSE'].number,
        world.scenario_dict['COURSE'].display_name.replace(' ', '_'),
        chapter_name, section_name,)
    )
    world.browser.visit(url)
예제 #17
0
    def setup_conditional(self, step, condition_type, condition, cond_value):
        r"that a course has a Conditional conditioned on (?P<condition_type>\w+) (?P<condition>\w+)=(?P<cond_value>\w+)$"

        i_am_registered_for_the_course(step, self.COURSE_NUM)

        world.scenario_dict["VERTICAL"] = world.ItemFactory(
            parent_location=world.scenario_dict["SECTION"].location, category="vertical", display_name="Test Vertical"
        )

        world.scenario_dict["WRAPPER"] = world.ItemFactory(
            parent_location=world.scenario_dict["VERTICAL"].location,
            category="wrapper",
            display_name="Test Poll Wrapper",
        )

        if condition_type == "problem":
            world.scenario_dict["CONDITION_SOURCE"] = add_problem_to_course(self.COURSE_NUM, "string")
        elif condition_type == "poll":
            world.scenario_dict["CONDITION_SOURCE"] = world.ItemFactory(
                parent_location=world.scenario_dict["WRAPPER"].location,
                category="poll_question",
                display_name="Conditional Poll",
                data={
                    "question": "Is this a good poll?",
                    "answers": [{"id": "yes", "text": "Yes, of course"}, {"id": "no", "text": "Of course not!"}],
                },
            )
        else:
            raise Exception("Unknown condition type: {!r}".format(condition_type))

        metadata = {"xml_attributes": {condition: cond_value}}

        world.scenario_dict["CONDITIONAL"] = world.ItemFactory(
            parent_location=world.scenario_dict["WRAPPER"].location,
            category="conditional",
            display_name="Test Conditional",
            metadata=metadata,
            sources_list=[world.scenario_dict["CONDITION_SOURCE"].location],
        )

        world.ItemFactory(
            parent_location=world.scenario_dict["CONDITIONAL"].location,
            category="html",
            display_name="Conditional Contents",
            data='<html><div class="hidden-contents">Hidden Contents</p></html>',
        )
예제 #18
0
def view_problem(step, problem_type):
    i_am_registered_for_the_course(step, 'model_course')

    # Ensure that the course has this problem type
    add_problem_to_course('model_course', problem_type)

    # Go to the one section in the factory-created course
    # which should be loaded with the correct problem
    chapter_name = world.scenario_dict['SECTION'].display_name.replace(
        " ", "_")
    section_name = chapter_name
    url = django_url('/courses/%s/%s/%s/courseware/%s/%s' % (
        world.scenario_dict['COURSE'].org,
        world.scenario_dict['COURSE'].number,
        world.scenario_dict['COURSE'].display_name.replace(' ', '_'),
        chapter_name,
        section_name,
    ))
    world.browser.visit(url)
예제 #19
0
def view_videoalpha(step):
    coursenum = "test_course"
    i_am_registered_for_the_course(step, coursenum)

    # Make sure we have a videoalpha
    add_videoalpha_to_course(coursenum)
    chapter_name = world.scenario_dict["SECTION"].display_name.replace(" ", "_")
    section_name = chapter_name
    url = django_url(
        "/courses/%s/%s/%s/courseware/%s/%s"
        % (
            world.scenario_dict["COURSE"].org,
            world.scenario_dict["COURSE"].number,
            world.scenario_dict["COURSE"].display_name.replace(" ", "_"),
            chapter_name,
            section_name,
        )
    )
    world.browser.visit(url)
예제 #20
0
    def define_component(self, step, count):
        r"""that a course has an annotatable component with (?P<count>\d+) annotations$"""

        count = int(count)
        coursenum = 'test_course'
        i_am_registered_for_the_course(step, coursenum)

        world.scenario_dict['ANNOTATION_VERTICAL'] = world.ItemFactory(
            parent_location=world.scenario_dict['SECTION'].location,
            category='vertical',
            display_name="Test Annotation Vertical"
        )

        world.scenario_dict['ANNOTATABLE'] = world.ItemFactory(
            parent_location=world.scenario_dict['ANNOTATION_VERTICAL'].location,
            category='annotatable',
            display_name="Test Annotation Module",
            data=DATA_TEMPLATE.format("\n".join(ANNOTATION_TEMPLATE.format(i) for i in xrange(count)))
        )
        self.annotations_count = count
예제 #21
0
def view_problem_with_show_answer(step, problem_type, answer):
    i_am_registered_for_the_course(step, "model_course")

    # Ensure that the course has this problem type
    add_problem_to_course("model_course", problem_type, {"showanswer": answer})

    # Go to the one section in the factory-created course
    # which should be loaded with the correct problem
    chapter_name = world.scenario_dict["SECTION"].display_name.replace(" ", "_")
    section_name = chapter_name
    url = django_url(
        "/courses/%s/%s/%s/courseware/%s/%s"
        % (
            world.scenario_dict["COURSE"].org,
            world.scenario_dict["COURSE"].number,
            world.scenario_dict["COURSE"].display_name.replace(" ", "_"),
            chapter_name,
            section_name,
        )
    )
    world.browser.visit(url)
예제 #22
0
def view_video(_step, player_mode):
    i_am_registered_for_the_course(_step, coursenum)
    add_video_to_course(coursenum, player_mode.lower(), _step.hashes)
    visit_scenario_item('SECTION')
예제 #23
0
def view_video(_step, player_mode):
    i_am_registered_for_the_course(_step, coursenum)
    data = _step.hashes[0] if _step.hashes else None
    add_video_to_course(coursenum, player_mode=player_mode.lower(), data=data)
    visit_scenario_item('SECTION')
    wait_for_video()
예제 #24
0
def view_word_cloud(_step):
    coursenum = 'test_course'
    i_am_registered_for_the_course(_step, coursenum)

    add_word_cloud_to_course(coursenum)
    visit_scenario_item('SECTION')
예제 #25
0
def view_video(_step, player_mode):
    i_am_registered_for_the_course(_step, coursenum)
    data = _step.hashes[0] if _step.hashes else None
    add_video_to_course(coursenum, player_mode=player_mode.lower(), data=data)
    visit_scenario_item('SECTION')
    wait_for_video()