本文整理汇总了Python中common.test.acceptance.pages.lms.instructor_dashboard.InstructorDashboardPage类的典型用法代码示例。如果您正苦于以下问题:Python InstructorDashboardPage类的具体用法?Python InstructorDashboardPage怎么用?Python InstructorDashboardPage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了InstructorDashboardPage类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_cohorts_and_assign_students
def create_cohorts_and_assign_students(self):
"""
Adds 2 manual cohorts, linked to content groups, to the course.
Each cohort is assigned one student.
"""
instructor_dashboard_page = InstructorDashboardPage(self.browser, self.course_id)
instructor_dashboard_page.visit()
cohort_management_page = instructor_dashboard_page.select_cohort_management()
def add_cohort_with_student(cohort_name, content_group, student):
cohort_management_page.add_cohort(cohort_name, content_group=content_group)
cohort_management_page.add_students_to_selected_cohort([student])
add_cohort_with_student("Cohort A", self.content_group_a, self.cohort_a_student_username)
add_cohort_with_student("Cohort B", self.content_group_b, self.cohort_b_student_username)
示例2: create_cohorts_and_assign_students
def create_cohorts_and_assign_students(self, student_a_username, student_b_username):
"""
Adds 2 manual cohorts, linked to content groups, to the course.
Each cohort is assigned one learner.
"""
instructor_dashboard_page = InstructorDashboardPage(self.browser, self.course_id)
instructor_dashboard_page.visit()
cohort_management_page = instructor_dashboard_page.select_cohort_management()
cohort_management_page.is_cohorted = True
def add_cohort_with_student(cohort_name, content_group, student):
""" Create cohort and assign learner to it. """
cohort_management_page.add_cohort(cohort_name, content_group=content_group)
cohort_management_page.add_students_to_selected_cohort([student])
add_cohort_with_student("Cohort Alpha", "alpha", student_a_username)
add_cohort_with_student("Cohort Beta", "beta", student_b_username)
cohort_management_page.wait_for_ajax()
示例3: create_cohorts_and_assign_students
def create_cohorts_and_assign_students(self):
"""
Adds 2 manual cohorts, linked to content groups, to the course.
Each cohort is assigned one student.
"""
instructor_dashboard_page = InstructorDashboardPage(self.browser, self.course_id)
instructor_dashboard_page.visit()
cohort_management_page = instructor_dashboard_page.select_cohort_management()
def add_cohort_with_student(cohort_name, content_group, student):
cohort_management_page.add_cohort(cohort_name, content_group=content_group)
# After adding the cohort, it should automatically be selected
EmptyPromise(
lambda: cohort_name == cohort_management_page.get_selected_cohort(), "Waiting for new cohort"
).fulfill()
cohort_management_page.add_students_to_selected_cohort([student])
add_cohort_with_student("Cohort A", self.content_group_a, self.cohort_a_student_username)
add_cohort_with_student("Cohort B", self.content_group_b, self.cohort_b_student_username)
示例4: setUp
def setUp(self):
super(TestLTIConusmer, self).setUp()
self.courseware_page = CoursewarePage(self.browser, self.course_id)
self.lti_iframe = LTIContentIframe(self.browser, self.course_id)
self.tab_nav = TabNavPage(self.browser)
self.progress_page = ProgressPage(self.browser, self.course_id)
self.instructor_dashboard_page = InstructorDashboardPage(self.browser, self.course_id)
self.grade_book_page = GradeBookPage(self.browser)
# Install a course
display_name = "Test Course" + self.unique_id
self.course_fix = CourseFixture(
self.course_info['org'], self.course_info['number'],
self.course_info['run'], display_name=display_name
)
示例5: upload_file
def upload_file(self, filename, wait_for_upload_button=True):
"""
Helper method to upload an image file.
"""
if wait_for_upload_button:
self.wait_for_element_visibility('.u-field-upload-button', "upload button is visible")
file_path = InstructorDashboardPage.get_asset_path(filename)
# make the elements visible.
self.browser.execute_script('$(".u-field-upload-button").css("opacity",1);')
self.browser.execute_script('$(".upload-button-input").css("opacity",1);')
self.wait_for_element_visibility('.upload-button-input', "upload button is visible")
self.q(css='.upload-button-input').results[0].send_keys(file_path)
self.wait_for_ajax()
示例6: setUp
def setUp(self):
"""
Set up a discussion topic
"""
super(BaseDividedDiscussionTest, self).setUp()
self.discussion_id = "test_discussion_{}".format(uuid.uuid4().hex)
self.course_fixture = CourseFixture(**self.course_info).add_children(
XBlockFixtureDesc("chapter", "Test Section").add_children(
XBlockFixtureDesc("sequential", "Test Subsection").add_children(
XBlockFixtureDesc("vertical", "Test Unit").add_children(
XBlockFixtureDesc(
"discussion",
"Test Discussion",
metadata={"discussion_id": self.discussion_id}
)
)
)
)
).install()
# create course with single cohort and two content groups (user_partition of type "cohort")
self.cohort_name = "OnlyCohort"
self.setup_cohort_config(self.course_fixture)
self.cohort_id = self.add_manual_cohort(self.course_fixture, self.cohort_name)
# login as an instructor
self.instructor_name = "instructor_user"
self.instructor_id = AutoAuthPage(
self.browser, username=self.instructor_name, email="[email protected]",
course_id=self.course_id, staff=True
).visit().get_user_id()
# go to the membership page on the instructor dashboard
self.instructor_dashboard_page = InstructorDashboardPage(self.browser, self.course_id)
self.instructor_dashboard_page.visit()
self.discussion_management_page = self.instructor_dashboard_page.select_discussion_management()
self.discussion_management_page.wait_for_page()
self.course_wide_key = 'course-wide'
self.inline_key = 'inline'
self.scheme_key = 'scheme'
示例7: setUp
def setUp(self):
"""
Set up a cohorted course
"""
super(CohortConfigurationTest, self).setUp()
# create course with cohorts
self.manual_cohort_name = "ManualCohort1"
self.auto_cohort_name = "AutoCohort1"
self.course_fixture = CourseFixture(**self.course_info).install()
self.setup_cohort_config(self.course_fixture, auto_cohort_groups=[self.auto_cohort_name])
self.manual_cohort_id = self.add_manual_cohort(self.course_fixture, self.manual_cohort_name)
# create a non-instructor who will be registered for the course and in the manual cohort.
self.student_name, self.student_email = self._generate_unique_user_data()
self.student_id = AutoAuthPage(
self.browser, username=self.student_name, email=self.student_email,
course_id=self.course_id, staff=False
).visit().get_user_id()
self.add_user_to_cohort(self.course_fixture, self.student_name, self.manual_cohort_id)
# create a second student user
self.other_student_name, self.other_student_email = self._generate_unique_user_data()
self.other_student_id = AutoAuthPage(
self.browser, username=self.other_student_name, email=self.other_student_email,
course_id=self.course_id, staff=False
).visit().get_user_id()
# login as an instructor
self.instructor_name, self.instructor_email = self._generate_unique_user_data()
self.instructor_id = AutoAuthPage(
self.browser, username=self.instructor_name, email=self.instructor_email,
course_id=self.course_id, staff=True
).visit().get_user_id()
# go to the membership page on the instructor dashboard
self.instructor_dashboard_page = InstructorDashboardPage(self.browser, self.course_id)
self.instructor_dashboard_page.visit()
self.cohort_management_page = self.instructor_dashboard_page.select_cohort_management()
示例8: CohortContentGroupAssociationTest
class CohortContentGroupAssociationTest(UniqueCourseTest, CohortTestMixin):
"""
Tests for linking between content groups and cohort in the instructor dashboard.
"""
def setUp(self):
"""
Set up a cohorted course with a user_partition of scheme "cohort".
"""
super(CohortContentGroupAssociationTest, self).setUp()
# create course with single cohort and two content groups (user_partition of type "cohort")
self.cohort_name = "OnlyCohort"
self.course_fixture = CourseFixture(**self.course_info).install()
self.setup_cohort_config(self.course_fixture)
self.cohort_id = self.add_manual_cohort(self.course_fixture, self.cohort_name)
self.course_fixture._update_xblock(self.course_fixture._course_location, {
"metadata": {
u"user_partitions": [
create_user_partition_json(
0,
'Apples, Bananas',
'Content Group Partition',
[Group("0", 'Apples'), Group("1", 'Bananas')],
scheme="cohort"
)
],
},
})
# login as an instructor
self.instructor_name = "instructor_user"
self.instructor_id = AutoAuthPage(
self.browser, username=self.instructor_name, email="[email protected]",
course_id=self.course_id, staff=True
).visit().get_user_id()
# go to the membership page on the instructor dashboard
self.instructor_dashboard_page = InstructorDashboardPage(self.browser, self.course_id)
self.instructor_dashboard_page.visit()
self.cohort_management_page = self.instructor_dashboard_page.select_cohort_management()
def test_no_content_group_linked(self):
"""
Scenario: In a course with content groups, cohorts are initially not linked to a content group
Given I have a course with a cohort defined and content groups defined
When I view the cohort in the instructor dashboard and select settings
Then the cohort is not linked to a content group
And there is no text stating that content groups are undefined
And the content groups are listed in the selector
"""
self.cohort_management_page.select_cohort(self.cohort_name)
self.assertIsNone(self.cohort_management_page.get_cohort_associated_content_group())
self.assertIsNone(self.cohort_management_page.get_cohort_related_content_group_message())
self.assertEquals(["Apples", "Bananas"], self.cohort_management_page.get_all_content_groups())
def test_link_to_content_group(self):
"""
Scenario: In a course with content groups, cohorts can be linked to content groups
Given I have a course with a cohort defined and content groups defined
When I view the cohort in the instructor dashboard and select settings
And I link the cohort to one of the content groups and save
Then there is a notification that my cohort has been saved
And when I reload the page
And I view the cohort in the instructor dashboard and select settings
Then the cohort is still linked to the content group
"""
self._link_cohort_to_content_group(self.cohort_name, "Bananas")
self.assertEqual("Bananas", self.cohort_management_page.get_cohort_associated_content_group())
def test_unlink_from_content_group(self):
"""
Scenario: In a course with content groups, cohorts can be unlinked from content groups
Given I have a course with a cohort defined and content groups defined
When I view the cohort in the instructor dashboard and select settings
And I link the cohort to one of the content groups and save
Then there is a notification that my cohort has been saved
And I reload the page
And I view the cohort in the instructor dashboard and select settings
And I unlink the cohort from any content group and save
Then there is a notification that my cohort has been saved
And when I reload the page
And I view the cohort in the instructor dashboard and select settings
Then the cohort is not linked to any content group
"""
self._link_cohort_to_content_group(self.cohort_name, "Bananas")
self.cohort_management_page.set_cohort_associated_content_group(None)
self._verify_settings_saved_and_reload(self.cohort_name)
self.assertEqual(None, self.cohort_management_page.get_cohort_associated_content_group())
def test_create_new_cohort_linked_to_content_group(self):
"""
Scenario: In a course with content groups, a new cohort can be linked to a content group
at time of creation.
Given I have a course with a cohort defined and content groups defined
#.........这里部分代码省略.........
示例9: CohortConfigurationTest
class CohortConfigurationTest(EventsTestMixin, UniqueCourseTest, CohortTestMixin):
"""
Tests for cohort management on the LMS Instructor Dashboard
"""
def setUp(self):
"""
Set up a cohorted course
"""
super(CohortConfigurationTest, self).setUp()
# create course with cohorts
self.manual_cohort_name = "ManualCohort1"
self.auto_cohort_name = "AutoCohort1"
self.course_fixture = CourseFixture(**self.course_info).install()
self.setup_cohort_config(self.course_fixture, auto_cohort_groups=[self.auto_cohort_name])
self.manual_cohort_id = self.add_manual_cohort(self.course_fixture, self.manual_cohort_name)
# create a non-instructor who will be registered for the course and in the manual cohort.
self.student_name, self.student_email = self._generate_unique_user_data()
self.student_id = AutoAuthPage(
self.browser, username=self.student_name, email=self.student_email,
course_id=self.course_id, staff=False
).visit().get_user_id()
self.add_user_to_cohort(self.course_fixture, self.student_name, self.manual_cohort_id)
# create a second student user
self.other_student_name, self.other_student_email = self._generate_unique_user_data()
self.other_student_id = AutoAuthPage(
self.browser, username=self.other_student_name, email=self.other_student_email,
course_id=self.course_id, staff=False
).visit().get_user_id()
# login as an instructor
self.instructor_name, self.instructor_email = self._generate_unique_user_data()
self.instructor_id = AutoAuthPage(
self.browser, username=self.instructor_name, email=self.instructor_email,
course_id=self.course_id, staff=True
).visit().get_user_id()
# go to the membership page on the instructor dashboard
self.instructor_dashboard_page = InstructorDashboardPage(self.browser, self.course_id)
self.instructor_dashboard_page.visit()
self.cohort_management_page = self.instructor_dashboard_page.select_cohort_management()
def verify_cohort_description(self, cohort_name, expected_description):
"""
Selects the cohort with the given name and verifies the expected description is presented.
"""
self.cohort_management_page.select_cohort(cohort_name)
self.assertEquals(self.cohort_management_page.get_selected_cohort(), cohort_name)
self.assertIn(expected_description, self.cohort_management_page.get_cohort_group_setup())
def test_cohort_description(self):
"""
Scenario: the cohort configuration management in the instructor dashboard specifies whether
students are automatically or manually assigned to specific cohorts.
Given I have a course with a manual cohort and an automatic cohort defined
When I view the manual cohort in the instructor dashboard
There is text specifying that students are only added to the cohort manually
And when I view the automatic cohort in the instructor dashboard
There is text specifying that students are automatically added to the cohort
"""
self.verify_cohort_description(
self.manual_cohort_name,
'Learners are added to this cohort only when you provide '
'their email addresses or usernames on this page',
)
self.verify_cohort_description(
self.auto_cohort_name,
'Learners are added to this cohort automatically',
)
def test_no_content_groups(self):
"""
Scenario: if the course has no content groups defined (user_partitions of type cohort),
the settings in the cohort management tab reflect this
Given I have a course with a cohort defined but no content groups
When I view the cohort in the instructor dashboard and select settings
Then the cohort is not linked to a content group
And there is text stating that no content groups are defined
And I cannot select the radio button to enable content group association
And there is a link I can select to open Group settings in Studio
"""
self.cohort_management_page.select_cohort(self.manual_cohort_name)
self.assertIsNone(self.cohort_management_page.get_cohort_associated_content_group())
self.assertEqual(
"Warning:\nNo content groups exist. Create a content group",
self.cohort_management_page.get_cohort_related_content_group_message()
)
self.assertFalse(self.cohort_management_page.select_content_group_radio_button())
self.cohort_management_page.select_studio_group_settings()
group_settings_page = GroupConfigurationsPage(
self.browser,
self.course_info['org'],
self.course_info['number'],
self.course_info['run']
)
#.........这里部分代码省略.........
示例10: BaseDividedDiscussionTest
class BaseDividedDiscussionTest(UniqueCourseTest, CohortTestMixin):
"""
Base class for tests related to divided discussions.
"""
def setUp(self):
"""
Set up a discussion topic
"""
super(BaseDividedDiscussionTest, self).setUp()
self.discussion_id = "test_discussion_{}".format(uuid.uuid4().hex)
self.course_fixture = CourseFixture(**self.course_info).add_children(
XBlockFixtureDesc("chapter", "Test Section").add_children(
XBlockFixtureDesc("sequential", "Test Subsection").add_children(
XBlockFixtureDesc("vertical", "Test Unit").add_children(
XBlockFixtureDesc(
"discussion",
"Test Discussion",
metadata={"discussion_id": self.discussion_id}
)
)
)
)
).install()
# create course with single cohort and two content groups (user_partition of type "cohort")
self.cohort_name = "OnlyCohort"
self.setup_cohort_config(self.course_fixture)
self.cohort_id = self.add_manual_cohort(self.course_fixture, self.cohort_name)
# login as an instructor
self.instructor_name = "instructor_user"
self.instructor_id = AutoAuthPage(
self.browser, username=self.instructor_name, email="[email protected]",
course_id=self.course_id, staff=True
).visit().get_user_id()
# go to the membership page on the instructor dashboard
self.instructor_dashboard_page = InstructorDashboardPage(self.browser, self.course_id)
self.instructor_dashboard_page.visit()
self.discussion_management_page = self.instructor_dashboard_page.select_discussion_management()
self.discussion_management_page.wait_for_page()
self.course_wide_key = 'course-wide'
self.inline_key = 'inline'
self.scheme_key = 'scheme'
def check_discussion_topic_visibility(self, visible=True):
"""
Assert that discussion topics are visible with appropriate content.
"""
self.assertEqual(visible, self.discussion_management_page.discussion_topics_visible())
if visible:
self.assertEqual(
"Course-Wide Discussion Topics",
self.discussion_management_page.divided_discussion_heading_is_visible(self.course_wide_key)
)
self.assertTrue(self.discussion_management_page.is_save_button_disabled(self.course_wide_key))
self.assertEqual(
"Content-Specific Discussion Topics",
self.discussion_management_page.divided_discussion_heading_is_visible(self.inline_key)
)
self.assertTrue(self.discussion_management_page.is_save_button_disabled(self.inline_key))
def reload_page(self, topics_visible=True):
"""
Refresh the page, then verify if the discussion topics are visible on the discussion
management instructor dashboard tab.
"""
self.browser.refresh()
self.discussion_management_page.wait_for_page()
self.instructor_dashboard_page.select_discussion_management()
self.discussion_management_page.wait_for_page()
self.check_discussion_topic_visibility(topics_visible)
def verify_save_confirmation_message(self, key):
"""
Verify that the save confirmation message for the specified portion of the page is visible.
"""
confirmation_message = self.discussion_management_page.get_divide_discussions_message(key=key)
self.assertIn("Your changes have been saved.", confirmation_message)
示例11: setUp
def setUp(self, is_staff=True):
super(TestCohortHelp, self).setUp(is_staff=is_staff)
self.enable_cohorting(self.course_fixture)
self.instructor_dashboard_page = InstructorDashboardPage(self.browser, self.course_id)
self.instructor_dashboard_page.visit()
self.cohort_management = self.instructor_dashboard_page.select_cohort_management()
示例12: TestCohortHelp
class TestCohortHelp(ContainerBase):
"""
Tests help links in Cohort page
"""
def setUp(self, is_staff=True):
super(TestCohortHelp, self).setUp(is_staff=is_staff)
self.enable_cohorting(self.course_fixture)
self.instructor_dashboard_page = InstructorDashboardPage(self.browser, self.course_id)
self.instructor_dashboard_page.visit()
self.cohort_management = self.instructor_dashboard_page.select_cohort_management()
def get_url_with_changed_domain(self, url):
"""
Replaces .org with .io in the url
Arguments:
url (str): The url to perform replace operation on.
Returns:
str: The updated url
"""
return url.replace('.org/', '.io/')
def verify_help_link(self, href):
"""
Verifies that help link is correct
Arguments:
href (str): Help url
"""
expected_link = {
'href': href,
'text': 'What does this mean?'
}
actual_link = self.cohort_management.get_cohort_help_element_and_click_help()
assert_link(self, expected_link, actual_link)
assert_opened_help_link_is_correct(self, self.get_url_with_changed_domain(href))
def test_manual_cohort_help(self):
"""
Scenario: Help in 'What does it mean?' is correct when we create cohort manually.
Given that I am at 'Cohort' tab of LMS instructor dashboard
And I check 'Enable Cohorts'
And I add cohort name it, choose Manual for Cohort Assignment Method and
No content group for Associated Content Group and save the cohort
Then you see the UI text "Learners are added to this cohort only when..."
followed by "What does this mean" link.
And I click "What does this mean" link then help link should end with
course_features/cohorts/cohort_config.html#assign-learners-to-cohorts-manually
"""
self.cohort_management.add_cohort('cohort_name')
href = 'http://edx.readthedocs.org/projects/edx-partner-course-staff/en/latest/' \
'course_features/cohorts/cohort_config.html#assign-learners-to-cohorts-manually'
self.verify_help_link(href)
@flaky # TODO fix this, see TNL-5709
def test_automatic_cohort_help(self):
"""
Scenario: Help in 'What does it mean?' is correct when we create cohort automatically.
Given that I am at 'Cohort' tab of LMS instructor dashboard
And I check 'Enable Cohorts'
And I add cohort name it, choose Automatic for Cohort Assignment Method and
No content group for Associated Content Group and save the cohort
Then you see the UI text "Learners are added to this cohort automatically"
followed by "What does this mean" link.
And I click "What does this mean" link then help link should end with
course_features/cohorts/cohorts_overview.html#all-automated-assignment
"""
self.cohort_management.add_cohort('cohort_name', assignment_type='random')
href = 'http://edx.readthedocs.org/projects/edx-partner-course-staff/en/latest/' \
'course_features/cohorts/cohorts_overview.html#all-automated-assignment'
self.verify_help_link(href)
def enable_cohorting(self, course_fixture):
"""
Enables cohorting for the current course.
"""
url = LMS_BASE_URL + "/courses/" + course_fixture._course_key + '/cohorts/settings' # pylint: disable=protected-access
data = json.dumps({'is_cohorted': True})
response = course_fixture.session.patch(url, data=data, headers=course_fixture.headers)
self.assertTrue(response.ok, "Failed to enable cohorts")
示例13: TestLTIConusmer
class TestLTIConusmer(UniqueCourseTest):
"""
Base class for tests of LTI xblock in the LMS.
"""
USERNAME = "STUDENT_TESTER"
EMAIL = "[email protected]"
host = os.environ.get('BOK_CHOY_HOSTNAME', '127.0.0.1')
def setUp(self):
super(TestLTIConusmer, self).setUp()
self.courseware_page = CoursewarePage(self.browser, self.course_id)
self.lti_iframe = LTIContentIframe(self.browser, self.course_id)
self.tab_nav = TabNavPage(self.browser)
self.progress_page = ProgressPage(self.browser, self.course_id)
self.instructor_dashboard_page = InstructorDashboardPage(self.browser, self.course_id)
self.grade_book_page = GradeBookPage(self.browser)
# Install a course
display_name = "Test Course" + self.unique_id
self.course_fix = CourseFixture(
self.course_info['org'], self.course_info['number'],
self.course_info['run'], display_name=display_name
)
def test_lti_no_launch_url_is_not_rendered(self):
"""
Scenario: LTI component in LMS with no launch_url is not rendered
Given the course has correct LTI credentials with registered Instructor
the course has an LTI component with no_launch_url fields:
Then I view the LTI and error is shown
"""
metadata_advance_settings = "correct_lti_id:test_client_key:test_client_secret"
metadata_lti_xblock = {
'launch_url': '',
'open_in_a_new_page': False
}
self.set_advance_settings(metadata_advance_settings)
self.create_lti_xblock(metadata_lti_xblock)
auto_auth(self.browser, self.USERNAME, self.EMAIL, True, self.course_id)
self.courseware_page.visit()
self.assertTrue(self.courseware_page.is_error_message_present())
self.assertFalse(self.courseware_page.is_iframe_present())
self.assertFalse(self.courseware_page.is_launch_url_present())
def test_incorrect_lti_id_is_rendered_incorrectly(self):
"""
Scenario: LTI component in LMS with incorrect lti_id is rendered incorrectly
Given the course has correct LTI credentials with registered Instructor
the course has an LTI component with incorrect_lti_id fields:
Then I view the LTI but incorrect_signature warning is rendered
"""
metadata_advance_settings = "test_lti_id:test_client_key:test_client_secret"
metadata_lti_xblock = {
'lti_id': 'incorrect_lti_id',
'launch_url': 'http://{}:{}/{}'.format(self.host, '8765', 'correct_lti_endpoint'),
'open_in_a_new_page': False
}
self.set_advance_settings(metadata_advance_settings)
self.create_lti_xblock(metadata_lti_xblock)
auto_auth(self.browser, self.USERNAME, self.EMAIL, True, self.course_id)
self.courseware_page.visit()
self.assertTrue(self.courseware_page.is_iframe_present())
self.assertFalse(self.courseware_page.is_launch_url_present())
self.assertFalse(self.courseware_page.is_error_message_present())
self.courseware_page.go_to_lti_container()
self.assertEqual("Wrong LTI signature", self.lti_iframe.lti_content)
def test_incorrect_lti_credentials_is_rendered_incorrectly(self):
"""
Scenario: LTI component in LMS with icorrect LTI credentials is rendered incorrectly
Given the course has incorrect LTI credentials with registered Instructor
the course has an LTI component with correct fields:
I view the LTI but incorrect_signature warning is rendered
"""
metadata_advance_settings = "test_lti_id:test_client_key:incorrect_lti_secret_key"
metadata_lti_xblock = {
'lti_id': 'correct_lti_id',
'launch_url': 'http://{}:{}/{}'.format(self.host, '8765', 'correct_lti_endpoint'),
'open_in_a_new_page': False
}
self.set_advance_settings(metadata_advance_settings)
self.create_lti_xblock(metadata_lti_xblock)
auto_auth(self.browser, self.USERNAME, self.EMAIL, True, self.course_id)
self.courseware_page.visit()
self.assertTrue(self.courseware_page.is_iframe_present())
self.assertFalse(self.courseware_page.is_launch_url_present())
self.assertFalse(self.courseware_page.is_error_message_present())
self.courseware_page.go_to_lti_container()
self.assertEqual("Wrong LTI signature", self.lti_iframe.lti_content)
def test_lti_is_rendered_in_iframe_correctly(self):
"""
Scenario: LTI component in LMS is correctly rendered in iframe
Given the course has correct LTI credentials with registered Instructor
the course has an LTI component with correct fields:
I view the LTI and it is rendered in iframe correctly
"""
metadata_advance_settings = "correct_lti_id:test_client_key:test_client_secret"
metadata_lti_xblock = {
#.........这里部分代码省略.........
示例14: TestCohortHelp
class TestCohortHelp(ContainerBase, CohortTestMixin):
"""
Tests help links in Cohort page
"""
def setUp(self, is_staff=True):
super(TestCohortHelp, self).setUp(is_staff=is_staff)
self.enable_cohorting(self.course_fixture)
self.instructor_dashboard_page = InstructorDashboardPage(self.browser, self.course_id)
self.instructor_dashboard_page.visit()
self.cohort_management = self.instructor_dashboard_page.select_cohort_management()
def verify_help_link(self, href):
"""
Verifies that help link is correct
Arguments:
href (str): Help url
"""
help_element = self.cohort_management.get_cohort_help_element()
self.assertEqual(help_element.text, "What does this mean?")
click_and_wait_for_window(self, help_element)
assert_opened_help_link_is_correct(self, href)
def test_manual_cohort_help(self):
"""
Scenario: Help in 'What does it mean?' is correct when we create cohort manually.
Given that I am at 'Cohort' tab of LMS instructor dashboard
And I check 'Enable Cohorts'
And I add cohort name it, choose Manual for Cohort Assignment Method and
No content group for Associated Content Group and save the cohort
Then you see the UI text "Learners are added to this cohort only when..."
followed by "What does this mean" link.
And I click "What does this mean" link then help link should end with
course_features/cohorts/cohort_config.html#assign-learners-to-cohorts-manually
"""
self.cohort_management.add_cohort('cohort_name')
href = url_for_help(
'course_author',
'/course_features/cohorts/cohort_config.html#assign-learners-to-cohorts-manually',
)
self.verify_help_link(href)
def test_automatic_cohort_help(self):
"""
Scenario: Help in 'What does it mean?' is correct when we create cohort automatically.
Given that I am at 'Cohort' tab of LMS instructor dashboard
And I check 'Enable Cohorts'
And I add cohort name it, choose Automatic for Cohort Assignment Method and
No content group for Associated Content Group and save the cohort
Then you see the UI text "Learners are added to this cohort automatically"
followed by "What does this mean" link.
And I click "What does this mean" link then help link should end with
course_features/cohorts/cohorts_overview.html#all-automated-assignment
"""
self.cohort_management.add_cohort('cohort_name', assignment_type='random')
href = url_for_help(
'course_author',
'/course_features/cohorts/cohorts_overview.html#all-automated-assignment',
)
self.verify_help_link(href)