Skip to content
Snippets Groups Projects
Commit 642e3b8b authored by aarif's avatar aarif Committed by root
Browse files

ran python-modernize and isort on files mentioned in INCR-422

changes made to comply with quality
parent c89ecb38
No related branches found
No related tags found
No related merge requests found
......@@ -2,20 +2,28 @@
The Files and Uploads page for a course in Studio
"""
from __future__ import absolute_import
import os
import urllib
from path import Path
import six
import six.moves.urllib.error # pylint: disable=import-error
import six.moves.urllib.parse # pylint: disable=import-error
import six.moves.urllib.request # pylint: disable=import-error
from bok_choy.javascript import wait_for_js
from bok_choy.promise import EmptyPromise
from opaque_keys.edx.locator import CourseLocator
from path import Path
from six.moves import zip
from common.test.acceptance.pages.common.utils import sync_on_notification
from common.test.acceptance.pages.studio import BASE_URL
from common.test.acceptance.pages.studio.course_page import CoursePage
# file path found from CourseFixture logic
UPLOAD_SUFFIX = '/data/uploads/studio-uploads/'
UPLOAD_FILE_DIR = Path(__file__).abspath().dirname().dirname().dirname().dirname() + UPLOAD_SUFFIX # pylint: disable=no-value-for-parameter
# pylint: disable=no-value-for-parameter
UPLOAD_FILE_DIR = Path(__file__).abspath().dirname().dirname().dirname().dirname() + UPLOAD_SUFFIX
class AssetIndexPageStudioFrontend(CoursePage):
......@@ -37,7 +45,7 @@ class AssetIndexPageStudioFrontend(CoursePage):
self.course_info['course_run'],
deprecated=(default_store == 'draft')
)
url = "/".join([BASE_URL, self.URL_PATH, urllib.quote_plus(unicode(course_key))])
url = "/".join([BASE_URL, self.URL_PATH, six.moves.urllib.parse.quote_plus(six.text_type(course_key))])
return url if url[-1] == '/' else url + '/'
@wait_for_js
......@@ -221,7 +229,7 @@ class AssetIndexPageStudioFrontend(CoursePage):
if name not in names:
raise LookupError(u'Asset with filename {} not found.'.format(name))
delete_buttons = self.asset_delete_buttons
assets = dict(zip(names, delete_buttons))
assets = dict(list(zip(names, delete_buttons)))
# Now click the link in that row
assets.get(name).click()
self.confirm_asset_deletion()
......@@ -249,7 +257,7 @@ class AssetIndexPageStudioFrontend(CoursePage):
# Make file input field visible.
self.browser.execute_script('$("{}").css("display","block");'.format(file_input_css))
self.wait_for_element_visibility(file_input_css, "Input is visible")
#Send file to upload
# Send file to upload
self.q(css=file_input_css).results[0].send_keys(
UPLOAD_FILE_DIR + file_name)
self.q(css=file_input_css).results[0].clear()
......
......@@ -2,6 +2,8 @@
Course rerun page in Studio
"""
from __future__ import absolute_import
from common.test.acceptance.pages.studio.course_page import CoursePage
from common.test.acceptance.pages.studio.utils import set_input_value
......
"""
Studio Index, home and dashboard pages. These are the starting pages for users.
"""
from __future__ import absolute_import
from bok_choy.page_object import PageObject
from selenium.webdriver import ActionChains
from selenium.webdriver.common.keys import Keys
......
"""
Library edit page in Studio
"""
from __future__ import absolute_import
import six
from bok_choy.javascript import js_defined, wait_for_js
from bok_choy.page_object import PageObject
from bok_choy.promise import EmptyPromise
......@@ -9,11 +12,11 @@ from selenium.webdriver.support.select import Select
from common.test.acceptance.pages.common.utils import confirm_prompt, sync_on_notification
from common.test.acceptance.pages.studio import BASE_URL
from common.test.acceptance.pages.studio.xblock_editor import XBlockEditorView
from common.test.acceptance.pages.studio.container import XBlockWrapper
from common.test.acceptance.pages.studio.pagination import PaginatedMixin
from common.test.acceptance.pages.studio.users import UsersPageMixin
from common.test.acceptance.pages.studio.utils import HelpMixin
from common.test.acceptance.pages.studio.xblock_editor import XBlockEditorView
class LibraryPage(PageObject, HelpMixin):
......@@ -29,7 +32,7 @@ class LibraryPage(PageObject, HelpMixin):
"""
URL to the library edit page for the given library.
"""
return "{}/library/{}".format(BASE_URL, unicode(self.locator))
return "{}/library/{}".format(BASE_URL, six.text_type(self.locator))
def is_browser_on_page(self):
"""
......
"""
Login page for Studio.
"""
from __future__ import absolute_import
from bok_choy.page_object import PageObject
from bok_choy.promise import EmptyPromise
......
"""
Mixin to include for Paginated container pages
"""
from __future__ import absolute_import
from selenium.webdriver.common.keys import Keys
......
......@@ -8,10 +8,13 @@ The methods in these classes are organized into several conceptual buckets:
* Workflows: Complex orchestrations involving any/all of the above
"""
from __future__ import absolute_import
import os
from bok_choy.promise import EmptyPromise
from selenium.webdriver import ActionChains
from six.moves import range
from common.test.acceptance.pages.studio.course_page import CoursePage
from common.test.acceptance.tests.helpers import disable_animations
......@@ -86,7 +89,7 @@ class CertificatesPage(CoursePage):
Return list of the certificates for the course.
"""
css = self.certficate_css + ' .wrapper-collection'
return [CertificateSectionPage(self, self.certficate_css, index) for index in xrange(len(self.q(css=css)))]
return [CertificateSectionPage(self, self.certficate_css, index) for index in range(len(self.q(css=css)))]
@property
def no_certificates_message_shown(self):
......@@ -314,7 +317,7 @@ class CertificateSectionPage(CertificatesPage):
Return list of the signatories for the certificate.
"""
css = self.selector + ' .signatory-' + self.mode
return [SignatorySectionPage(self, self.selector, self.mode, index) for index in xrange(len(self.q(css=css)))]
return [SignatorySectionPage(self, self.selector, self.mode, index) for index in range(len(self.q(css=css)))]
################
# Wait Actions
......
"""
Course Grading Settings page.
"""
from common.test.acceptance.pages.studio.settings import SettingsPage
from common.test.acceptance.pages.studio.utils import press_the_notification_button
from common.test.acceptance.pages.common.utils import click_css
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys
from __future__ import absolute_import
from bok_choy.javascript import requirejs
from bok_choy.promise import BrokenPromise
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys
from six.moves import range
from common.test.acceptance.pages.common.utils import click_css
from common.test.acceptance.pages.studio.settings import SettingsPage
from common.test.acceptance.pages.studio.utils import press_the_notification_button
@requirejs('js/factories/settings_graders')
......@@ -127,7 +131,7 @@ class GradingPage(SettingsPage):
"""
weight_id = '#course-grading-assignment-gradeweight'
f = self.q(css=weight_id).results[-1]
for __ in xrange(len(assignment_name)):
for __ in range(len(assignment_name)):
f.send_keys(Keys.END, Keys.BACK_SPACE)
f.send_keys(weight)
......
"""
Course Group Configurations page.
"""
from __future__ import absolute_import
from six.moves import range
from common.test.acceptance.pages.common.utils import confirm_prompt
from common.test.acceptance.pages.studio.course_page import CoursePage
......@@ -42,7 +46,7 @@ class GroupConfigurationsPage(CoursePage):
Return list of the group-configurations-list-item's of specified type for the course.
"""
css = prefix + ' .wrapper-collection'
return [GroupConfiguration(self, prefix, index) for index in xrange(len(self.q(css=css)))]
return [GroupConfiguration(self, prefix, index) for index in range(len(self.q(css=css)))]
def create_experiment_group_configuration(self):
"""
......
......@@ -2,6 +2,8 @@
Course Textbooks page.
"""
from __future__ import absolute_import
import requests
from path import Path as path
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment