コード例 #1
0
ファイル: test_remongo.py プロジェクト: zoulema/formhub
 def test_remongo_in_batches(self):
   self._publish_transportation_form()
   # submit 4 instances
   self._make_submissions()
   self.assertEqual(ParsedInstance.objects.count(), 4)
   # clear mongo
   settings.MONGO_DB.instances.drop()
   c = Command()
   c.handle(batchsize=3)
   # mongo db should now have 5 records
   count = settings.MONGO_DB.instances.count()
   self.assertEqual(count, 4)
コード例 #2
0
ファイル: test_remongo.py プロジェクト: muazmohamed/formhub
 def test_remongo_with_username_id_string(self):
     self._publish_transportation_form()
     # submit 5 instances
     for i in range(5):
         self._submit_transport_instance()
     # publish and submit for a different user
     self._logout()
     self._create_user_and_login("harry", "harry")
     self._publish_transportation_form()
     for i in range(4):
         self._submit_transport_instance()
     self.assertEqual(ParsedInstance.objects.count(), 9)
     # clear mongo
     settings.MONGO_DB.instances.drop()
     c = Command()
     c.handle(batchsize=3, username=self.user.username,
         id_string=self.xform.id_string)
     # mongo db should now have 5 records
     count = settings.MONGO_DB.instances.count()
     self.assertEqual(count, 4)
コード例 #3
0
ファイル: test_remongo.py プロジェクト: zoulema/formhub
 def test_remongo_with_username_id_string(self):
     self._publish_transportation_form()
     # submit 1 instances
     s = self.surveys[0]
     self._make_submission(os.path.join(self.this_directory, 'fixtures',
                           'transportation', 'instances', s, s + '.xml'))
     # publish and submit for a different user
     self._logout()
     self._create_user_and_login("harry", "harry")
     self._publish_transportation_form()
     s = self.surveys[1]
     self._make_submission(os.path.join(self.this_directory, 'fixtures',
                           'transportation', 'instances', s, s + '.xml'))
     self.assertEqual(ParsedInstance.objects.count(), 2)
     # clear mongo
     settings.MONGO_DB.instances.drop()
     c = Command()
     c.handle(batchsize=3, username=self.user.username,
         id_string=self.xform.id_string)
     # mongo db should now have 2 records
     count = settings.MONGO_DB.instances.count()
     self.assertEqual(count, 1)