Commit 43ebb814 by Calen Pennington

Add test of resources url

parent 9c832513
recursive-include acid/static *
recursive-include acid/public *
......@@ -180,6 +180,7 @@ class AcidBlock(XBlock):
acid_child_count=len([child for child in children if child.scope_ids.block_type == 'acid']),
rendered_children=(fragment.content for fragment in rendered_children),
storage_tests=scope_test_contexts,
local_resource_url=self.runtime.local_resource_url(self, 'public/test_data.json'),
))
frag.add_frags_resources(rendered_children)
......
{"test_data": "success"}
\ No newline at end of file
......@@ -6,6 +6,7 @@
data-error-class="${error_class}"
data-unknown-class="${unknown_class}"
data-acid-child-count="${acid_child_count}"
data-local-resource-url="${local_resource_url}"
>
<script class="acid-child-values" type="application/json">
${json.dumps(acid_child_values)}
......@@ -32,6 +33,11 @@
<i class="${unknown_class}"></i>
</span>
</p>
<p>Resource Url Test:
<span class="local-resource-test">
<i class="${unknown_class}"></i>
</span>
</p>
<table class='storage-tests'>
<tr>
<th>Scope</th>
......
......@@ -25,6 +25,20 @@ function AcidBlock(runtime, element) {
}
}
function resourceTests() {
$.get(acidData('local-resource-url'))
.fail(function() {
mark('failure', '.local-resource-test', element, 'Unable to load local resource');
})
.done(function(data) {
if (data.test_data == 'success') {
mark('success', '.local-resource-test');
} else {
mark('failure', '.local-resource-test', element, 'Data mismatch');
}
});
}
function childTests() {
if (acidData('acid-child-count') == runtime.children(element).length) {
mark('success', '.child-counts-match');
......@@ -84,6 +98,7 @@ function AcidBlock(runtime, element) {
mark('success', '.document-ready-run');
childTests();
resourceTests();
scopeTests();
});
......
"""Set up for XBlock acid block."""
import os
from setuptools import setup
def package_data(pkg, roots):
"""Generic function to find package_data for `pkg` under `root`."""
data = []
for root in roots:
for dirname, _, files in os.walk(os.path.join(pkg, root)):
for fname in files:
data.append(os.path.relpath(os.path.join(dirname, fname), pkg))
return {pkg: data}
setup(
name='acid-xblock',
version='0.1',
......@@ -19,10 +31,5 @@ setup(
'acid = acid:AcidBlock',
],
},
package_data={
'acid': [
'static/*/*.*',
'static/*/*/*.*',
],
},
package_data=package_data("acid", ["static", "public"]),
)
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