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
dc94ea10
Commit
dc94ea10
authored
Jun 14, 2013
by
Chris Dodge
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add unit test for emptying the trashcan
parent
7e46447c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
1 deletions
+45
-1
cms/djangoapps/contentstore/tests/test_contentstore.py
+45
-1
No files found.
cms/djangoapps/contentstore/tests/test_contentstore.py
View file @
dc94ea10
...
...
@@ -29,7 +29,7 @@ from xmodule.modulestore.xml_exporter import export_to_xml
from
xmodule.modulestore.xml_importer
import
import_from_xml
,
perform_xlint
from
xmodule.modulestore.inheritance
import
own_metadata
from
xmodule.contentstore.content
import
StaticContent
from
xmodule.contentstore.utils
import
restore_asset_from_trashcan
from
xmodule.contentstore.utils
import
restore_asset_from_trashcan
,
empty_asset_trashcan
from
xmodule.capa_module
import
CapaDescriptor
from
xmodule.course_module
import
CourseDescriptor
...
...
@@ -490,6 +490,50 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase):
self
.
assertIsNotNone
(
content
)
self
.
assertIsNotNone
(
thumbnail
)
def
test_empty_trashcan
(
self
):
'''
This test will exercise the empting of the asset trashcan
'''
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
)
course_location
=
CourseDescriptor
.
id_to_location
(
'edX/full/6.002_Spring_2012'
)
content
=
None
try
:
location
=
StaticContent
.
get_location_from_path
(
'/c4x/edX/full/asset/circuits_duality.gif'
)
content
=
content_store
.
find
(
location
)
except
NotFoundError
:
pass
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'
})
self
.
assertEqual
(
resp
.
status_code
,
200
)
# make sure there's something in the trashcan
all_assets
=
trash_store
.
get_all_content_for_course
(
course_location
)
self
.
assertGreater
(
len
(
all_assets
),
0
)
# make sure we have some thumbnails in our trashcan
all_thumbnails
=
trash_store
.
get_all_content_thumbnails_for_course
(
course_location
)
self
.
assertGreater
(
len
(
all_thumbnails
),
0
)
# empty the trashcan
empty_asset_trashcan
([
course_location
])
# make sure trashcan is empty
all_assets
=
trash_store
.
get_all_content_for_course
(
course_location
)
all_thumbnails
=
trash_store
.
get_all_content_thumbnails_for_course
(
course_location
)
self
.
assertEqual
(
len
(
all_assets
),
0
)
self
.
assertEqual
(
len
(
all_thumbnails
),
0
)
def
test_clone_course
(
self
):
course_data
=
{
...
...
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