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
8db7b0ce
Commit
8db7b0ce
authored
Feb 26, 2014
by
cahrens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for external_url being passed to assets page.
parent
3553fa7c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
8 deletions
+5
-8
cms/djangoapps/contentstore/views/tests/test_assets.py
+5
-8
No files found.
cms/djangoapps/contentstore/views/tests/test_assets.py
View file @
8db7b0ce
...
...
@@ -18,6 +18,7 @@ from xmodule.contentstore.django import contentstore
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.xml_importer
import
import_from_xml
from
xmodule.modulestore.django
import
loc_mapper
from
django.test.utils
import
override_settings
class
AssetsTestCase
(
CourseTestCase
):
...
...
@@ -36,21 +37,15 @@ class AssetsTestCase(CourseTestCase):
class
BasicAssetsTestCase
(
AssetsTestCase
):
location
=
Location
([
'i4x'
,
'foo'
,
'bar'
,
'asset'
,
'my_file_name.jpg'
])
TEST_LMS_BASE
=
'localhost:8000'
def
test_basic
(
self
):
resp
=
self
.
client
.
get
(
self
.
url
,
HTTP_ACCEPT
=
'text/html'
)
self
.
assertEquals
(
resp
.
status_code
,
200
)
def
test_static_url_generation
(
self
):
path
=
StaticContent
.
get_static_path_from_location
(
self
.
location
)
location
=
Location
([
'i4x'
,
'foo'
,
'bar'
,
'asset'
,
'my_file_name.jpg'
])
path
=
StaticContent
.
get_static_path_from_location
(
location
)
self
.
assertEquals
(
path
,
'/static/my_file_name.jpg'
)
def
test_lms_url_generation
(
self
):
url
=
self
.
TEST_LMS_BASE
+
StaticContent
.
get_url_path_from_location
(
self
.
location
)
self
.
assertEquals
(
url
,
'localhost:8000/i4x/foo/bar/asset/my_file_name.jpg'
)
def
test_pdf_asset
(
self
):
module_store
=
modulestore
(
'direct'
)
_
,
course_items
=
import_from_xml
(
...
...
@@ -144,6 +139,7 @@ class AssetToJsonTestCase(AssetsTestCase):
Unit test for transforming asset information into something
we can send out to the client via JSON.
"""
@override_settings
(
LMS_BASE
=
"lms_base_url"
)
def
test_basic
(
self
):
upload_date
=
datetime
(
2013
,
6
,
1
,
10
,
30
,
tzinfo
=
UTC
)
...
...
@@ -155,6 +151,7 @@ class AssetToJsonTestCase(AssetsTestCase):
self
.
assertEquals
(
output
[
"display_name"
],
"my_file"
)
self
.
assertEquals
(
output
[
"date_added"
],
"Jun 01, 2013 at 10:30 UTC"
)
self
.
assertEquals
(
output
[
"url"
],
"/i4x/foo/bar/asset/my_file_name.jpg"
)
self
.
assertEquals
(
output
[
"external_url"
],
"lms_base_url/i4x/foo/bar/asset/my_file_name.jpg"
)
self
.
assertEquals
(
output
[
"portable_url"
],
"/static/my_file_name.jpg"
)
self
.
assertEquals
(
output
[
"thumbnail"
],
"/i4x/foo/bar/asset/my_file_name_thumb.jpg"
)
self
.
assertEquals
(
output
[
"id"
],
output
[
"url"
])
...
...
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