Exemple #1
0
    def test_orders_create(self):
        """
        订单申请
        :return:
        """

        data = {
            "thirdOrderNo": 33,
            "serviceType": "CMonitor",
            "serviceSpecCode": "version_adv_pro",
            "duration": 36,
            "actionType": "UPGRADE",
            "userId": "23010268442624",
            "teamId": "23010268442627"
        }
        url = "https://{}/api/openapi/product/order/create".format(host)
        result = requests.post(url=url,
                               headers=self.header,
                               json=data,
                               verify=False)
        result_msg = result.json()['msg']

        status_code(result)
        print(result.json())
        return result.json(), url
Exemple #2
0
 def test_orders_status(self):
     """
         订单状态查询
         :return:
     """
     thirdOrderNo = 1
     url = "https://{}/api/openapi/product/order/{}/status".format(
         host, thirdOrderNo)
     result = requests.get(url=url, headers=self.header, verify=False)
     result_msg = result.json()['msg']
     assert result_msg == '操作成功', "接口请求出错,返回内容:%s" % (result_msg)
     status_code(result)
     return result.json()
Exemple #3
0
 def test_get_orders(self):
     """
     订单列表查询
     :return:
     """
     data = {"pageSize": 2, "pageNo": 1}
     url = "http://{}/api/openapi/product/orders".format(host)
     result = requests.get(url=url,
                           headers=self.header,
                           params=data,
                           verify=False)
     result_msg = result.json()['msg']
     assert result_msg == '操作成功', "接口请求出错,返回内容:%s" % (result_msg)
     status_code(result)
     return result.json()
Exemple #4
0
    def test_get_product(self):
        """
        实例列表查询
        :return:
        """

        data = {"serviceType": product_code, "teamId": "23010268442627"}
        url = "https://{}/api/openapi/product/services".format(host)
        result = requests.get(url=url,
                              headers=self.header,
                              params=data,
                              verify=False)
        result_msg = result.json()['msg']
        assert result_msg == '操作成功', "接口请求出错,返回内容:%s" % (result_msg)
        status_code(result)
        return result.json()
Exemple #5
0
 def test_product_services(self):
     """
     产品列表查询
     :return:
     """
     teamId = mysql_test.get_one(
         'SELECT *FROM team order by id desc limit 1')
     data = {"serviceType": product_code, "teamId": "23010268442627"}
     url = "https://{}/api/openapi/product/services".format(host)
     result = requests.get(url=url,
                           headers=self.header,
                           params=data,
                           verify=False)
     result_msg = result.json()['msg']
     assert result_msg == '操作成功', "接口请求出错,返回内容:%s" % (result_msg)
     status_code(result)
     return result.json()
Exemple #6
0
 def test_product_serviceinfo(self):
     """
     实例详情查询
     :return:
     """
     serviceId = 32
     teamId = mysql_test.get_one(
         'SELECT *FROM team order by id desc limit 1')
     data = {
         "accountId": 8,
     }
     url = "https://{}/api/openapi/product/service/{}".format(
         host, serviceId)
     result = requests.get(url=url, headers=self.header, verify=False)
     result_msg = result.json()['msg']
     status_code(result)
     assert result_msg == '操作成功', "接口请求出错,返回内容:%s" % (result_msg)
     return result.json()
Exemple #7
0
 def test_product_action(self):
     """
     实例操作
     :return:
     """
     serviceId = 36
     data = {
         "actionType": 0,
         "force": True,
     }
     url = "https://{}/api/openapi/product/service/{}/action".format(
         host, serviceId)
     result = requests.post(url=url,
                            headers=self.header,
                            json=data,
                            verify=False)
     result_msg = result.json()['msg']
     assert result_msg == '操作成功', "接口请求出错,返回内容:%s" % (result_msg)
     status_code(result)
     return result.json()
Exemple #8
0
    def test_user_login(self):
        """
        用户单点登陆
        :param : userId 用户id
        :return:
        成功登陆——>返回status_code,data
        失败登陆——>返回status_code,data(error_code,message)

        """
        data = {"userId": "21965490360320"}
        url = "https://{}/api/openapi/product/user/login".format(host)
        print(url)
        result = requests.post(url=url,
                               headers=self.header,
                               json=data,
                               verify=False)
        result_msg = result.json()['msg']
        assert result_msg == '操作成功', "接口请求出错,返回内容:%s" % (result_msg)
        status_code(result)
        return result.json()
Exemple #9
0
    def test_get_cloud(self):
        """
        查询私有云返回云账号及区域信息
        :return:
        """
        teamId = mysql_test.get_one(
            'SELECT *FROM team order by id desc limit 1')
        data = {"teamId": teamId, "serviceType": product_code}
        url = "https://{}/api/openapi/product/cloud/accounts".format(host)
        result = requests.get(url=url,
                              headers=self.header,
                              params=data,
                              verify=False)
        result_msg = result.json()['msg']

        result_data = result.json()['data']
        result_d = result_data[0]
        accountId = result_d['accountId']
        status_code(result)
        assert result_msg == '操作成功', "接口请求出错,返回内容:%s" % (result_msg)
        return accountId
Exemple #10
0
    def test_product_deploy(self):
        """
        实例部署
        :return:
        """
        thirdOrderNo = 6
        data = {
            "vpcId": "546a8fe928aa4f42a2232667757f0848",
            "cloudProvider": "ASTACK",
            "cloudAccId": "22537199169536",
            "regionId": "8"
        }

        url = "https://{}/api/openapi/product/order/{}/deploy".format(
            host, thirdOrderNo)
        result = requests.post(url=url,
                               headers=self.header,
                               json=data,
                               verify=False)
        result_msg = result.json()['msg']
        status_code(result)
        return result.json()
Exemple #11
0
    def test_user_create(self):
        """
        用户及团队创建
        :return:
        """
        data = {
            "account": random_data,
            "teamName": random_data,
            "teamCode": random_data
        }

        url = "https://{}/api/openapi/product/user/create".format(host)
        result = requests.post(url=url,
                               headers=self.header,
                               json=data,
                               verify=False)
        r_data = result.json()['data']
        teamId = r_data['teamId']
        userId = r_data['userId']
        result_msg = result.json()['msg']
        assert result_msg == '操作成功', "接口请求出错,返回内容:%s" % (result_msg)
        status_code(result)
        mysql_test.delete('DELETE from team where id = {}'.format(teamId))
        return teamId
Exemple #12
0
 def test_product_deploy_check(self):
     """
     实例部署校验
     :return:
     """
     thirdOrderNo = 2
     data = {
         "cloudProvider": "ASTACK",
         "cloudAccId": "22537199169536",
         "ips": [{
             "ip": "24.24.24.160",
             "mac": "fa:a1:de:10:fc:00"
         }]
     }
     url = "https://{}/api/openapi/product/order/{}/deploy/check".format(
         host, thirdOrderNo)
     result = requests.post(url=url,
                            headers=self.header,
                            params=data,
                            verify=False)
     result_msg = result.json()['msg']
     status_code(result)
     print(result.json(), url)
     return result.json(), url