def testAddPoints(self): db = getDbObject(DB) addPoints(DB, [TEST_POINT1, TEST_POINT2]) obj1 = db[COLLECTION].find_one({'channel_id': '3'}) obj2 = db[COLLECTION].find_one({'channel_id': '5'}) self.assertEqual(obj1['location']['coordinates'][0], 10) self.assertEqual(obj2['location']['coordinates'][0], 20)
def testAddPoints(self): db = getDbObject(DB) addPoints(DB, [TEST_POINT1, TEST_POINT2]) obj1 = db[COLLECTION].find_one({ 'channel_id': ObjectId(TEST_POINT1['channel_id'])}) obj2 = db[COLLECTION].find_one({ 'channel_id': ObjectId(TEST_POINT2['channel_id'])}) self.assertEqual(obj1['location']['coordinates'][0], 10) self.assertEqual(obj2['location']['coordinates'][0], 20)
def post(self, serviceName): try: poinList = PointListResourceParser.parsePostParameters() except ValueError: return {}, 400 result = addPoints(serviceName, poinList) return result
def post(self, serviceName): pointList = PointListResourceParser.parsePostParameters() result = addPoints(serviceName, pointList) return result