示例#1
0
            def test_modify_sueccss3(self,login_shili):
                '''
                前置条件
                    1.用户已登陆,如:test
                    2.name参数是当前用户的登陆用户
                步骤:
                    POST http://49.235.92.12:9000/api/v1/userinfo HTTP/1.1

                    Authorization: Token 6965a529fedca8cc89c8ec70b884c378045da82c
                    Content-Type: application/json
                    {"name": "test", "sex": "", "age": 20, "mail": "*****@*****.**"}

                预期结果:
                    {"message":"update some data!","code":0,"data":{"name":"test","sex":"","age":20,"mail":"*****@*****.**"}}
                :param login_shili:
                :return:
                '''
                step1xg()
                step3xg()

                shili=login_shili
                shili.login_test_info()
                s=shili.login_s()
                token=shili.login_token()

                shili1=modify_test(s,token)
                r=shili1.modify_test_info("test","")
                print(r.text)
                assert r.json()["data"]["sex"]==""
示例#2
0
        def test_modify_success(self,login_shili):
            '''
            前置条件
                1.用户已登陆,如:test
                2.name参数与登陆用户参数不一致,如test2
            步骤:
                POST http://49.235.92.12:9000/api/v1/userinfo HTTP/1.1

                Authorization: Token 6965a529fedca8cc89c8ec70b884c378045da82c
                Content-Type: application/json
                {"name": "test", "sex": "M", "age": 20, "mail": "*****@*****.**"}
            预期结果:
                {"message":"无权限操作","code":4000,"data":[]}
            :param login_shili:
            :return:
            '''
            step1xg()
            step2_1_2xg()

            shili=login_shili
            shili.login_test_info()
            s=shili.login_s()
            token=shili.login_token()

            shili1=modify_test(s,token)
            r=shili1.modify_test_info("test1")
            print(r.text)
            assert r.json()["message"]=="无权限操作"