예제 #1
0
파일: mongo.py 프로젝트: zhaoyh1991/eve
 def test_get_value_from_query(self):
     mongo = Mongo(None)
     simple_query = {'_id': 'abcdef012345678901234567'}
     compound_query = {'$and': [
         {'username': {'$exists': False}},
         {'_id': 'abcdef012345678901234567'}
     ]}
     self.assertEqual(mongo.get_value_from_query(simple_query, '_id'),
                      'abcdef012345678901234567')
     self.assertEqual(mongo.get_value_from_query(compound_query, '_id'),
                      'abcdef012345678901234567')
예제 #2
0
파일: mongo.py 프로젝트: sunbit/eve
 def test_get_value_from_query(self):
     mongo = Mongo(None)
     simple_query = {"_id": "abcdef012345678901234567"}
     compound_query = {
         "$and": [
             {"username": {"$exists": False}},
             {"_id": "abcdef012345678901234567"},
         ]
     }
     self.assertEqual(
         mongo.get_value_from_query(simple_query, "_id"), "abcdef012345678901234567"
     )
     self.assertEqual(
         mongo.get_value_from_query(compound_query, "_id"),
         "abcdef012345678901234567",
     )
예제 #3
0
 def test_get_value_from_query(self):
     mongo = Mongo(None)
     simple_query = {"_id": "abcdef012345678901234567"}
     compound_query = {
         "$and": [
             {
                 "username": {
                     "$exists": False
                 }
             },
             {
                 "_id": "abcdef012345678901234567"
             },
         ]
     }
     self.assertEqual(mongo.get_value_from_query(simple_query, "_id"),
                      "abcdef012345678901234567")
     self.assertEqual(
         mongo.get_value_from_query(compound_query, "_id"),
         "abcdef012345678901234567",
     )