def test_get_userId_sessionId_test(self, get_token_obj, get_UserId_SessionId_obj): print "Running test for getting user ID and session ID from CG Cloud..." token = actions.get_token_test( url=get_token_obj.url, client_id=get_token_obj.client_id, client_secret=get_token_obj.client_secret, grant_type=get_token_obj.grant_type, ret_type="header") res = actions.get_userId_sessionId_test( token, get_UserId_SessionId_obj.url, get_UserId_SessionId_obj.app_user_id, get_UserId_SessionId_obj.app_user_nick_name) print "Verifying the response with the expected output." assert res["error_code"] == get_UserId_SessionId_obj.error_code assert res["user"]["id"] == get_UserId_SessionId_obj.user_id assert len(res["user"]["session_id"]) == 32
def test_get_chatroom_list_test(self, get_token_obj, get_sessionID_obj, get_chatroom_list_test_obj): token = actions.get_token_test( url=get_token_obj.url, client_id=get_token_obj.client_id, client_secret=get_token_obj.client_secret, grant_type=get_token_obj.grant_type, ret_type="header") sessionId = actions.get_userId_sessionId_test( token, get_sessionID_obj.url, get_sessionID_obj.app_user_id)["user"]["session_id"] res = actions.get_chatroom_list_test( token, sessionId, get_chatroom_list_test_obj.url, get_chatroom_list_test_obj.chatroomInfo["live"], get_chatroom_list_test_obj.app_id, get_chatroom_list_test_obj.chatroomInfo["count"]) print "Verifying the response with the expected output." assert res["error_code"] == get_chatroom_list_test_obj.error_code
def create_user(): print "Testing API for create users..." app_user_id = request.form.get('app_user_id') token = request.form.get('token') token = eval(token) url_create_user = url + "/open/api/user/auth?" nickname = request.form.get('nickname') if not nickname: nickname = "Default" print "app_user_id: %s\ntoken: %s\nurl_create_user: %s" % ( app_user_id, token, url_create_user) try: response = actions.get_userId_sessionId_test(token, url_create_user, app_user_id, nickname) return str(response) except Exception, e: print str(e) return api_error_message