def saveUserData(userDict): EMAIL = 'email' _ID = 'id' space = userDict["name"].find(" ") return addUser(userDict[_ID], userDict["name"][0:space], userDict["name"][space + 2::], userDict[EMAIL], userDict[EMAIL][0:userDict[EMAIL].find("@")])
def saveUserData(userDict): EMAIL = 'email' _ID = 'id' space = userDict["name"].find(" ") return addUser( userDict[_ID], userDict["name"][0:space], userDict["name"][space + 2::], userDict[EMAIL], userDict[EMAIL][0:userDict[EMAIL].find("@")])
def testaddUserById(self): collectionUsers.drop() result_id = addUser(TEST_ID, TEST_FIRSTNAME, TEST_LASTNAME, TEST_EMAIL, TEST_LOGIN) self.assertEqual(TEST_ID, result_id) user = collectionUsers.find_one({'_id': result_id}) self.assertEqual(TEST_ID, user.get('_id')) self.assertEqual(TEST_LOGIN, user.get('login')) self.assertEqual(TEST_EMAIL, user.get('email')) self.assertEqual(TEST_LASTNAME, user.get('last_name')) self.assertEqual(TEST_FIRSTNAME, user.get('first_name'))
def processGoogleData(data): EMAIL = 'email' _ID = 'id' FIRST_NAME = 'given_name' LAST_NAME = 'family_name' userDict = loads(data) return addUser( userDict[_ID], userDict[FIRST_NAME], userDict[LAST_NAME], userDict[EMAIL], userDict[EMAIL][0:userDict[EMAIL].find("@")])
def testaddUserById(self): collectionUsers.drop() result_id = addUser( TEST_ID, TEST_FIRSTNAME, TEST_LASTNAME, TEST_EMAIL, TEST_LOGIN) self.assertEqual(TEST_ID, result_id) user = collectionUsers.find_one({'_id': result_id}) self.assertEqual(TEST_ID, user.get('_id')) self.assertEqual(TEST_LOGIN, user.get('login')) self.assertEqual(TEST_EMAIL, user.get('email')) self.assertEqual(TEST_LASTNAME, user.get('last_name')) self.assertEqual(TEST_FIRSTNAME, user.get('first_name'))