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
5600a9bd
Commit
5600a9bd
authored
Jul 15, 2016
by
Jesse Zoldak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix instructor_task model tests to use unique temp dirs
parent
3647c179
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
22 deletions
+15
-22
lms/djangoapps/instructor_task/tests/test_models.py
+15
-22
No files found.
lms/djangoapps/instructor_task/tests/test_models.py
View file @
5600a9bd
"""
"""
Tests for instructor_task/models.py.
Tests for instructor_task/models.py.
"""
"""
import
copy
from
cStringIO
import
StringIO
from
cStringIO
import
StringIO
import
time
import
time
...
@@ -16,21 +16,6 @@ from instructor_task.tests.test_base import TestReportMixin
...
@@ -16,21 +16,6 @@ from instructor_task.tests.test_base import TestReportMixin
from
opaque_keys.edx.locator
import
CourseLocator
from
opaque_keys.edx.locator
import
CourseLocator
LOCAL_SETTINGS
=
{
'STORAGE_KWARGS'
:
{
'location'
:
settings
.
GRADES_DOWNLOAD
[
'ROOT_PATH'
],
},
}
S3_SETTINGS
=
{
'STORAGE_CLASS'
:
'storages.backends.s3boto.S3BotoStorage'
,
'STORAGE_KWARGS'
:
{
'bucket'
:
settings
.
GRADES_DOWNLOAD
[
'BUCKET'
],
'location'
:
settings
.
GRADES_DOWNLOAD
[
'ROOT_PATH'
],
},
}
class
ReportStoreTestMixin
(
object
):
class
ReportStoreTestMixin
(
object
):
"""
"""
Mixin for report store tests.
Mixin for report store tests.
...
@@ -92,7 +77,6 @@ class S3ReportStoreTestCase(MockS3Mixin, ReportStoreTestMixin, TestReportMixin,
...
@@ -92,7 +77,6 @@ class S3ReportStoreTestCase(MockS3Mixin, ReportStoreTestMixin, TestReportMixin,
return
ReportStore
.
from_config
(
config_name
=
'GRADES_DOWNLOAD'
)
return
ReportStore
.
from_config
(
config_name
=
'GRADES_DOWNLOAD'
)
@override_settings
(
GRADES_DOWNLOAD
=
LOCAL_SETTINGS
)
class
DjangoStorageReportStoreLocalTestCase
(
ReportStoreTestMixin
,
TestReportMixin
,
SimpleTestCase
):
class
DjangoStorageReportStoreLocalTestCase
(
ReportStoreTestMixin
,
TestReportMixin
,
SimpleTestCase
):
"""
"""
Test the DjangoStorageReportStore implementation using the local
Test the DjangoStorageReportStore implementation using the local
...
@@ -103,10 +87,12 @@ class DjangoStorageReportStoreLocalTestCase(ReportStoreTestMixin, TestReportMixi
...
@@ -103,10 +87,12 @@ class DjangoStorageReportStoreLocalTestCase(ReportStoreTestMixin, TestReportMixi
Create and return a DjangoStorageReportStore configured to use the
Create and return a DjangoStorageReportStore configured to use the
local filesystem for storage.
local filesystem for storage.
"""
"""
return
ReportStore
.
from_config
(
config_name
=
'GRADES_DOWNLOAD'
)
test_settings
=
copy
.
deepcopy
(
settings
.
GRADES_DOWNLOAD
)
test_settings
[
'STORAGE_KWARGS'
]
=
{
'location'
:
settings
.
GRADES_DOWNLOAD
[
'ROOT_PATH'
]}
with
override_settings
(
GRADES_DOWNLOAD
=
test_settings
):
return
ReportStore
.
from_config
(
config_name
=
'GRADES_DOWNLOAD'
)
@override_settings
(
GRADES_DOWNLOAD
=
S3_SETTINGS
)
class
DjangoStorageReportStoreS3TestCase
(
MockS3Mixin
,
ReportStoreTestMixin
,
TestReportMixin
,
SimpleTestCase
):
class
DjangoStorageReportStoreS3TestCase
(
MockS3Mixin
,
ReportStoreTestMixin
,
TestReportMixin
,
SimpleTestCase
):
"""
"""
Test the DjangoStorageReportStore implementation using S3 stubs.
Test the DjangoStorageReportStore implementation using S3 stubs.
...
@@ -116,6 +102,13 @@ class DjangoStorageReportStoreS3TestCase(MockS3Mixin, ReportStoreTestMixin, Test
...
@@ -116,6 +102,13 @@ class DjangoStorageReportStoreS3TestCase(MockS3Mixin, ReportStoreTestMixin, Test
Create and return a DjangoStorageReportStore configured to use S3 for
Create and return a DjangoStorageReportStore configured to use S3 for
storage.
storage.
"""
"""
connection
=
boto
.
connect_s3
()
test_settings
=
copy
.
deepcopy
(
settings
.
GRADES_DOWNLOAD
)
connection
.
create_bucket
(
settings
.
GRADES_DOWNLOAD
[
'STORAGE_KWARGS'
][
'bucket'
])
test_settings
[
'STORAGE_CLASS'
]
=
'storages.backends.s3boto.S3BotoStorage'
return
ReportStore
.
from_config
(
config_name
=
'GRADES_DOWNLOAD'
)
test_settings
[
'STORAGE_KWARGS'
]
=
{
'bucket'
:
settings
.
GRADES_DOWNLOAD
[
'BUCKET'
],
'location'
:
settings
.
GRADES_DOWNLOAD
[
'ROOT_PATH'
],
}
with
override_settings
(
GRADES_DOWNLOAD
=
test_settings
):
connection
=
boto
.
connect_s3
()
connection
.
create_bucket
(
settings
.
GRADES_DOWNLOAD
[
'STORAGE_KWARGS'
][
'bucket'
])
return
ReportStore
.
from_config
(
config_name
=
'GRADES_DOWNLOAD'
)
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