Ejemplo n.º 1
0
    def test_02_get_title_img(self):
        url = self.URL + "/get_title_img"
        res = requests.get(url)
        assert res.status_code == 200 and res.json()["status"] == 200

        id = res.json()["data"][0]["id"]
        sql = "select * from t_title_img where id={}".format(id)
        assert len(chaxun(sql)) != 0
Ejemplo n.º 2
0
def test_01_lbt():
    url = "http://122.51.58.214:2333/get_title_img?num=3"
    res = requests.get(url)

    assert res.status_code == 200 and res.json()["status"] == 200

    id = res.json()["data"][0]["id"]
    sql = "select * from t_title_img where id ={}".format(id)
    assert len(chaxun(sql)) != 0
Ejemplo n.º 3
0
    def test_02_get_title_img(self):
        # 参数页码 一页最多10条数据,如果不传,默认返回3条
        pagenum1 = 1
        url = self.URL + "/getcoures?pagenum=" + pagenum1
        res = requests.get(url)
        assert res.status_code == 200 and res.json()["status"] == 200

        id = res.json()["data"]["contentlist"][0]["id"]
        sql = "select * from t_coures where id={}".format(id)
        assert len(chaxun(sql)) != 0
Ejemplo n.º 4
0
def test_01_login():
    """
        登录成功的测试用例 
    """
    u = "http://122.51.58.214:2333/login"
    d = {"username": "******", "password": "******"}
    res = requests.post(url=u, json=d)

    assert res.status_code == 200
    assert res.json()["status"] == 200

    sql = "select * from t_user where username ='******'".format(d.get("username"))
    assert len(chaxun(sql)) != 0

    save(res)
Ejemplo n.º 5
0
    def test_01_login(self):
        """
            这是登录方法
        """
        url = self.URL+"/login"
        data = {"username":"******", "password":"******"}
        res = requests.post(url=url , json=data)
        assert res.status_code == 200 and res.json()["status"] == 200
        
        
        sql = "select * from t_user where username = '******'".format(data.get("username"))
        assert len(chaxun(sql)) != 0

        # 保存token,不保存token
        save(res)
Ejemplo n.º 6
0
    def test_01_login(self):
        #print("hello test!")
        d = {"username":"******", "password":"******"}
        res = requests.post(self.base_url, json=d)
        self.result = res.json()
        print(res.text)
        assert res.status_code ==200
        # assert res.json()["status"] ==200
        self.assertEqual(self.result['status'], 200)
        self.assertEqual(self.result['msg'], '登录成功!')
        token=self.result["data"]["token"]

        sql ="select * from t_user where username ='******'".format(d.get("username"))
        assert len(chaxun(sql))!= 0
        save(res)