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
d471bcb7
Commit
d471bcb7
authored
Jun 11, 2013
by
JonahStanley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added tests for uploading files
TODO: When deleting is available, test deleting uploaded files`
parent
b7674679
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
72 additions
and
0 deletions
+72
-0
cms/djangoapps/contentstore/features/upload.feature
+15
-0
cms/djangoapps/contentstore/features/upload.py
+57
-0
No files found.
cms/djangoapps/contentstore/features/upload.feature
0 → 100644
View file @
d471bcb7
Feature
:
Upload Files
As a course author, I want to be able to upload files for my students
Scenario
:
Users can upload files
Given
I have opened a new course in Studio
And
I go to the files and uploads page
When
I upload the file
"upload.feature"
Then
I see the file
"upload.feature"
was uploaded
Scenario
:
Users can update files
Given
I have opened a new course in studio
And
I go to the files and uploads page
When
I upload the file
"upload.feature"
And
I upload the file
"upload.feature"
Then
I see only one
"upload.feature"
cms/djangoapps/contentstore/features/upload.py
0 → 100644
View file @
d471bcb7
#pylint: disable=C0111
#pylint: disable=W0621
from
lettuce
import
world
,
step
import
os
@step
(
u'I go to the files and uploads page'
)
def
go_to_uploads
(
step
):
menu_css
=
'li.nav-course-courseware'
uploads_css
=
'.nav-course-courseware-uploads'
world
.
css_find
(
menu_css
)
.
click
()
world
.
css_find
(
uploads_css
)
.
click
()
@step
(
u'I upload the file "([^"]*)"$'
)
def
upload_file
(
step
,
file_name
):
upload_css
=
'.upload-button'
world
.
css_find
(
upload_css
)
.
click
()
file_css
=
'.file-input'
upload
=
world
.
css_find
(
file_css
)
upload
.
_element
.
send_keys
(
os
.
getcwd
()
+
'/'
+
file_name
)
close_css
=
'.close-button'
world
.
css_find
(
close_css
)
.
click
()
@step
(
u'I see the file "([^"]*)" was uploaded'
)
def
check_upload
(
step
,
file_name
):
index
=
get_index
(
file_name
)
assert
index
!=
-
1
@step
(
u'I see only one "([^"]*)"$'
)
def
no_duplicate
(
step
,
file_name
):
names_css
=
'.name-col > a.filename'
all_names
=
world
.
css_find
(
names_css
)
only_one
=
False
for
i
in
range
(
len
(
all_names
)):
if
file_name
==
all_names
[
i
]
.
html
:
only_one
=
not
only_one
assert
only_one
@step
(
u'I PAUSE'
)
def
pause
(
step
):
from
pdb
import
set_trace
;
set_trace
()
def
get_index
(
file_name
):
names_css
=
'.name-col > a.filename'
all_names
=
world
.
css_find
(
names_css
)
for
i
in
range
(
len
(
all_names
)):
if
file_name
==
all_names
[
i
]
.
html
:
return
i
return
-
1
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