本文整理汇总了Python中common.test.acceptance.pages.studio.auto_auth.AutoAuthPage类的典型用法代码示例。如果您正苦于以下问题:Python AutoAuthPage类的具体用法?Python AutoAuthPage怎么用?Python AutoAuthPage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AutoAuthPage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: LibraryTabHelpTest
class LibraryTabHelpTest(AcceptanceTest):
"""
Test help links on the library tab present at dashboard.
"""
def setUp(self):
super(LibraryTabHelpTest, self).setUp()
self.auth_page = AutoAuthPage(self.browser, staff=True)
self.dashboard_page = DashboardPage(self.browser)
self.auth_page.visit()
self.dashboard_page.visit()
def test_library_tab_nav_help(self):
"""
Scenario: Help link in navigation bar is working on 'Home'(Courses tab) page.
Given that I am on the 'Home'(Courses tab) page.
And I want help about the process
And I click the 'Help' in the navigation bar
Then Help link should open.
And help url should end with 'getting_started/get_started.html'
"""
self.assertTrue(self.dashboard_page.has_new_library_button)
click_css(self.dashboard_page, '#course-index-tabs .libraries-tab', 0, False)
# The href we want to see in anchor help element.
href = 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/' \
'en/open-release-ficus.master/getting_started/get_started.html'
# Assert that help link is correct.
assert_nav_help_link(
test=self,
page=self.dashboard_page,
href=href
)
示例2: NewProgramHelpTest
class NewProgramHelpTest(ProgramsConfigMixin, AcceptanceTest):
"""
Test help links on a 'New Program' page
"""
def setUp(self):
super(NewProgramHelpTest, self).setUp()
self.auth_page = AutoAuthPage(self.browser, staff=True)
self.program_page = DashboardPageWithPrograms(self.browser)
self.auth_page.visit()
self.set_programs_api_configuration(True)
self.program_page.visit()
def test_program_create_nav_help(self):
"""
Scenario: Help link in navigation bar is working on 'New Program' page
Given that I am on the 'New Program' page
And I want help about the process
And I click the 'Help' in the navigation bar
Then Help link should open.
And help url should end with 'index.html'
"""
self.program_page.click_new_program_button()
href = 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course' \
'/en/open-release-ficus.master/index.html'
# Assert that help link is correct.
assert_nav_help_link(
test=self,
page=self.program_page,
href=href,
)
示例3: NewLibraryHelpTest
class NewLibraryHelpTest(AcceptanceTest):
"""
Test help links while creating a new library
"""
def setUp(self):
super(NewLibraryHelpTest, self).setUp()
self.auth_page = AutoAuthPage(self.browser, staff=True)
self.dashboard_page = DashboardPage(self.browser)
self.auth_page.visit()
self.dashboard_page.visit()
self.assertTrue(self.dashboard_page.has_new_library_button)
self.dashboard_page.click_new_library()
def test_library_create_nav_help(self):
"""
Scenario: Help link in navigation bar is working on 'Create a New Library' page in the dashboard.
Given that I am on the 'Create a New Library' page in the dashboard.
And I want help about the process
And I click the 'Help' in the navigation bar
Then Help link should open.
And help url should end with 'getting_started/get_started.html'
"""
# The href we want to see in anchor help element.
href = (
"http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/"
"en/latest/getting_started/get_started.html"
)
# Assert that help link is correct.
assert_nav_help_link(test=self, page=self.dashboard_page, href=href)
def test_library_create_side_bar_help(self):
"""
Scenario: Help link in sidebar links is working on 'Create a New Library' page in the dashboard.
Given that I am on the 'Create a New Library' page in the dashboard.
And I want help about the process
And I click the 'Getting Started with edX Studio' in the sidebar links
Then Help link should open.
And help url should end with 'getting_started/get_started.html'
"""
# The href we want to see in anchor help element.
href = (
"http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/"
"en/latest/getting_started/get_started.html"
)
# Assert that help link is correct.
assert_side_bar_help_link(
test=self,
page=self.dashboard_page,
href=href,
help_text="Getting Started with edX Studio",
as_list_item=True,
)
示例4: log_in
def log_in(self, user, is_staff=False):
"""
Log in as the user that created the library.
By default the user will not have staff access unless is_staff is passed as True.
"""
auth_page = AutoAuthPage(
self.browser,
staff=is_staff,
username=user.get('username'),
email=user.get('email'),
password=user.get('password')
)
auth_page.visit()
示例5: CreateLibraryTest
class CreateLibraryTest(WebAppTest):
"""
Test that we can create a new content library on the studio home page.
"""
def setUp(self):
"""
Load the helper for the home page (dashboard page)
"""
super(CreateLibraryTest, self).setUp()
self.auth_page = AutoAuthPage(self.browser, staff=True)
self.dashboard_page = DashboardPage(self.browser)
@flaky # TODO: SOL-430
def test_create_library(self):
"""
From the home page:
Click "New Library"
Fill out the form
Submit the form
We should be redirected to the edit view for the library
Return to the home page
The newly created library should now appear in the list of libraries
"""
unique_suffix = uuid4().hex[:4]
name = "New Library Name " + unique_suffix
org = "TestOrgX" + unique_suffix
number = "TESTLIB_" + unique_suffix
self.auth_page.visit()
self.dashboard_page.visit()
self.assertFalse(self.dashboard_page.has_library(name=name, org=org, number=number))
self.assertTrue(self.dashboard_page.has_new_library_button())
self.dashboard_page.click_new_library()
self.assertTrue(self.dashboard_page.is_new_library_form_visible())
self.dashboard_page.fill_new_library_form(name, org, number)
self.assertTrue(self.dashboard_page.is_new_library_form_valid())
self.dashboard_page.submit_new_library_form()
# The next page is the library edit view; make sure it loads:
lib_page = LibraryEditPage(self.browser, LibraryLocator(org, number))
lib_page.wait_for_page()
# Then go back to the home page and make sure the new library is listed there:
self.dashboard_page.visit()
self.assertTrue(self.dashboard_page.has_library(name=name, org=org, number=number))
示例6: setUp
def setUp(self):
"""
Create a unique identifier for the course used in this test.
"""
# Ensure that the superclass sets up
super(XBlockAcidBase, self).setUp()
# Define a unique course identifier
self.course_info = {
"org": "test_org",
"number": "course_" + self.unique_id[:5],
"run": "test_" + self.unique_id,
"display_name": "Test Course " + self.unique_id,
}
self.outline = CourseOutlinePage(
self.browser, self.course_info["org"], self.course_info["number"], self.course_info["run"]
)
self.course_id = "{org}.{number}.{run}".format(**self.course_info)
self.setup_fixtures()
self.auth_page = AutoAuthPage(
self.browser,
staff=False,
username=self.user.get("username"),
email=self.user.get("email"),
password=self.user.get("password"),
)
self.auth_page.visit()
示例7: setUp
def setUp(self):
super(NewProgramHelpTest, self).setUp()
self.auth_page = AutoAuthPage(self.browser, staff=True)
self.program_page = DashboardPageWithPrograms(self.browser)
self.auth_page.visit()
self.set_programs_api_configuration(True)
self.program_page.visit()
示例8: setUp
def setUp(self):
"""
Create a unique identifier for the course used in this test.
"""
# Ensure that the superclass sets up
super(XBlockAcidBase, self).setUp()
# Define a unique course identifier
self.course_info = {
'org': 'test_org',
'number': 'course_' + self.unique_id[:5],
'run': 'test_' + self.unique_id,
'display_name': 'Test Course ' + self.unique_id
}
self.outline = CourseOutlinePage(
self.browser,
self.course_info['org'],
self.course_info['number'],
self.course_info['run']
)
self.course_id = '{org}.{number}.{run}'.format(**self.course_info)
self.setup_fixtures()
self.auth_page = AutoAuthPage(
self.browser,
staff=False,
username=self.user.get('username'),
email=self.user.get('email'),
password=self.user.get('password')
)
self.auth_page.visit()
示例9: setUp
def setUp(self):
super(DashboardProgramsTabTest, self).setUp()
self.stub_programs_api()
self.stub_catalog_api()
self.auth_page = AutoAuthPage(self.browser, staff=True)
self.dashboard_page = DashboardPageWithPrograms(self.browser)
self.auth_page.visit()
示例10: LoggedInPagesTest
class LoggedInPagesTest(WebAppTest):
"""
Verify the pages in Studio that you can get to when logged in and do not have a course yet.
"""
def setUp(self):
super(LoggedInPagesTest, self).setUp()
self.auth_page = AutoAuthPage(self.browser, staff=True)
self.dashboard_page = DashboardPage(self.browser)
self.home_page = HomePage(self.browser)
def test_logged_in_no_courses(self):
"""
Make sure that you can get to the dashboard and home pages without a course.
"""
self.auth_page.visit()
self.dashboard_page.visit()
self.home_page.visit()
示例11: setUp
def setUp(self):
"""
Load the helper for the home page (dashboard page)
"""
super(CreateCourseTest, self).setUp()
self.auth_page = AutoAuthPage(self.browser, staff=True)
self.dashboard_page = DashboardPage(self.browser)
self.course_name = "New Course Name"
self.course_org = "orgX"
self.course_number = str(uuid.uuid4().get_hex().upper()[0:6])
self.course_run = "2015_T2"
示例12: setUp
def setUp(self):
super(DashboardProgramsTabTest, self).setUp()
ProgramsFixture().install_programs([])
self.auth_page = AutoAuthPage(self.browser, staff=True)
self.dashboard_page = DashboardPageWithPrograms(self.browser)
self.auth_page.visit()
示例13: XBlockAcidBase
class XBlockAcidBase(WebAppTest):
"""
Base class for tests that verify that XBlock integration is working correctly
"""
__test__ = False
def setUp(self):
"""
Create a unique identifier for the course used in this test.
"""
# Ensure that the superclass sets up
super(XBlockAcidBase, self).setUp()
# Define a unique course identifier
self.course_info = {
'org': 'test_org',
'number': 'course_' + self.unique_id[:5],
'run': 'test_' + self.unique_id,
'display_name': 'Test Course ' + self.unique_id
}
self.outline = CourseOutlinePage(
self.browser,
self.course_info['org'],
self.course_info['number'],
self.course_info['run']
)
self.course_id = '{org}.{number}.{run}'.format(**self.course_info)
self.setup_fixtures()
self.auth_page = AutoAuthPage(
self.browser,
staff=False,
username=self.user.get('username'),
email=self.user.get('email'),
password=self.user.get('password')
)
self.auth_page.visit()
def validate_acid_block_preview(self, acid_block):
"""
Validate the Acid Block's preview
"""
self.assertTrue(acid_block.init_fn_passed)
self.assertTrue(acid_block.resource_url_passed)
self.assertTrue(acid_block.scope_passed('user_state'))
self.assertTrue(acid_block.scope_passed('user_state_summary'))
self.assertTrue(acid_block.scope_passed('preferences'))
self.assertTrue(acid_block.scope_passed('user_info'))
def test_acid_block_preview(self):
"""
Verify that all expected acid block tests pass in studio preview
"""
self.outline.visit()
subsection = self.outline.section('Test Section').subsection('Test Subsection')
unit = subsection.expand_subsection().unit('Test Unit').go_to()
acid_block = AcidView(self.browser, unit.xblocks[0].preview_selector)
self.validate_acid_block_preview(acid_block)
def test_acid_block_editor(self):
"""
Verify that all expected acid block tests pass in studio editor
"""
self.outline.visit()
subsection = self.outline.section('Test Section').subsection('Test Subsection')
unit = subsection.expand_subsection().unit('Test Unit').go_to()
acid_block = AcidView(self.browser, unit.xblocks[0].edit().editor_selector)
self.assertTrue(acid_block.init_fn_passed)
self.assertTrue(acid_block.resource_url_passed)
示例14: DashboardProgramsTabTest
class DashboardProgramsTabTest(ProgramsConfigMixin, CatalogConfigMixin, AcceptanceTest):
"""
Test the programs tab on the studio home page.
"""
def setUp(self):
super(DashboardProgramsTabTest, self).setUp()
self.stub_programs_api()
self.stub_catalog_api()
self.auth_page = AutoAuthPage(self.browser, staff=True)
self.dashboard_page = DashboardPageWithPrograms(self.browser)
self.auth_page.visit()
def stub_programs_api(self):
"""Stub out the programs API with fake data."""
self.set_programs_api_configuration(is_enabled=True)
ProgramsFixture().install_programs([])
def stub_catalog_api(self):
"""Stub out the catalog API's program endpoint."""
self.set_catalog_configuration(is_enabled=True)
CatalogFixture().install_programs([])
def test_tab_is_disabled(self):
"""
The programs tab and "new program" button should not appear at all
unless enabled via the config model.
"""
self.set_programs_api_configuration()
self.dashboard_page.visit()
self.assertFalse(self.dashboard_page.is_programs_tab_present())
self.assertFalse(self.dashboard_page.is_new_program_button_present())
def test_tab_is_enabled_with_empty_list(self):
"""
The programs tab and "new program" button should appear when enabled
via config. When the programs list is empty, a button should appear
that allows creating a new program.
"""
self.dashboard_page.visit()
self.assertTrue(self.dashboard_page.is_programs_tab_present())
self.assertTrue(self.dashboard_page.is_new_program_button_present())
results = self.dashboard_page.get_program_list()
self.assertEqual(results, [])
self.assertTrue(self.dashboard_page.is_empty_list_create_button_present())
def test_tab_is_enabled_with_nonempty_list(self):
"""
The programs tab and "new program" button should appear when enabled
via config, and the results of the program list should display when
the list is nonempty.
"""
test_program_values = [('first program', 'org1'), ('second program', 'org2')]
programs = [
factories.Program(
name=name,
organizations=[
factories.Organization(key=org),
],
course_codes=[
factories.CourseCode(run_modes=[
factories.RunMode(),
]),
]
)
for name, org in test_program_values
]
ProgramsFixture().install_programs(programs)
self.dashboard_page.visit()
self.assertTrue(self.dashboard_page.is_programs_tab_present())
self.assertTrue(self.dashboard_page.is_new_program_button_present())
self.assertFalse(self.dashboard_page.is_empty_list_create_button_present())
results = self.dashboard_page.get_program_list()
self.assertEqual(results, test_program_values)
def test_tab_requires_staff(self):
"""
The programs tab and "new program" button will not be available, even
when enabled via config, if the user is not global staff.
"""
AutoAuthPage(self.browser, staff=False).visit()
self.dashboard_page.visit()
self.assertFalse(self.dashboard_page.is_programs_tab_present())
self.assertFalse(self.dashboard_page.is_new_program_button_present())
示例15: setUp
def setUp(self):
super(LoggedInPagesTest, self).setUp()
self.auth_page = AutoAuthPage(self.browser, staff=True)
self.dashboard_page = DashboardPage(self.browser)
self.home_page = HomePage(self.browser)