Exemple #1
0
    def testConfirmationModeQueryManualAndAuto(self):
        (user, dummySection, dummyPredModeMap) = self.setupClientTest()
        clientSetQuery = Client(user.getFirstStudy()).clientSpecificSetters(
            user.uuid, dummySection, dummyPredModeMap)

        # Apply the change
        get_database.get_section_db().update({'_id': dummySection['_id']},
                                             clientSetQuery)
        retrievedSection = get_database.get_section_db().find_one(
            {'_id': dummySection['_id']})
        self.assertEqual(retrievedSection['test_auto_confirmed']['mode'], 1)

        get_database.get_section_db().update({'_id': dummySection['_id']},
                                             {'$set': {
                                                 'confirmed_mode': 4
                                             }})

        retrieveByQuery = get_database.get_section_db().find(
            common.getConfirmationModeQuery(1))
        for entry in retrieveByQuery:
            print entry
        self.assertEqual(retrieveByQuery.count(), 0)

        retrieveByQuery = get_database.get_section_db().find(
            common.getConfirmationModeQuery(4))
        for entry in retrieveByQuery:
            print entry
        self.assertEqual(retrieveByQuery.count(), 1)
  def testConfirmationModeQueryNeither(self):
    (user, dummySection, dummyPredModeMap) = self.setupClientTest()
    retrieveByQuery = get_database.get_section_db().find(common.getConfirmationModeQuery(1))
    self.assertEqual(retrieveByQuery.count(), 0)

    retrieveByQuery = get_database.get_section_db().find(common.getConfirmationModeQuery(4))
    self.assertEqual(retrieveByQuery.count(), 0)
  def testConfirmationModeQueryCorrectedManualAndAuto(self):
    (user, dummySection, dummyPredModeMap) = self.setupClientTest()
    clientSetQuery = Client(user.getFirstStudy()).clientSpecificSetters(user.uuid, dummySection, dummyPredModeMap)

    # Apply the change
    get_database.get_section_db().update({'_id': dummySection['_id']}, clientSetQuery)
    retrievedSection = get_database.get_section_db().find_one({'_id': dummySection['_id']})
    self.assertEqual(retrievedSection['test_auto_confirmed']['mode'], 1)

    get_database.get_section_db().update({'_id': dummySection['_id']}, {'$set': {'confirmed_mode': 4}})
    get_database.get_section_db().update({'_id': dummySection['_id']}, {'$set': {'corrected_mode': 9}})

    retrieveByQuery = get_database.get_section_db().find(common.getConfirmationModeQuery(1))
    for entry in retrieveByQuery:
      print entry
    self.assertEqual(retrieveByQuery.count(), 0)

    retrieveByQuery = get_database.get_section_db().find(common.getConfirmationModeQuery(4))
    for entry in retrieveByQuery:
      print entry
    self.assertEqual(retrieveByQuery.count(), 0)

    retrieveByQuery = get_database.get_section_db().find(common.getConfirmationModeQuery(9))
    for entry in retrieveByQuery:
      print entry
    self.assertEqual(retrieveByQuery.count(), 1)
Exemple #4
0
    def testConfirmationModeQueryNeither(self):
        (user, dummySection, dummyPredModeMap) = self.setupClientTest()
        retrieveByQuery = get_database.get_section_db().find(
            common.getConfirmationModeQuery(1))
        self.assertEqual(retrieveByQuery.count(), 0)

        retrieveByQuery = get_database.get_section_db().find(
            common.getConfirmationModeQuery(4))
        self.assertEqual(retrieveByQuery.count(), 0)
  def testConfirmationModeQueryManualNotAuto(self):
    (user, dummySection, dummyPredModeMap) = self.setupClientTest()
    get_database.get_section_db().update({'_id': dummySection['_id']}, {'$set': {'confirmed_mode': 4}})

    retrieveByQuery = get_database.get_section_db().find(common.getConfirmationModeQuery(1))
    self.assertEqual(retrieveByQuery.count(), 0)

    retrieveByQuery = get_database.get_section_db().find(common.getConfirmationModeQuery(4))
    self.assertEqual(retrieveByQuery.count(), 1)
Exemple #6
0
    def testConfirmationModeQueryManualNotAuto(self):
        (user, dummySection, dummyPredModeMap) = self.setupClientTest()
        get_database.get_section_db().update({'_id': dummySection['_id']},
                                             {'$set': {
                                                 'confirmed_mode': 4
                                             }})

        retrieveByQuery = get_database.get_section_db().find(
            common.getConfirmationModeQuery(1))
        self.assertEqual(retrieveByQuery.count(), 0)

        retrieveByQuery = get_database.get_section_db().find(
            common.getConfirmationModeQuery(4))
        self.assertEqual(retrieveByQuery.count(), 1)