Commit 861f1ef7 by Chris Dodge

add a test for the static url generation

parent b8bc1d01
...@@ -10,6 +10,8 @@ from unittest import TestCase, skip ...@@ -10,6 +10,8 @@ from unittest import TestCase, skip
from .utils import CourseTestCase from .utils import CourseTestCase
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from contentstore.views import assets from contentstore.views import assets
from xmodule.contentstore.content import StaticContent
from xmodule.modulestore import Location
class AssetsTestCase(CourseTestCase): class AssetsTestCase(CourseTestCase):
...@@ -35,6 +37,11 @@ class AssetsTestCase(CourseTestCase): ...@@ -35,6 +37,11 @@ class AssetsTestCase(CourseTestCase):
content = json.loads(resp.content) content = json.loads(resp.content)
self.assertIsInstance(content, list) self.assertIsInstance(content, list)
def test_static_url_generation(self):
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')
class UploadTestCase(CourseTestCase): class UploadTestCase(CourseTestCase):
""" """
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment