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
ed434c55
Commit
ed434c55
authored
Jun 15, 2015
by
Zia Fazal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove in-memory files
no need to create zero by in memory images added contents to test upload files
parent
710c2110
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
cms/djangoapps/contentstore/views/tests/test_assets.py
+7
-7
No files found.
cms/djangoapps/contentstore/views/tests/test_assets.py
View file @
ed434c55
...
...
@@ -8,7 +8,6 @@ from PIL import Image
import
json
from
django.conf
import
settings
from
django.test.utils
import
override_settings
from
contentstore.tests.utils
import
CourseTestCase
from
contentstore.views
import
assets
...
...
@@ -56,18 +55,19 @@ class AssetsTestCase(CourseTestCase):
"""
Returns an in-memory file of the specified type with the given name for testing
"""
sample_asset
=
BytesIO
()
sample_file_contents
=
"This file is generated by python unit test"
if
asset_type
==
'text'
:
sample_asset
=
BytesIO
(
name
)
sample_asset
.
name
=
'{name}.txt'
.
format
(
name
=
name
)
sample_asset
.
write
(
sample_file_contents
)
elif
asset_type
==
'image'
:
image
=
Image
.
new
(
"RGB"
,
size
=
(
50
,
50
),
color
=
(
256
,
0
,
0
))
sample_asset
=
BytesIO
()
image
.
save
(
unicode
(
sample_asset
),
'jpeg'
)
image
.
save
(
sample_asset
,
'jpeg'
)
sample_asset
.
name
=
'{name}.jpg'
.
format
(
name
=
name
)
sample_asset
.
seek
(
0
)
elif
asset_type
==
'opendoc'
:
sample_asset
=
BytesIO
(
name
)
sample_asset
.
name
=
'{name}.odt'
.
format
(
name
=
name
)
sample_asset
.
write
(
sample_file_contents
)
sample_asset
.
seek
(
0
)
return
sample_asset
...
...
@@ -324,7 +324,7 @@ class DownloadTestCase(AssetsTestCase):
# Now, download it.
resp
=
self
.
client
.
get
(
self
.
uploaded_url
,
HTTP_ACCEPT
=
'text/html'
)
self
.
assertEquals
(
resp
.
status_code
,
200
)
self
.
assert
Equals
(
resp
.
content
,
self
.
asset_name
)
self
.
assert
Contains
(
resp
,
'This file is generated by python unit test'
)
def
test_download_not_found_throw
(
self
):
url
=
self
.
uploaded_url
.
replace
(
self
.
asset_name
,
'not_the_asset_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