Commit 47902d22 authored by aha's avatar aha

om后台登陆

parent 2ded200d
import path_setting
from in_common.base_request import BaseRequest
class login_request(BaseRequest):
def __init__(self):
#om后台-登录
self.data = self.api_load(path_setting.OMLOGIN_CONFIG)
#om后台-登录
def om_login(self, username, password, Cookie='session_key=b3owiduporwyatpueme46orsofkfgwjv'):
self.params["username"] = username
self.params["password"] = password
return self.api_send(self.data["om_login"])
if __name__ == '__main__':
print(login_request().om_login("admin", "123123"))
\ No newline at end of file
#om后台-登录
om_login:
method : POST
url : /achelous/account/login
params: {}
data :
username: ${username}
password: ${password}
json : {}
...@@ -376,5 +376,10 @@ ALIPAYDATA = os.path.join(BASE_DIR, "backend_auto/test_backend_data/pay_data", " ...@@ -376,5 +376,10 @@ ALIPAYDATA = os.path.join(BASE_DIR, "backend_auto/test_backend_data/pay_data", "
JUMPDATA = os.path.join(BASE_DIR, "backend_auto/test_backend_data/pay_data", "jump.yaml") JUMPDATA = os.path.join(BASE_DIR, "backend_auto/test_backend_data/pay_data", "jump.yaml")
SETTLEMENTDELETE = os.path.join(BASE_DIR, "backend_auto/test_backend_data/settlement_data", "settlement_delete.yaml") SETTLEMENTDELETE = os.path.join(BASE_DIR, "backend_auto/test_backend_data/settlement_data", "settlement_delete.yaml")
#OM后台-登录
OMLOGIN_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_om_api", "login_request.yaml")
OMLOGIN = os.path.join(BASE_DIR, "backend_auto/test_om_data/om_login_data", "om_login.yaml")
if __name__ == '__main__': if __name__ == '__main__':
print("==========",LIVEYAML_CONFIG) print("==========",LIVEYAML_CONFIG)
import pytest
import path_setting
from all_om_api.login_request import login_request
from ids_list import get_ids
from in_common.base_request import BaseRequest
#om后台-登录
class TestOmLogin:
data = BaseRequest().api_load(path_setting.OMLOGIN)
om_login_case, om_login_data = get_ids(data, "om_login")
@pytest.mark.parametrize("param",om_login_data,ids=om_login_case)
def test_om_login(self,param):
r = login_request().om_login(param["username"], param["password"])
if r["code"] == 0:
print("om后台成功登陆")
assert r["msg"] == param["assert"]
if r["code"] != 0:
print("om后台登陆出错")
assert r["msg"] == param["assert"]
\ No newline at end of file
om_login:
#om后台-登录-输入正确的用户名和正确的密码
-
case : "om后台-登录-输入正确的用户名和密码"
username : "admin"
password : "123123"
assert: success!
#om后台-登录-输入正确的用户名和错误的密码
-
case : "om后台-登录-输入正确的用户名和错误的密码"
username : "admin"
password : "1231234"
assert: Login failed!
#om后台-登录-输入正确的用户名和不输入密码
-
case : "om后台-登录-输入正确的用户名和不输入密码"
username : "admin"
password : ""
assert: Login failed!
#om后台-登录-输入正确的用户名和无效密码
-
case : "om后台-登录-输入正确的用户名和无效密码"
username : "admin"
password : "哈哈"
assert: Login failed!
#om后台-登录-输入错误的用户名和正确的密码
-
case : "om后台-登录-输入错误的用户名和正确的密码"
username : "admin1"
password : "123123"
assert: Login failed!
#om后台-登录-不输入用户名和输入正确的密码
-
case : "om后台-登录-不输入用户名和输入正确的密码"
username : ""
password : "123123"
assert: Login failed!
#om后台-登录-输入无效用户名和正确的密码
-
case : "om后台-登录-输入无效用户名和正确的密码"
username : "哈哈"
password : "123123"
assert: Login failed!
#om后台-登录-输入错误的用户名和输入错误的密码
-
case : "om后台-登录-输入错误的用户名和输入错误的密码"
username : "admin1"
password : "1231234"
assert: Login failed!
#om后台-登录-不输入用户名和密码
-
case : "om后台-登录-不输入用户名和密码"
username : ""
password : ""
assert: Login failed!
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment