예제 #1
0
 def test_data_dict(self):
     """Properly convert JSON text in `data` property into a python dict"""
     s = Submission(data='{"name": "George", "Gender": "Male"}')
     self.assertDictEqual(s.data_dict(), {
         u'name': u'George',
         u'Gender': u'Male',
     })
예제 #2
0
 def test_data_dict(self):
     """
     data_dict should properly convert JSON formatted text in the `data`
     property into a python dictionary
     """
     s = Submission(data ='{"name": "George", "Gender": "Male"}')
     self.assertDictEqual(
         s.data_dict(),
         {
             u'name': u'George',
             u'Gender': u'Male',
             }
         )
예제 #3
0
 def test_to_dict(self):
     """
     to_dict method should properly convert the object to a python dictionary
     """
     data = OrderedDict({
         u'first-name': u'Bart',
         u'last-name': u'Simpson',
         u'subject': u'Testing',
         u'comment': u'Testing the Submission.to_dict() method.',
         })
     submission = Submission(
         locker = Locker.objects.get(pk=1),
         data = json.dumps(data),
         )
     submission.save()
     expected_results = {
         'deleted': None,
         'locker': 1L,
         'data': data,
         u'id': submission.id,
         'timestamp': submission.timestamp.isoformat(),
         'workflow_state': '',
         }