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
61a5e713
Commit
61a5e713
authored
Jun 07, 2016
by
Calen Pennington
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #12629 from cpennington/cleanup-files-badging-tests
Cleanup uploaded files after badging tests
parents
1cda718f
c42c86ae
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
0 deletions
+15
-0
lms/djangoapps/badges/tests/test_models.py
+15
-0
No files found.
lms/djangoapps/badges/tests/test_models.py
View file @
61a5e713
...
...
@@ -3,6 +3,7 @@ Tests for the Badges app models.
"""
from
django.core.exceptions
import
ValidationError
from
django.core.files.images
import
ImageFile
from
django.core.files.storage
import
default_storage
from
django.db.utils
import
IntegrityError
from
django.test
import
TestCase
from
django.test.utils
import
override_settings
...
...
@@ -65,6 +66,20 @@ class BadgeClassTest(ModuleStoreTestCase):
"""
Test BadgeClass functionality
"""
def
setUp
(
self
):
super
(
BadgeClassTest
,
self
)
.
setUp
()
self
.
addCleanup
(
self
.
cleanup_uploads
)
def
cleanup_uploads
(
self
):
"""
Remove all files uploaded as badges.
"""
upload_to
=
BadgeClass
.
_meta
.
get_field
(
'image'
)
.
upload_to
# pylint: disable=protected-access
(
_
,
files
)
=
default_storage
.
listdir
(
upload_to
)
for
uploaded_file
in
files
:
default_storage
.
delete
(
upload_to
+
'/'
+
uploaded_file
)
# Need full path to make sure class names line up.
@override_settings
(
BADGING_BACKEND
=
'lms.djangoapps.badges.tests.test_models.DummyBackend'
)
def
test_backend
(
self
):
...
...
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