def create_socket(self): '''When a new session is created, insert in mongo if it doesnt already exist''' init = {"session": self.session, "data": ""} db = Mongo(0) data = db.find_insert(init) return data
def FindInsert(self): """Find and Insert record in MongoDB and check""" db = Mongo(0) db_insert = db.insert({ 'session': 'FindInsertTest', 'data': 'FindInsertTest Test data' }) db_findinsert = db.find_insert({ 'session': 'FindInsertTest', 'data': 'FindInsertTest Test data' }) return self.assertEqual('FindInsertTest', db_findinsert['data'])