1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import json
import pytest
from unify_api.tests.constants_t import post_request, get_request
# 根据sid pid返回参数
class TestSidToParams(object):
url = "/unify-api/zhiwei-u/data-operations/sid-to-params"
@pytest.mark.parametrize('data', [
{"pid": 21}, {"sid": "A1904000109"}, {"pid": 21, "sid": "A1904000109"}
])
@pytest.mark.asyncio
async def test_sid_to_params(self, data):
resp_str, status = await post_request(self.url, data)
assert status == 200
resp_dict = json.loads(resp_str)
assert isinstance(resp_dict["data"]["data"], dict)
# 根据mtid 返回基本信息
class TestMtidToInfo(object):
url = "/unify-api/zhiwei-u/data-operations/mtid-to-info"
@pytest.mark.parametrize('data', [
{"mtid": 18}
])
@pytest.mark.asyncio
async def test_mtid_to_info(self, data):
resp_str, status = await post_request(self.url, data)
assert status == 200
resp_dict = json.loads(resp_str)
assert isinstance(resp_dict["data"], dict)
@pytest.mark.parametrize('data', [
{"mtid": 0}, {"mtid": 10000}
])
@pytest.mark.asyncio
async def test_mtid_to_info_error(self, data):
resp_str, status = await post_request(self.url, data)
assert status == 200
resp_dict = json.loads(resp_str)
assert resp_dict["data"]["success"] == 0