import requests
import unittest
from assert_page import assert_method
import assert_page
from interface import interface
from requests.cookies import cookiejar_from_dict
from pprint import pprint

class Case(unittest.TestCase):


    def test_01(self):
        '转诊策略派单召回数据校验'
        host = interface.host
        url = interface.recommend_hospitals
        URL = host+url
        body = {
            # "csrfmiddlewaretoken": "zouDYgAdEXBpk14W7SSk6UQMnxbJa3IQFKnfBtPOHG89s3bqZhYmb6ntKrmcpQZ0",
            "city_id": "beijing",
            "bdtransfer_id": 115792,
            "size": 6,
            "accept_near_city": 1

        }
        cookies = {"session_key": "nobskse0lscrgyj1iw3294h9lt0dbp7m"}
        result = requests.post(url=URL, cookies=cookiejar_from_dict(cookies), data=body, verify=False)
        assert_method.status_code(result)
        res = result.json()
        pprint(res)
        res = res.get("data")
        resl = len(res)
        assert resl == 6,"转诊策略派单数据不足6条 获取到：%s" %resl