本文整理汇总了Python中common.test.acceptance.pages.lms.instructor_dashboard.InstructorDashboardPage.select_cohort_management方法的典型用法代码示例。如果您正苦于以下问题:Python InstructorDashboardPage.select_cohort_management方法的具体用法?Python InstructorDashboardPage.select_cohort_management怎么用?Python InstructorDashboardPage.select_cohort_management使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common.test.acceptance.pages.lms.instructor_dashboard.InstructorDashboardPage
的用法示例。
在下文中一共展示了InstructorDashboardPage.select_cohort_management方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_cohorts_and_assign_students
# 需要导入模块: from common.test.acceptance.pages.lms.instructor_dashboard import InstructorDashboardPage [as 别名]
# 或者: from common.test.acceptance.pages.lms.instructor_dashboard.InstructorDashboardPage import select_cohort_management [as 别名]
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
# 需要导入模块: from common.test.acceptance.pages.lms.instructor_dashboard import InstructorDashboardPage [as 别名]
# 或者: from common.test.acceptance.pages.lms.instructor_dashboard.InstructorDashboardPage import select_cohort_management [as 别名]
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
# 需要导入模块: from common.test.acceptance.pages.lms.instructor_dashboard import InstructorDashboardPage [as 别名]
# 或者: from common.test.acceptance.pages.lms.instructor_dashboard.InstructorDashboardPage import select_cohort_management [as 别名]
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: CohortContentGroupAssociationTest
# 需要导入模块: from common.test.acceptance.pages.lms.instructor_dashboard import InstructorDashboardPage [as 别名]
# 或者: from common.test.acceptance.pages.lms.instructor_dashboard.InstructorDashboardPage import select_cohort_management [as 别名]
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
#.........这里部分代码省略.........
示例5: CohortConfigurationTest
# 需要导入模块: from common.test.acceptance.pages.lms.instructor_dashboard import InstructorDashboardPage [as 别名]
# 或者: from common.test.acceptance.pages.lms.instructor_dashboard.InstructorDashboardPage import select_cohort_management [as 别名]
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']
)
#.........这里部分代码省略.........
示例6: TestCohortHelp
# 需要导入模块: from common.test.acceptance.pages.lms.instructor_dashboard import InstructorDashboardPage [as 别名]
# 或者: from common.test.acceptance.pages.lms.instructor_dashboard.InstructorDashboardPage import select_cohort_management [as 别名]
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")
示例7: TestCohortHelp
# 需要导入模块: from common.test.acceptance.pages.lms.instructor_dashboard import InstructorDashboardPage [as 别名]
# 或者: from common.test.acceptance.pages.lms.instructor_dashboard.InstructorDashboardPage import select_cohort_management [as 别名]
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)