From 02b7ab4fa075ca22caa87722b3dd9b2c73c5fbe8 Mon Sep 17 00:00:00 2001 From: Diana Huang Date: Fri, 29 Mar 2013 12:49:24 -0400 Subject: [PATCH] Tests to make sure that input_states have the correct keys and are not cross-pollinating --- .../lib/xmodule/xmodule/tests/test_capa_module.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/common/lib/xmodule/xmodule/tests/test_capa_module.py b/common/lib/xmodule/xmodule/tests/test_capa_module.py index d94345fe1c..7f334207e7 100644 --- a/common/lib/xmodule/xmodule/tests/test_capa_module.py +++ b/common/lib/xmodule/xmodule/tests/test_capa_module.py @@ -838,6 +838,19 @@ class CapaModuleTest(unittest.TestCase): # Assert that the encapsulated html contains the original html self.assertTrue(html in html_encapsulated) + def test_input_state_consistency(self): + module1 = CapaFactory.create() + module2 = CapaFactory.create() + + # check to make sure that the input_state and the keys have the same values + module1.set_state_from_lcp() + self.assertEqual(module1.lcp.inputs.keys(),module1.input_state.keys()) + + module2.set_state_from_lcp() + + intersection = set(module2.input_state.keys()).intersection(set(module1.input_state.keys())) + self.assertEqual(len(intersection), 0) + def test_get_problem_html_error(self): """ In production, when an error occurs with the problem HTML