Example #1
0
 def test_to_config(self):
     form = JsboxForm(data={
         'javascript': 'x = 1;',
     })
     self.assertTrue(form.is_valid())
     metadata = form.to_config()
     self.assertEqual(metadata, {
         'javascript': 'x = 1;',
         'source_url': '',
     })
Example #2
0
 def test_to_config(self):
     form = JsboxForm(data={
         'javascript': 'x = 1;',
     })
     self.assertTrue(form.is_valid())
     metadata = form.to_config()
     self.assertEqual(metadata, {
         'javascript': 'x = 1;',
         'source_url': '',
     })
Example #3
0
 def test_initial_form_metadata(self):
     initial = JsboxForm.initial_from_config({
         'javascript': 'x = 1;',
         'source_url': 'http://www.example.com',
     })
     self.assertEqual(initial, {
         'javascript': 'x = 1;',
         'source_url': 'http://www.example.com',
     })
Example #4
0
 def test_initial_form_metadata(self):
     initial = JsboxForm.initial_from_config({
         'javascript':
         'x = 1;',
         'source_url':
         'http://www.example.com',
     })
     self.assertEqual(initial, {
         'javascript': 'x = 1;',
         'source_url': 'http://www.example.com',
     })