Пример #1
0
    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")
        auth = DigestAuth("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'),
                              username="******", auth=auth)

        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_documents(filter={})
        self.assertEqual(count, 1)
Пример #2
0
    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")
        auth = DigestAuth("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'),
                              username="******", auth=auth)

        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)
Пример #3
0
 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)
Пример #4
0
 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_documents(filter={})
     self.assertEqual(count, 4)