本文整理汇总了Python中common.test.acceptance.pages.lms.tab_nav.TabNavPage类的典型用法代码示例。如果您正苦于以下问题:Python TabNavPage类的具体用法?Python TabNavPage怎么用?Python TabNavPage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TabNavPage类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
def setUp(self):
"""
Initialize pages and install a course fixture.
"""
super(CourseWikiA11yTest, self).setUp()
# self.course_info['number'] must be shorter since we are accessing the wiki. See TNL-1751
self.course_info['number'] = self.unique_id[0:6]
self.course_wiki_page = CourseWikiPage(self.browser, self.course_id)
self.course_home_page = CourseHomePage(self.browser, self.course_id)
self.course_wiki_edit_page = CourseWikiEditPage(self.browser, self.course_id, self.course_info)
self.tab_nav = TabNavPage(self.browser)
CourseFixture(
self.course_info['org'], self.course_info['number'],
self.course_info['run'], self.course_info['display_name']
).install()
# Auto-auth register for the course
AutoAuthPage(self.browser, course_id=self.course_id).visit()
# Access course wiki page
self.course_home_page.visit()
self.tab_nav.go_to_tab('Wiki')
示例2: setUp
def setUp(self):
"""
Initialization of pages and course fixture for video tests
"""
super(VideoBaseTest, self).setUp()
self.video = VideoPage(self.browser)
self.tab_nav = TabNavPage(self.browser)
self.course_nav = CourseNavPage(self.browser)
self.courseware = CoursewarePage(self.browser, self.course_id)
self.course_info_page = CourseInfoPage(self.browser, self.course_id)
self.auth_page = AutoAuthPage(self.browser, course_id=self.course_id)
self.course_fixture = CourseFixture(
self.course_info['org'], self.course_info['number'],
self.course_info['run'], self.course_info['display_name']
)
self.metadata = None
self.assets = []
self.contents_of_verticals = None
self.youtube_configuration = {}
self.user_info = {}
# reset youtube stub server
self.addCleanup(YouTubeStubConfig.reset)
示例3: setUp
def setUp(self):
super(CertificateProgressPageTest, self).setUp()
# set same course number as we have in fixture json
self.course_info['number'] = "3355358979513794782079645765720179311111"
test_certificate_config = {
'id': 1,
'name': 'Certificate name',
'description': 'Certificate description',
'course_title': 'Course title override',
'signatories': [],
'version': 1,
'is_active': True
}
course_settings = {'certificates': test_certificate_config}
self.course_fixture = CourseFixture(
self.course_info["org"],
self.course_info["number"],
self.course_info["run"],
self.course_info["display_name"],
settings=course_settings
)
self.course_fixture.add_advanced_settings({
"cert_html_view_enabled": {"value": "true"},
"certificates_show_before_end": {"value": "true"}
})
self.course_fixture.add_update(
CourseUpdateDesc(date='January 29, 2014', content='Test course update1')
)
self.course_fixture.add_children(
XBlockFixtureDesc('static_tab', 'Test Static Tab'),
XBlockFixtureDesc('chapter', 'Test Section').add_children(
XBlockFixtureDesc('sequential', 'Test Subsection', grader_type='Final Exam').add_children(
XBlockFixtureDesc('problem', 'Test Problem 1', data=load_data_str('multiple_choice.xml')),
XBlockFixtureDesc('html', 'Test HTML'),
)
),
XBlockFixtureDesc('chapter', 'Test Section 2').add_children(
XBlockFixtureDesc('sequential', 'Test Subsection 2', grader_type='Midterm Exam').add_children(
XBlockFixtureDesc('problem', 'Test Problem 2', data=load_data_str('formula_problem.xml')),
)
)
)
self.course_fixture.install()
self.user_id = "99" # we have created a user with this id in fixture
self.cert_fixture = CertificateConfigFixture(self.course_id, test_certificate_config)
self.course_info_page = CourseInfoPage(self.browser, self.course_id)
self.progress_page = ProgressPage(self.browser, self.course_id)
self.courseware_page = CoursewarePage(self.browser, self.course_id)
self.course_home_page = CourseHomePage(self.browser, self.course_id)
self.tab_nav = TabNavPage(self.browser)
示例4: setUp
def setUp(self):
super(CertificateProgressPageTest, self).setUp()
# set same course number as we have in fixture json
self.course_info["number"] = "3355358979513794782079645765720179311111"
test_certificate_config = {
"id": 1,
"name": "Certificate name",
"description": "Certificate description",
"course_title": "Course title override",
"signatories": [],
"version": 1,
"is_active": True,
}
course_settings = {"certificates": test_certificate_config}
self.course_fixture = CourseFixture(
self.course_info["org"],
self.course_info["number"],
self.course_info["run"],
self.course_info["display_name"],
settings=course_settings,
)
self.course_fixture.add_advanced_settings({"cert_html_view_enabled": {"value": "true"}})
self.course_fixture.add_update(CourseUpdateDesc(date="January 29, 2014", content="Test course update1"))
self.course_fixture.add_children(
XBlockFixtureDesc("static_tab", "Test Static Tab"),
XBlockFixtureDesc("chapter", "Test Section").add_children(
XBlockFixtureDesc("sequential", "Test Subsection", grader_type="Final Exam").add_children(
XBlockFixtureDesc("problem", "Test Problem 1", data=load_data_str("multiple_choice.xml")),
XBlockFixtureDesc("html", "Test HTML"),
)
),
XBlockFixtureDesc("chapter", "Test Section 2").add_children(
XBlockFixtureDesc("sequential", "Test Subsection 2", grader_type="Midterm Exam").add_children(
XBlockFixtureDesc("problem", "Test Problem 2", data=load_data_str("formula_problem.xml"))
)
),
)
self.course_fixture.install()
self.user_id = "99" # we have created a user with this id in fixture
self.cert_fixture = CertificateConfigFixture(self.course_id, test_certificate_config)
self.course_info_page = CourseInfoPage(self.browser, self.course_id)
self.progress_page = ProgressPage(self.browser, self.course_id)
self.course_nav = CourseNavPage(self.browser)
self.tab_nav = TabNavPage(self.browser)
示例5: PDFTextBooksTabTest
class PDFTextBooksTabTest(UniqueCourseTest):
"""
Tests that verify each of the textbook tabs available within a course.
"""
def setUp(self):
"""
Initialize pages and install a course fixture.
"""
super(PDFTextBooksTabTest, self).setUp()
self.course_home_page = CourseHomePage(self.browser, self.course_id)
self.tab_nav = TabNavPage(self.browser)
# Install a course with TextBooks
course_fix = CourseFixture(
self.course_info['org'], self.course_info['number'],
self.course_info['run'], self.course_info['display_name']
)
# Add PDF textbooks to course fixture.
for i in range(1, 3):
course_fix.add_textbook("PDF Book {}".format(i), [{"title": "Chapter Of Book {}".format(i), "url": ""}])
course_fix.install()
# Auto-auth register for the course
AutoAuthPage(self.browser, course_id=self.course_id).visit()
def test_verify_textbook_tabs(self):
"""
Test multiple pdf textbooks loads correctly in lms.
"""
self.course_home_page.visit()
# Verify each PDF textbook tab by visiting, it will fail if correct tab is not loaded.
for i in range(1, 3):
self.tab_nav.go_to_tab("PDF Book {}".format(i))
示例6: 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
)
示例7: HighLevelTabTest
class HighLevelTabTest(UniqueCourseTest):
"""
Tests that verify each of the high-level tabs available within a course.
"""
def setUp(self):
"""
Initialize pages and install a course fixture.
"""
super(HighLevelTabTest, self).setUp()
# self.course_info['number'] must be shorter since we are accessing the wiki. See TNL-1751
self.course_info['number'] = self.unique_id[0:6]
self.course_home_page = CourseHomePage(self.browser, self.course_id)
self.progress_page = ProgressPage(self.browser, self.course_id)
self.courseware_page = CoursewarePage(self.browser, self.course_id)
self.tab_nav = TabNavPage(self.browser)
self.video = VideoPage(self.browser)
# Install a course with sections/problems, tabs, updates, and handouts
course_fix = CourseFixture(
self.course_info['org'], self.course_info['number'],
self.course_info['run'], self.course_info['display_name']
)
course_fix.add_update(
CourseUpdateDesc(date='January 29, 2014', content='Test course update1')
)
course_fix.add_handout('demoPDF.pdf')
course_fix.add_children(
XBlockFixtureDesc('static_tab', 'Test Static Tab', data=r"static tab data with mathjax \(E=mc^2\)"),
XBlockFixtureDesc('chapter', 'Test Section').add_children(
XBlockFixtureDesc('sequential', 'Test Subsection').add_children(
XBlockFixtureDesc('problem', 'Test Problem 1', data=load_data_str('multiple_choice.xml')),
XBlockFixtureDesc('problem', 'Test Problem 2', data=load_data_str('formula_problem.xml')),
XBlockFixtureDesc('html', 'Test HTML'),
)
),
XBlockFixtureDesc('chapter', 'Test Section 2').add_children(
XBlockFixtureDesc('sequential', 'Test Subsection 2'),
XBlockFixtureDesc('sequential', 'Test Subsection 3').add_children(
XBlockFixtureDesc('problem', 'Test Problem A', data=load_data_str('multiple_choice.xml'))
),
)
).install()
# Auto-auth register for the course
AutoAuthPage(self.browser, course_id=self.course_id).visit()
def test_progress(self):
"""
Navigate to the progress page.
"""
# Navigate to the progress page from the info page
self.course_home_page.visit()
self.tab_nav.go_to_tab('Progress')
# We haven't answered any problems yet, so assume scores are zero
# Only problems should have scores; so there should be 2 scores.
CHAPTER = 'Test Section'
SECTION = 'Test Subsection'
EXPECTED_SCORES = [(0, 3), (0, 1)]
actual_scores = self.progress_page.scores(CHAPTER, SECTION)
self.assertEqual(actual_scores, EXPECTED_SCORES)
def test_static_tab(self):
"""
Navigate to a static tab (course content)
"""
# From the course info page, navigate to the static tab
self.course_home_page.visit()
self.tab_nav.go_to_tab('Test Static Tab')
self.assertTrue(self.tab_nav.is_on_tab('Test Static Tab'))
def test_static_tab_with_mathjax(self):
"""
Navigate to a static tab (course content)
"""
# From the course info page, navigate to the static tab
self.course_home_page.visit()
self.tab_nav.go_to_tab('Test Static Tab')
self.assertTrue(self.tab_nav.is_on_tab('Test Static Tab'))
# Verify that Mathjax has rendered
self.tab_nav.mathjax_has_rendered()
def test_wiki_tab_first_time(self):
"""
Navigate to the course wiki tab. When the wiki is accessed for
the first time, it is created on the fly.
"""
course_wiki = CourseWikiPage(self.browser, self.course_id)
# From the course info page, navigate to the wiki tab
self.course_home_page.visit()
self.tab_nav.go_to_tab('Wiki')
#.........这里部分代码省略.........
示例8: CourseWikiA11yTest
class CourseWikiA11yTest(UniqueCourseTest):
"""
Tests that verify the course wiki.
"""
def setUp(self):
"""
Initialize pages and install a course fixture.
"""
super(CourseWikiA11yTest, self).setUp()
# self.course_info['number'] must be shorter since we are accessing the wiki. See TNL-1751
self.course_info['number'] = self.unique_id[0:6]
self.course_wiki_page = CourseWikiPage(self.browser, self.course_id)
self.course_home_page = CourseHomePage(self.browser, self.course_id)
self.course_wiki_edit_page = CourseWikiEditPage(self.browser, self.course_id, self.course_info)
self.tab_nav = TabNavPage(self.browser)
CourseFixture(
self.course_info['org'], self.course_info['number'],
self.course_info['run'], self.course_info['display_name']
).install()
# Auto-auth register for the course
AutoAuthPage(self.browser, course_id=self.course_id).visit()
# Access course wiki page
self.course_home_page.visit()
self.tab_nav.go_to_tab('Wiki')
def _open_editor(self):
self.course_wiki_page.open_editor()
self.course_wiki_edit_page.wait_for_page()
def test_view(self):
"""
Verify the basic accessibility of the wiki page as initially displayed.
"""
self.course_wiki_page.a11y_audit.check_for_accessibility_errors()
def test_edit(self):
"""
Verify the basic accessibility of edit wiki page.
"""
self._open_editor()
self.course_wiki_edit_page.a11y_audit.check_for_accessibility_errors()
def test_changes(self):
"""
Verify the basic accessibility of changes wiki page.
"""
self.course_wiki_page.show_history()
history_page = CourseWikiHistoryPage(self.browser, self.course_id, self.course_info)
history_page.wait_for_page()
history_page.a11y_audit.check_for_accessibility_errors()
def test_children(self):
"""
Verify the basic accessibility of changes wiki page.
"""
self.course_wiki_page.show_children()
children_page = CourseWikiChildrenPage(self.browser, self.course_id, self.course_info)
children_page.wait_for_page()
children_page.a11y_audit.check_for_accessibility_errors()
示例9: VideoBaseTest
class VideoBaseTest(UniqueCourseTest):
"""
Base class for tests of the Video Player
Sets up the course and provides helper functions for the Video tests.
"""
def setUp(self):
"""
Initialization of pages and course fixture for video tests
"""
super(VideoBaseTest, self).setUp()
self.video = VideoPage(self.browser)
self.tab_nav = TabNavPage(self.browser)
self.course_nav = CourseNavPage(self.browser)
self.courseware = CoursewarePage(self.browser, self.course_id)
self.course_info_page = CourseInfoPage(self.browser, self.course_id)
self.auth_page = AutoAuthPage(self.browser, course_id=self.course_id)
self.course_fixture = CourseFixture(
self.course_info['org'], self.course_info['number'],
self.course_info['run'], self.course_info['display_name']
)
self.metadata = None
self.assets = []
self.contents_of_verticals = None
self.youtube_configuration = {}
self.user_info = {}
# reset youtube stub server
self.addCleanup(YouTubeStubConfig.reset)
def navigate_to_video(self):
""" Prepare the course and get to the video and render it """
self._install_course_fixture()
self._navigate_to_courseware_video_and_render()
def navigate_to_video_no_render(self):
"""
Prepare the course and get to the video unit
however do not wait for it to render, because
the has been an error.
"""
self._install_course_fixture()
self._navigate_to_courseware_video_no_render()
def _install_course_fixture(self):
""" Install the course fixture that has been defined """
if self.assets:
self.course_fixture.add_asset(self.assets)
chapter_sequential = XBlockFixtureDesc('sequential', 'Test Section')
chapter_sequential.add_children(*self._add_course_verticals())
chapter = XBlockFixtureDesc('chapter', 'Test Chapter').add_children(chapter_sequential)
self.course_fixture.add_children(chapter)
self.course_fixture.install()
if len(self.youtube_configuration) > 0:
YouTubeStubConfig.configure(self.youtube_configuration)
def _add_course_verticals(self):
"""
Create XBlockFixtureDesc verticals
:return: a list of XBlockFixtureDesc
"""
xblock_verticals = []
_contents_of_verticals = self.contents_of_verticals
# Video tests require at least one vertical with a single video.
if not _contents_of_verticals:
_contents_of_verticals = [[{'display_name': 'Video', 'metadata': self.metadata}]]
for vertical_index, vertical in enumerate(_contents_of_verticals):
xblock_verticals.append(self._create_single_vertical(vertical, vertical_index))
return xblock_verticals
def _create_single_vertical(self, vertical_contents, vertical_index):
"""
Create a single course vertical of type XBlockFixtureDesc with category `vertical`.
A single course vertical can contain single or multiple video modules.
:param vertical_contents: a list of items for the vertical to contain
:param vertical_index: index for the vertical display name
:return: XBlockFixtureDesc
"""
xblock_course_vertical = XBlockFixtureDesc('vertical', 'Test Vertical-{0}'.format(vertical_index))
for video in vertical_contents:
xblock_course_vertical.add_children(
XBlockFixtureDesc('video', video['display_name'], metadata=video.get('metadata')))
return xblock_course_vertical
def _navigate_to_courseware_video(self):
""" Register for the course and navigate to the video unit """
self.auth_page.visit()
self.user_info = self.auth_page.user_info
self.course_info_page.visit()
self.tab_nav.go_to_tab('Course')
#.........这里部分代码省略.........
示例10: CertificateProgressPageTest
class CertificateProgressPageTest(UniqueCourseTest):
"""
Tests for verifying Certificate info on Progress tab of course page.
"""
def setUp(self):
super(CertificateProgressPageTest, self).setUp()
# set same course number as we have in fixture json
self.course_info["number"] = "3355358979513794782079645765720179311111"
test_certificate_config = {
"id": 1,
"name": "Certificate name",
"description": "Certificate description",
"course_title": "Course title override",
"signatories": [],
"version": 1,
"is_active": True,
}
course_settings = {"certificates": test_certificate_config}
self.course_fixture = CourseFixture(
self.course_info["org"],
self.course_info["number"],
self.course_info["run"],
self.course_info["display_name"],
settings=course_settings,
)
self.course_fixture.add_advanced_settings({"cert_html_view_enabled": {"value": "true"}})
self.course_fixture.add_update(CourseUpdateDesc(date="January 29, 2014", content="Test course update1"))
self.course_fixture.add_children(
XBlockFixtureDesc("static_tab", "Test Static Tab"),
XBlockFixtureDesc("chapter", "Test Section").add_children(
XBlockFixtureDesc("sequential", "Test Subsection", grader_type="Final Exam").add_children(
XBlockFixtureDesc("problem", "Test Problem 1", data=load_data_str("multiple_choice.xml")),
XBlockFixtureDesc("html", "Test HTML"),
)
),
XBlockFixtureDesc("chapter", "Test Section 2").add_children(
XBlockFixtureDesc("sequential", "Test Subsection 2", grader_type="Midterm Exam").add_children(
XBlockFixtureDesc("problem", "Test Problem 2", data=load_data_str("formula_problem.xml"))
)
),
)
self.course_fixture.install()
self.user_id = "99" # we have created a user with this id in fixture
self.cert_fixture = CertificateConfigFixture(self.course_id, test_certificate_config)
self.course_info_page = CourseInfoPage(self.browser, self.course_id)
self.progress_page = ProgressPage(self.browser, self.course_id)
self.course_nav = CourseNavPage(self.browser)
self.tab_nav = TabNavPage(self.browser)
def log_in_as_unique_user(self):
"""
Log in as a valid lms user.
"""
AutoAuthPage(
self.browser,
username="testprogress",
email="[email protected]",
password="testuser",
course_id=self.course_id,
).visit()
def test_progress_page_has_view_certificate_button(self):
"""
Scenario: View Certificate option should be present on Course Progress menu if the user is
awarded a certificate.
And their should be no padding around the box containing certificate info. (See SOL-1196 for details on this)
As a Student
Given there is a course with certificate configuration
And I have passed the course and certificate is generated
When I go on the Progress tab for the course
Then I should see a 'View Certificate' button
And their should be no padding around Certificate info box.
"""
self.cert_fixture.install()
self.log_in_as_unique_user()
self.complete_course_problems()
self.course_info_page.visit()
self.tab_nav.go_to_tab("Progress")
self.assertTrue(self.progress_page.q(css=".auto-cert-message").first.visible)
actual_padding = get_element_padding(self.progress_page, ".wrapper-msg.wrapper-auto-cert")
actual_padding = [int(padding) for padding in actual_padding.itervalues()]
expected_padding = [0, 0, 0, 0]
# Verify that their is no padding around the box containing certificate info.
self.assertEqual(actual_padding, expected_padding)
#.........这里部分代码省略.........
示例11: 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 = {
#.........这里部分代码省略.........
示例12: CertificateProgressPageTest
class CertificateProgressPageTest(UniqueCourseTest):
"""
Tests for verifying Certificate info on Progress tab of course page.
"""
def setUp(self):
super(CertificateProgressPageTest, self).setUp()
# set same course number as we have in fixture json
self.course_info['number'] = "3355358979513794782079645765720179311111"
test_certificate_config = {
'id': 1,
'name': 'Certificate name',
'description': 'Certificate description',
'course_title': 'Course title override',
'signatories': [],
'version': 1,
'is_active': True
}
course_settings = {'certificates': test_certificate_config}
self.course_fixture = CourseFixture(
self.course_info["org"],
self.course_info["number"],
self.course_info["run"],
self.course_info["display_name"],
settings=course_settings
)
self.course_fixture.add_advanced_settings({
"cert_html_view_enabled": {"value": "true"},
"certificates_show_before_end": {"value": "true"}
})
self.course_fixture.add_update(
CourseUpdateDesc(date='January 29, 2014', content='Test course update1')
)
self.course_fixture.add_children(
XBlockFixtureDesc('static_tab', 'Test Static Tab'),
XBlockFixtureDesc('chapter', 'Test Section').add_children(
XBlockFixtureDesc('sequential', 'Test Subsection', grader_type='Final Exam').add_children(
XBlockFixtureDesc('problem', 'Test Problem 1', data=load_data_str('multiple_choice.xml')),
XBlockFixtureDesc('html', 'Test HTML'),
)
),
XBlockFixtureDesc('chapter', 'Test Section 2').add_children(
XBlockFixtureDesc('sequential', 'Test Subsection 2', grader_type='Midterm Exam').add_children(
XBlockFixtureDesc('problem', 'Test Problem 2', data=load_data_str('formula_problem.xml')),
)
)
)
self.course_fixture.install()
self.user_id = "99" # we have created a user with this id in fixture
self.cert_fixture = CertificateConfigFixture(self.course_id, test_certificate_config)
self.progress_page = ProgressPage(self.browser, self.course_id)
self.courseware_page = CoursewarePage(self.browser, self.course_id)
self.course_home_page = CourseHomePage(self.browser, self.course_id)
self.tab_nav = TabNavPage(self.browser)
def log_in_as_unique_user(self):
"""
Log in as a valid lms user.
"""
AutoAuthPage(
self.browser,
username="testprogress",
email="[email protected]",
password="testuser",
course_id=self.course_id
).visit()
def test_progress_page_has_view_certificate_button(self):
"""
Scenario: View Certificate option should be present on Course Progress menu if the user is
awarded a certificate.
And there should be no padding around the box containing certificate info. (See SOL-1196 for details on this)
As a Student
Given there is a course with certificate configuration
And I have passed the course and certificate is generated
When I go on the Progress tab for the course
Then I should see a 'View Certificate' button
And their should be no padding around Certificate info box.
"""
self.cert_fixture.install()
self.log_in_as_unique_user()
self.complete_course_problems()
self.course_home_page.visit()
self.tab_nav.go_to_tab('Progress')
self.assertTrue(self.progress_page.q(css='.auto-cert-message').first.visible)
actual_padding = get_element_padding(self.progress_page, '.wrapper-msg.wrapper-auto-cert')
actual_padding = [int(padding) for padding in actual_padding.itervalues()]
#.........这里部分代码省略.........