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
25fe8e80
Commit
25fe8e80
authored
Jun 17, 2013
by
JonahStanley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Now using context files and os.path
parent
ef1f523c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
10 deletions
+12
-10
cms/djangoapps/contentstore/features/upload.py
+12
-10
No files found.
cms/djangoapps/contentstore/features/upload.py
View file @
25fe8e80
...
@@ -6,6 +6,7 @@ from django.conf import settings
...
@@ -6,6 +6,7 @@ from django.conf import settings
import
requests
import
requests
import
string
import
string
import
random
import
random
import
os
TEST_ROOT
=
settings
.
COMMON_TEST_DATA_ROOT
TEST_ROOT
=
settings
.
COMMON_TEST_DATA_ROOT
HTTP_PREFIX
=
"http://localhost:8001"
HTTP_PREFIX
=
"http://localhost:8001"
...
@@ -27,7 +28,8 @@ def upload_file(step, file_name):
...
@@ -27,7 +28,8 @@ def upload_file(step, file_name):
file_css
=
'.file-input'
file_css
=
'.file-input'
upload
=
world
.
css_find
(
file_css
)
upload
=
world
.
css_find
(
file_css
)
#uploading the file itself
#uploading the file itself
upload
.
_element
.
send_keys
(
TEST_ROOT
+
'/uploads/'
+
file_name
)
path
=
os
.
path
.
join
(
TEST_ROOT
,
'uploads/'
,
file_name
)
upload
.
_element
.
send_keys
(
os
.
path
.
abspath
(
path
))
close_css
=
'.close-button'
close_css
=
'.close-button'
world
.
css_find
(
close_css
)
.
click
()
world
.
css_find
(
close_css
)
.
click
()
...
@@ -58,20 +60,20 @@ def no_duplicate(step, file_name):
...
@@ -58,20 +60,20 @@ def no_duplicate(step, file_name):
@step
(
u'I can download the correct "([^"]*)" file$'
)
@step
(
u'I can download the correct "([^"]*)" file$'
)
def
check_download
(
step
,
file_name
):
def
check_download
(
step
,
file_name
):
cur_file
=
open
(
TEST_ROOT
+
'/uploads/'
+
file_name
,
'r'
)
path
=
os
.
path
.
join
(
TEST_ROOT
,
'uploads/'
,
file_name
)
cur_text
=
cur_file
.
read
()
with
open
(
os
.
path
.
abspath
(
path
),
'r'
)
as
cur_file
:
r
=
get_file
(
file_name
)
cur_text
=
cur_file
.
read
(
)
downloaded_text
=
r
.
text
r
=
get_file
(
file_name
)
assert
cur_text
==
downloaded_
text
downloaded_text
=
r
.
text
cur_file
.
close
()
assert
cur_text
==
downloaded_text
@step
(
u'I modify "([^"]*)"$'
)
@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
))
new_text
=
''
.
join
(
random
.
choice
(
string
.
ascii_uppercase
+
string
.
digits
)
for
x
in
range
(
10
))
cur_file
=
open
(
TEST_ROOT
+
'/uploads/'
+
file_name
,
'w'
)
path
=
os
.
path
.
join
(
TEST_ROOT
,
'uploads/'
,
file_name
)
cur_file
.
write
(
new_text
)
with
open
(
os
.
path
.
abspath
(
path
),
'w'
)
as
cur_file
:
cur_file
.
close
(
)
cur_file
.
write
(
new_text
)
def
get_index
(
file_name
):
def
get_index
(
file_name
):
...
...
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