Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
b9d79aea
Commit
b9d79aea
authored
Jun 20, 2013
by
JonahStanley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A bunch of pylint fixes and explicit use case for uploads/test
parent
0524ff53
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
44 additions
and
44 deletions
+44
-44
cms/djangoapps/contentstore/features/common.py
+13
-12
cms/djangoapps/contentstore/features/course-team.py
+8
-8
cms/djangoapps/contentstore/features/course-updates.py
+9
-9
cms/djangoapps/contentstore/features/static-pages.py
+5
-5
cms/djangoapps/contentstore/features/upload.py
+8
-8
common/test/data/uploads/test
+1
-2
No files found.
cms/djangoapps/contentstore/features/common.py
View file @
b9d79aea
...
...
@@ -3,7 +3,6 @@
from
lettuce
import
world
,
step
from
nose.tools
import
assert_true
from
nose.tools
import
assert_equal
from
auth.authz
import
get_user_by_email
...
...
@@ -13,12 +12,13 @@ import time
from
logging
import
getLogger
logger
=
getLogger
(
__name__
)
COURSE_NAME
=
'Robot Super Course'
COURSE_NUM
=
'999'
COURSE_ORG
=
'MITx'
_
COURSE_NAME
=
'Robot Super Course'
_
COURSE_NUM
=
'999'
_
COURSE_ORG
=
'MITx'
########### STEP HELPERS ##############
@step
(
'I (?:visit|access|open) the Studio homepage$'
)
def
i_visit_the_studio_homepage
(
_step
):
# To make this go to port 8001, put
...
...
@@ -78,10 +78,11 @@ def create_studio_user(
registration
.
register
(
studio_user
)
registration
.
activate
()
def
fill_in_course_info
(
name
=
COURSE_NAME
,
org
=
COURSE_ORG
,
num
=
COURSE_NUM
):
name
=
_
COURSE_NAME
,
org
=
_
COURSE_ORG
,
num
=
_
COURSE_NUM
):
world
.
css_fill
(
'.new-course-name'
,
name
)
world
.
css_fill
(
'.new-course-org'
,
org
)
world
.
css_fill
(
'.new-course-number'
,
num
)
...
...
@@ -108,14 +109,14 @@ def log_into_studio(
def
create_a_course
():
c
=
world
.
CourseFactory
.
create
(
org
=
COURSE_ORG
,
course
=
COURSE_NUM
,
display_name
=
COURSE_NAME
)
world
.
CourseFactory
.
create
(
org
=
_COURSE_ORG
,
course
=
_COURSE_NUM
,
display_name
=
_
COURSE_NAME
)
# Add the user to the instructor group of the course
# so they will have the permissions to see it in studio
g
=
world
.
GroupFactory
.
create
(
name
=
'instructor_MITx/{course_num}/{course_name}'
.
format
(
course_num
=
COURSE_NUM
,
course_name
=
COURSE_NAME
.
replace
(
" "
,
"_"
)))
u
=
get_user_by_email
(
'robot+studio@edx.org'
)
u
.
groups
.
add
(
g
)
u
.
save
()
course
=
world
.
GroupFactory
.
create
(
name
=
'instructor_MITx/{course_num}/{course_name}'
.
format
(
course_num
=
_COURSE_NUM
,
course_name
=
_
COURSE_NAME
.
replace
(
" "
,
"_"
)))
u
ser
=
get_user_by_email
(
'robot+studio@edx.org'
)
u
ser
.
groups
.
add
(
course
)
u
ser
.
save
()
world
.
browser
.
reload
()
course_link_css
=
'span.class-name'
...
...
cms/djangoapps/contentstore/features/course-team.py
View file @
b9d79aea
...
...
@@ -9,19 +9,19 @@ EMAIL_EXTENSION = '@edx.org'
@step
(
u'I am viewing the course team settings'
)
def
view_grading_settings
(
step
):
def
view_grading_settings
(
_
step
):
world
.
click_course_settings
()
link_css
=
'li.nav-course-settings-team a'
world
.
css_click
(
link_css
)
@step
(
u'The user "([^"]*)" exists$'
)
def
create_other_user
(
step
,
name
):
def
create_other_user
(
_
step
,
name
):
create_studio_user
(
uname
=
name
,
password
=
PASSWORD
,
email
=
(
name
+
EMAIL_EXTENSION
))
@step
(
u'I add "([^"]*)" to the course team'
)
def
add_other_user
(
step
,
name
):
def
add_other_user
(
_
step
,
name
):
new_user_css
=
'a.new-user-button'
world
.
css_click
(
new_user_css
)
...
...
@@ -34,18 +34,18 @@ def add_other_user(step, name):
@step
(
u'I delete "([^"]*)" from the course team'
)
def
delete_other_user
(
step
,
name
):
def
delete_other_user
(
_
step
,
name
):
to_delete_css
=
'.remove-user[data-id="{name}{extension}"]'
.
format
(
name
=
name
,
extension
=
EMAIL_EXTENSION
)
world
.
css_click
(
to_delete_css
)
@step
(
u'"([^"]*)" logs in$'
)
def
other_user_login
(
step
,
name
):
def
other_user_login
(
_
step
,
name
):
log_into_studio
(
uname
=
name
,
password
=
PASSWORD
,
email
=
name
+
EMAIL_EXTENSION
)
@step
(
u'He does( not)? see the course on his page'
)
def
see_course
(
step
,
doesnt_see_course
):
def
see_course
(
_
step
,
doesnt_see_course
):
class_css
=
'.class-name'
all_courses
=
world
.
css_find
(
class_css
)
all_names
=
[
item
.
html
for
item
in
all_courses
]
...
...
@@ -56,12 +56,12 @@ def see_course(step, doesnt_see_course):
@step
(
u'He cannot delete users'
)
def
cannot_delete
(
step
):
def
cannot_delete
(
_
step
):
to_delete_css
=
'.remove-user'
assert
world
.
is_css_not_present
(
to_delete_css
)
@step
(
u'He cannot add users'
)
def
cannot_add
(
step
):
def
cannot_add
(
_
step
):
add_css
=
'.new-user'
assert
world
.
is_css_not_present
(
add_css
)
cms/djangoapps/contentstore/features/course-updates.py
View file @
b9d79aea
...
...
@@ -7,7 +7,7 @@ from common import type_in_codemirror
@step
(
u'I go to the course updates page'
)
def
go_to_uploads
(
step
):
def
go_to_uploads
(
_
step
):
menu_css
=
'li.nav-course-courseware'
uploads_css
=
'.nav-course-courseware-updates'
world
.
css_click
(
menu_css
)
...
...
@@ -15,14 +15,14 @@ def go_to_uploads(step):
@step
(
u'I add a new update with the text "([^"]*)"$'
)
def
add_update
(
step
,
text
):
def
add_update
(
_
step
,
text
):
update_css
=
'.new-update-button'
world
.
css_click
(
update_css
)
change_text
(
text
)
@step
(
u'I should( not)? see the update "([^"]*)"$'
)
def
check_update
(
step
,
doesnt_see_update
,
text
):
def
check_update
(
_
step
,
doesnt_see_update
,
text
):
update_css
=
'.update-contents'
update
=
world
.
css_find
(
update_css
)
if
doesnt_see_update
:
...
...
@@ -32,20 +32,20 @@ def check_update(step, doesnt_see_update, text):
@step
(
u'I modify the text to "([^"]*)"$'
)
def
modify_update
(
step
,
text
):
def
modify_update
(
_
step
,
text
):
button_css
=
'.post-preview .edit-button'
world
.
css_click
(
button_css
)
change_text
(
text
)
@step
(
u'I delete the update$'
)
def
click_button
(
step
):
def
click_button
(
_
step
):
button_css
=
'.post-preview .delete-button'
world
.
css_click
(
button_css
)
@step
(
u'I edit the date to "([^"]*)"$'
)
def
change_date
(
step
,
new_date
):
def
change_date
(
_
step
,
new_date
):
button_css
=
'.post-preview .edit-button'
world
.
css_click
(
button_css
)
date_css
=
'input.date'
...
...
@@ -58,21 +58,21 @@ def change_date(step, new_date):
@step
(
u'I should see the date "([^"]*)"$'
)
def
check_date
(
step
,
date
):
def
check_date
(
_
step
,
date
):
date_css
=
'.date-display'
date_html
=
world
.
css_find
(
date_css
)
assert
date
==
date_html
.
html
@step
(
u'I modify the handout to "([^"]*)"$'
)
def
edit_handouts
(
step
,
text
):
def
edit_handouts
(
_
step
,
text
):
edit_css
=
'.course-handouts > .edit-button'
world
.
css_click
(
edit_css
)
change_text
(
text
)
@step
(
u'I see the handout "([^"]*)"$'
)
def
check_handout
(
step
,
handout
):
def
check_handout
(
_
step
,
handout
):
handout_css
=
'.handouts-content'
handouts
=
world
.
css_find
(
handout_css
)
assert
handout
in
handouts
.
html
...
...
cms/djangoapps/contentstore/features/static-pages.py
View file @
b9d79aea
...
...
@@ -6,7 +6,7 @@ from selenium.webdriver.common.keys import Keys
@step
(
u'I go to the static pages page'
)
def
go_to_uploads
(
step
):
def
go_to_uploads
(
_
step
):
menu_css
=
'li.nav-course-courseware'
uploads_css
=
'.nav-course-courseware-pages'
world
.
css_find
(
menu_css
)
.
click
()
...
...
@@ -14,13 +14,13 @@ def go_to_uploads(step):
@step
(
u'I add a new page'
)
def
add_page
(
step
):
def
add_page
(
_
step
):
button_css
=
'.new-button'
world
.
css_find
(
button_css
)
.
click
()
@step
(
u'I should( not)? see a "([^"]*)" static page$'
)
def
see_page
(
step
,
doesnt
,
page
):
def
see_page
(
_
step
,
doesnt
,
page
):
index
=
get_index
(
page
)
if
doesnt
:
assert
index
==
-
1
...
...
@@ -29,7 +29,7 @@ def see_page(step, doesnt, page):
@step
(
u'I "([^"]*)" the "([^"]*)" page$'
)
def
click_edit_delete
(
step
,
edit_delete
,
page
):
def
click_edit_delete
(
_
step
,
edit_delete
,
page
):
button_css
=
'.
%
s-button'
%
edit_delete
index
=
get_index
(
page
)
assert
index
!=
-
1
...
...
@@ -37,7 +37,7 @@ def click_edit_delete(step, edit_delete, page):
@step
(
u'I change the name to "([^"]*)"$'
)
def
change_name
(
step
,
new_name
):
def
change_name
(
_
step
,
new_name
):
settings_css
=
'#settings-mode'
world
.
css_find
(
settings_css
)
.
click
()
input_css
=
'.setting-input'
...
...
cms/djangoapps/contentstore/features/upload.py
View file @
b9d79aea
...
...
@@ -13,7 +13,7 @@ HTTP_PREFIX = "http://localhost:8001"
@step
(
u'I go to the files and uploads page'
)
def
go_to_uploads
(
step
):
def
go_to_uploads
(
_
step
):
menu_css
=
'li.nav-course-courseware'
uploads_css
=
'.nav-course-courseware-uploads'
world
.
css_find
(
menu_css
)
.
click
()
...
...
@@ -21,7 +21,7 @@ def go_to_uploads(step):
@step
(
u'I upload the file "([^"]*)"$'
)
def
upload_file
(
step
,
file_name
):
def
upload_file
(
_
step
,
file_name
):
upload_css
=
'.upload-button'
world
.
css_find
(
upload_css
)
.
click
()
...
...
@@ -36,7 +36,7 @@ def upload_file(step, file_name):
@step
(
u'I should( not)? see the file "([^"]*)" was uploaded$'
)
def
check_upload
(
step
,
do_not_see_file
,
file_name
):
def
check_upload
(
_
step
,
do_not_see_file
,
file_name
):
index
=
get_index
(
file_name
)
if
do_not_see_file
:
assert
index
==
-
1
...
...
@@ -45,13 +45,13 @@ def check_upload(step, do_not_see_file, file_name):
@step
(
u'The url for the file "([^"]*)" is valid$'
)
def
check_url
(
step
,
file_name
):
def
check_url
(
_
step
,
file_name
):
r
=
get_file
(
file_name
)
assert
r
.
status_code
==
200
@step
(
u'I delete the file "([^"]*)"$'
)
def
delete_file
(
step
,
file_name
):
def
delete_file
(
_
step
,
file_name
):
index
=
get_index
(
file_name
)
assert
index
!=
-
1
delete_css
=
".remove-asset-button"
...
...
@@ -62,7 +62,7 @@ def delete_file(step, file_name):
@step
(
u'I should see only one "([^"]*)"$'
)
def
no_duplicate
(
step
,
file_name
):
def
no_duplicate
(
_
step
,
file_name
):
names_css
=
'.name-col > a.filename'
all_names
=
world
.
css_find
(
names_css
)
only_one
=
False
...
...
@@ -73,7 +73,7 @@ def no_duplicate(step, file_name):
@step
(
u'I can download the correct "([^"]*)" file$'
)
def
check_download
(
step
,
file_name
):
def
check_download
(
_
step
,
file_name
):
path
=
os
.
path
.
join
(
TEST_ROOT
,
'uploads/'
,
file_name
)
with
open
(
os
.
path
.
abspath
(
path
),
'r'
)
as
cur_file
:
cur_text
=
cur_file
.
read
()
...
...
@@ -83,7 +83,7 @@ def check_download(step, file_name):
@step
(
u'I modify "([^"]*)"$'
)
def
modify_upload
(
step
,
file_name
):
def
modify_upload
(
_
step
,
file_name
):
new_text
=
''
.
join
(
random
.
choice
(
string
.
ascii_uppercase
+
string
.
digits
)
for
x
in
range
(
10
))
path
=
os
.
path
.
join
(
TEST_ROOT
,
'uploads/'
,
file_name
)
with
open
(
os
.
path
.
abspath
(
path
),
'w'
)
as
cur_file
:
...
...
common/test/data/uploads/test
View file @
b9d79aea
R22VMJ2M
\ No newline at end of file
This is an arbitrary file for testing uploads
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment