def test_http_rpc_unseal_account(self): new_id, new_passwd = new_account() # 登陆成功 login_result = login(MMMDAHttpRpcClt, new_id, new_passwd) print "login_result,", login_result self.assertTrue(login_result['result'] == error_code.ERROR_SUCCESS) # 封号 seal_account_result = seal_account(MMMDAHttpRpcClt, admin0d_id, admin01_passwd, new_id) print "seal_account_result :%s, new_id:%s," % (seal_account_result, new_id) # 登陆失败 # login error on sealed account, 暂时测试是不开启封号的 self.assertRaises(Exception, login, MMMDAHttpRpcClt, new_id, new_passwd) # 解除封号 seal_account_result = unseal_account(MMMDAHttpRpcClt, admin0d_id, admin01_passwd, new_id) print "seal_account_result :%s, new_id:%s," % (seal_account_result, new_id) # 登陆成功 login_result = login(MMMDAHttpRpcClt, new_id, new_passwd) print "login_result,", login_result self.assertTrue(login_result['result'] == error_code.ERROR_SUCCESS)
def test_http_rpc_register_login_nomal(self): new_id = new_account_id() register_data = { "id": new_id, "passwd": "123456", "id_card": "test_id_card", "email": "test_email", "phone": "test_phone", "leader_id": "18888", "bank": "test_bank", "bank_address": "test_bank_add", "bank_account": "test_bank_act", "bank_name": "test_bank_name", "wechat": "test_wechat", "alipay": "test_alipay" } register_result = register(MMMDAHttpRpcClt, register_data) print "register_result,", register_result self.assertTrue(register_result['result'] == error_code.ERROR_SUCCESS) login_result = login(MMMDAHttpRpcClt, new_id, register_data['passwd']) print "login_result,", login_result self.assertTrue(login_result['result'] == error_code.ERROR_SUCCESS) access_token = login_result['access_token'] account_result = account(MMMDAHttpRpcClt, new_id, access_token, new_id, {"passwd": "account_change_passwd"}) print "account_result,", account_result self.assertTrue(account_result['result'] == error_code.ERROR_SUCCESS)
def test_http_rpc_reset_login_info_nomal(self): new_id, new_passwd = new_account() login_result = login(MMMDAHttpRpcClt, new_id, new_passwd) print "login_result,", login_result self.assertTrue(login_result['result'] == error_code.ERROR_SUCCESS) last_minutes = random.randint(1, 36000) login_count = login_info(MMMDAHttpRpcClt, admin0d_id, admin01_passwd, last_minutes) self.assertTrue(login_count > 0)
def test_http_rpc_change_passwd_nomal(self): new_id, new_passwd = new_account() new_token = new_access_token(new_id, new_passwd) # change passwd change_paswd = random_str() passwd_change(MMMDAHttpRpcClt, new_id, new_token, new_passwd, change_paswd) # login error on old passwd self.assertRaises(Exception, login, MMMDAHttpRpcClt, new_id, new_passwd) # login success on new passwd login_result = login(MMMDAHttpRpcClt, new_id, change_paswd) print "login_result,", login_result self.assertTrue(login_result['result'] == error_code.ERROR_SUCCESS)
def test_http_rpc_get_random_team_count_nomal(self): login_result = login(MMMDAHttpRpcClt, admin0d_id, admin01_passwd) print "login_result,", login_result print "team_count,", login_result['account_info']['team_count'] self.assertTrue(login_result['account_info']['team_count'])
def new_access_token(id, passwd): login_result = login(MMMDAHttpRpcClt, id, passwd) assert login_result['result'] == error_code.ERROR_SUCCESS return login_result['access_token']
from lib.common import * from utils.interfaces.mmm_da.http_rpc import register, login, active, add_match_coin from utils.service_control.setting import PT_HTTPS, PT_HTTP from utils import error_code import random admin0d_id = 18888 admin01_passwd = "!Admin01" MMMDAHttpRpcClt = ServiceMgrCacher().get_connection(ST_MMM_DA, protocol=PT_HTTPS) if not MMMDAHttpRpcClt: MMMDAHttpRpcClt = ServiceMgrCacher().get_connection(ST_MMM_DA, protocol=PT_HTTP) assert MMMDAHttpRpcClt login_result = login(MMMDAHttpRpcClt, admin0d_id, admin01_passwd) assert login_result['result'] == error_code.ERROR_SUCCESS admin01_access_token = login_result['access_token'] force_passwd = "!Admin01" def new_account_id(): return int(str(time.time()).replace('.', '')) def new_account(can_active=True): new_id = new_account_id() register_data = { "id": new_id,