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
55e6d1ad
Commit
55e6d1ad
authored
Jun 24, 2013
by
JonahStanley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Asset tests do not rely on the full course
A blank asset file was also added to toy
parent
62f27647
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
16 deletions
+14
-16
cms/djangoapps/contentstore/tests/test_contentstore.py
+14
-16
common/test/data/toy/static/sample_static.txt
+0
-0
No files found.
cms/djangoapps/contentstore/tests/test_contentstore.py
View file @
55e6d1ad
...
...
@@ -429,7 +429,6 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase):
course
=
module_store
.
get_item
(
course_location
)
self
.
assertFalse
(
course
.
hide_progress_tab
)
#FIX
def
test_asset_import
(
self
):
'''
This test validates that an image asset is imported and a thumbnail was generated for a .gif
...
...
@@ -437,9 +436,9 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase):
content_store
=
contentstore
()
module_store
=
modulestore
(
'direct'
)
import_from_xml
(
module_store
,
'common/test/data/'
,
[
'
full
'
],
static_content_store
=
content_store
)
import_from_xml
(
module_store
,
'common/test/data/'
,
[
'
toy
'
],
static_content_store
=
content_store
)
course_location
=
CourseDescriptor
.
id_to_location
(
'edX/
full/6.002_Spring_2012
'
)
course_location
=
CourseDescriptor
.
id_to_location
(
'edX/
toy/2012_Fall
'
)
course
=
module_store
.
get_item
(
course_location
)
self
.
assertIsNotNone
(
course
)
...
...
@@ -460,7 +459,7 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase):
content
=
None
try
:
location
=
StaticContent
.
get_location_from_path
(
'/c4x/edX/
full/asset/circuits_duality.gif
'
)
location
=
StaticContent
.
get_location_from_path
(
'/c4x/edX/
toy/asset/sample_static.txt
'
)
content
=
content_store
.
find
(
location
)
except
NotFoundError
:
pass
...
...
@@ -481,7 +480,6 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase):
#
# self.assertIsNotNone(thumbnail)
#FIX
def
test_asset_delete_and_restore
(
self
):
'''
This test will exercise the soft delete/restore functionality of the assets
...
...
@@ -489,10 +487,10 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase):
content_store
=
contentstore
()
trash_store
=
contentstore
(
'trashcan'
)
module_store
=
modulestore
(
'direct'
)
import_from_xml
(
module_store
,
'common/test/data/'
,
[
'
full
'
],
static_content_store
=
content_store
)
import_from_xml
(
module_store
,
'common/test/data/'
,
[
'
toy
'
],
static_content_store
=
content_store
)
# look up original (and thumbnail) in content store, should be there after import
location
=
StaticContent
.
get_location_from_path
(
'/c4x/edX/
full/asset/circuits_duality.gif
'
)
location
=
StaticContent
.
get_location_from_path
(
'/c4x/edX/
toy/asset/sample_static.txt
'
)
content
=
content_store
.
find
(
location
,
throw_on_not_found
=
False
)
thumbnail_location
=
content
.
thumbnail_location
self
.
assertIsNotNone
(
content
)
...
...
@@ -505,11 +503,11 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase):
# go through the website to do the delete, since the soft-delete logic is in the view
url
=
reverse
(
'remove_asset'
,
kwargs
=
{
'org'
:
'edX'
,
'course'
:
'
full'
,
'name'
:
'6.002_Spring_2012
'
})
resp
=
self
.
client
.
post
(
url
,
{
'location'
:
'/c4x/edX/
full/asset/circuits_duality.gif
'
})
url
=
reverse
(
'remove_asset'
,
kwargs
=
{
'org'
:
'edX'
,
'course'
:
'
toy'
,
'name'
:
'2012_Fall
'
})
resp
=
self
.
client
.
post
(
url
,
{
'location'
:
'/c4x/edX/
toy/asset/sample_static.txt
'
})
self
.
assertEqual
(
resp
.
status_code
,
200
)
asset_location
=
StaticContent
.
get_location_from_path
(
'/c4x/edX/
full/asset/circuits_duality.gif
'
)
asset_location
=
StaticContent
.
get_location_from_path
(
'/c4x/edX/
toy/asset/sample_static.txt
'
)
# now try to find it in store, but they should not be there any longer
content
=
content_store
.
find
(
asset_location
,
throw_on_not_found
=
False
)
...
...
@@ -528,7 +526,7 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase):
self
.
assertIsNotNone
(
thumbnail
)
# let's restore the asset
restore_asset_from_trashcan
(
'/c4x/edX/
full/asset/circuits_duality.gif
'
)
restore_asset_from_trashcan
(
'/c4x/edX/
toy/asset/sample_static.txt
'
)
# now try to find it in courseware store, and they should be back after restore
content
=
content_store
.
find
(
asset_location
,
throw_on_not_found
=
False
)
...
...
@@ -547,18 +545,18 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase):
trash_store
=
contentstore
(
'trashcan'
)
module_store
=
modulestore
(
'direct'
)
import_from_xml
(
module_store
,
'common/test/data/'
,
[
'
full
'
],
static_content_store
=
content_store
)
import_from_xml
(
module_store
,
'common/test/data/'
,
[
'
toy
'
],
static_content_store
=
content_store
)
course_location
=
CourseDescriptor
.
id_to_location
(
'edX/
full
/6.002_Spring_2012'
)
course_location
=
CourseDescriptor
.
id_to_location
(
'edX/
toy
/6.002_Spring_2012'
)
location
=
StaticContent
.
get_location_from_path
(
'/c4x/edX/
full/asset/circuits_duality.gif
'
)
location
=
StaticContent
.
get_location_from_path
(
'/c4x/edX/
toy/asset/sample_static.txt
'
)
content
=
content_store
.
find
(
location
,
throw_on_not_found
=
False
)
self
.
assertIsNotNone
(
content
)
# go through the website to do the delete, since the soft-delete logic is in the view
url
=
reverse
(
'remove_asset'
,
kwargs
=
{
'org'
:
'edX'
,
'course'
:
'
full'
,
'name'
:
'6.002_Spring_2012
'
})
resp
=
self
.
client
.
post
(
url
,
{
'location'
:
'/c4x/edX/
full/asset/circuits_duality.gif
'
})
url
=
reverse
(
'remove_asset'
,
kwargs
=
{
'org'
:
'edX'
,
'course'
:
'
toy'
,
'name'
:
'2012_Fall
'
})
resp
=
self
.
client
.
post
(
url
,
{
'location'
:
'/c4x/edX/
toy/asset/sample_static.txt
'
})
self
.
assertEqual
(
resp
.
status_code
,
200
)
# make sure there's something in the trashcan
...
...
common/test/data/toy/static/sample_static.txt
0 → 100644
View file @
55e6d1ad
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