本文整理汇总了Python中common.test.acceptance.pages.lms.dashboard.DashboardPage.is_course_present方法的典型用法代码示例。如果您正苦于以下问题:Python DashboardPage.is_course_present方法的具体用法?Python DashboardPage.is_course_present怎么用?Python DashboardPage.is_course_present使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common.test.acceptance.pages.lms.dashboard.DashboardPage
的用法示例。
在下文中一共展示了DashboardPage.is_course_present方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: RegisterCourseTests
# 需要导入模块: from common.test.acceptance.pages.lms.dashboard import DashboardPage [as 别名]
# 或者: from common.test.acceptance.pages.lms.dashboard.DashboardPage import is_course_present [as 别名]
class RegisterCourseTests(EventsTestMixin, UniqueCourseTest):
"""Test that learner can enroll into a course from courses page"""
TEST_INDEX_FILENAME = "test_root/index_file.dat"
def setUp(self):
"""
Initialize the test.
Create the necessary page objects, create course page and courses to find.
"""
super(RegisterCourseTests, self).setUp()
# create test file in which index for this test will live
with open(self.TEST_INDEX_FILENAME, "w+") as index_file:
json.dump({}, index_file)
self.addCleanup(remove_file, self.TEST_INDEX_FILENAME)
self.course_discovery = CourseDiscoveryPage(self.browser)
self.dashboard_page = DashboardPage(self.browser)
self.course_about = CourseAboutPage(self.browser, self.course_id)
# Create a course
CourseFixture(
self.course_info['org'],
self.course_info['number'],
self.course_info['run'],
self.course_info['display_name'],
settings={'enrollment_start': datetime(1970, 1, 1).isoformat()}
).install()
# Create a user and log them in
AutoAuthPage(self.browser).visit()
def test_register_for_course(self):
"""
Scenario: I can register for a course
Given The course "6.002x" exists
And I am logged in
And I visit the courses page
When I register for the course "6.002x"
Then I should see the course numbered "6.002x" in my dashboard
And a "edx.course.enrollment.activated" server event is emitted
"""
# Navigate to the dashboard
self.course_discovery.visit()
self.course_discovery.click_course(self.course_id)
self.course_about.wait_for_page()
self.course_about.enroll_in_course()
self.dashboard_page.wait_for_page()
self.assertTrue(self.dashboard_page.is_course_present(self.course_id))
self.assert_matching_events_were_emitted(
event_filter={'name': u'edx.course.enrollment.activated', 'event_source': 'server'}
)