Exemplo n.º 1
0
def testSliceSimpleAsciiStlField():
    fields = [ ('stl', testtools.dataFile('trivial_ascii.stl')) ]
    response = testtools.postRequest(baseurl+'/slice', fields=fields)

    testtools.assertEqual(response.status_code, 200)
    r = response.read()
    lines = r.split('\n')
    assert len(lines) > 1000
    assert lines[0].startswith('M109 T0')
Exemplo n.º 2
0
def testMissingStl():
    files = []
    response = testtools.postRequest(baseurl+'/slice', files)

    testtools.assertEqual(response.status_code, 400)
    content_type = testtools.getHeader(response, 'content-type')
    testtools.assertEqual(content_type, 'application/json')
    res = json.loads(response.read())
    assert res['error']
    assert len(res['error']) > 10
Exemplo n.º 3
0
def testSliceInvalidStlFile():
    files = [ ('stl', 'invalid.stl', testtools.dataFile('invalid.stl')) ]
    response = testtools.postRequest(baseurl+'/slice', files)

    testtools.assertEqual(response.status_code, 400)
    content_type = testtools.getHeader(response, 'content-type')
    testtools.assertEqual(content_type, 'application/json')
    res = json.loads(response.read())
    assert res['error']
    assert len(res['error']) > 10
Exemplo n.º 4
0
def testPreviewSimpleAsciiStlField():
    fields = [ ('stl', testtools.dataFile('trivial_ascii.stl')) ]
    response = testtools.postRequest(baseurl+'/preview', fields=fields)

    testtools.assertEqual(response.status_code, 200)
    r = json.loads(response.read())
    assert r['gcode'].startswith('M109 T0')
    assert len(r['polygons']) == 198
    assert r['polygons'][0].keys() == [u'openoutline', u'inset0', u'skirt', u'insetx', u'skin']
    assert r['filamentUse'] == '0.48 meter 4 gram'
    assert r['printTime'] == '28 minutes'
Exemplo n.º 5
0
def checkExpect(case, resp):
    checkStatusExpect(case, resp)

    if case.expBody is not None:
        utils.assertEqual(case.expBody, resp['body'])
    if case.expBodyHaves is not None:
        for i in case.expBodyHaves:
            if i is not None and len(i.strip()) != 0:
                utils.assertContain(i, resp['body'])
            else:
                # 忽略为空的期望值
                pass
Exemplo n.º 6
0
    def putAccountICD(self):
        try:
            passed = False
            randID = 'MyAmazon'
            randID += str(x)
            print(randID)
            url = utils.decodeCredential(icd_url)
            username = utils.decodeCredential(icd_username)
            password = utils.decodeCredential(icd_password)

            id1 = "f16b0f4a-a76e-499e-b5f7-testautomationicd"
            resp, body = self.api_client.get_AccountById(id1)
            data = json.dumps(body)
            data = json.loads(data)

            body = {
                "account": {
                    "basicInfo": {
                        "accountName": data["basicInfo"]["accountName"],
                        "serviceProviderType": "icd",
                        "isActive": "Active",
                        "accountType": "master",
                        "userType": "billing",
                        "serviceProviderCode": "icd",
                        "credential_count": 1
                    },
                    "advancedInfo": {
                        "url": url
                    },
                    "credentials": [{
                        "credentialName": "jaslkdjflkj",
                        "purpose": ["costIngestion"],
                        "status": "Active",
                        "context": [{
                            "team": ["CORE-X"]
                        }],
                        "passwordFields": {
                            "username": username,
                            "password": password
                        }
                    }],
                    "accountId":
                    "f16b0f4a-a76e-499e-b5f7-testautomationicd"
                }
            }
            resp, body = self.api_client.update_account(body, id1)
            print(resp)
            logger.info("API response:" + str(resp))
            passOfResponseCode = assertEqual(resp, 200)
            if (passOfResponseCode):
                passed = True
            status['CAM-APITest'] = passed
            return passed
        except:
            status['CAM-APITest'] = False
            return False
 def delete_serviceProviderMetadata_test(self):
     passed = False
     resp, body = self.api_client.delete_serviceProviderMetadata("testcoreauto")
     print resp
     logger.info("API response:" + str(resp))
     passOfResponseCode = assertEqual(resp, 204)
     if (passOfResponseCode):
         passed = True
     status['CAM-APITest'] = passed
     return passed
 def CORE2273_populateAdvancedSearchScreenWrongData(self):
     passed = False
     resp, body = self.api_client.populateAdvancedSearchScreen('messageWrong')
     print (resp)
     logger.info("API response:" + str(resp))
     passOfResponseCode = assertEqual(resp, 404)
     if (passOfResponseCode):
         passed = True
     status['CAM-APITest'] = passed
     return passed
Exemplo n.º 9
0
 def Request_methods_get_request(self):
     passed = False
     resp, body = self.test_client.get_data()
     print(resp)
     logger.info("API response:" + str(resp))
     passOfResponseCode = assertEqual(resp, 200)
     if passOfResponseCode:
         passed = True
     status['Requestmethods-APITest'] = passed
     return passed
Exemplo n.º 10
0
    def get_rule_failure(self):
        '''
        Failure case for get Rule
        '''
        passed = False
        randID = 'TestRuleAPI'
        randID += str(x)
        print(randID)

        resp, body = self.api_client.get_rule_by_id("ruleId")
        print(resp)
        #print body
        logger.info("API response:" + str(resp))
        passOfResponseCode = (assertEqual(resp, 404) & assertEqual(
            body, self.testdatajson["invalid_get_rule"]))
        if (passOfResponseCode):
            passed = True
        status['CAM-APITest'] = passed
        return passed
Exemplo n.º 11
0
 def CORE1909_paginationWithInValidLimitAndInValidPage(self):
     passed = False
     resp, body = self.api_client.paginationWithLimitAndPage(-10, -1)
     print(resp)
     logger.info("API response:" + str(resp))
     passOfResponseCode = assertEqual(resp, 400)
     if (passOfResponseCode):
         passed = True
     status['CAM-APITest'] = passed
     return passed
    def putAccountAzureAsset(self):
        passed = False
        randID = 'TestAzureNew'
        randID += str(x)
        print(randID)

        subscriptionID = utils.decodeCredential(azure_subscriptionID)
        offerID = utils.decodeCredential(azure_offerID)
        tenantID = utils.decodeCredential(azure_tenantID)

        id1 = "f16b0f4a-a76e-499e-b5f7-testautomationazureasset"
        resp, body = self.api_client.get_AccountById(id1)
        data = json.dumps(body)
        data = json.loads(data)

        body = {
            "account": {
                "basicInfo": {
                    "accountName": data["basicInfo"]["accountName"],
                    "serviceProviderType": "azure",
                    "isActive": "Active",
                    "accountType": "subaccount",
                    "userType": "asset",
                    "serviceProviderCode": "azure",
                    "credential_count": 1
                },
                "advancedInfo": {
                    "subscriptionID": subscriptionID,
                    "offerID": offerID,
                    "tenantID": tenantID
                },
                "credentials": [{
                    "credentialName": "asdfadsf",
                    "purpose": ["provisioning"],
                    "status": "Active",
                    "context": [{
                        "team": ["CORE-X"]
                    }],
                    "crefId": azurecredRef_asset,
                }],
                "accountId":
                "f16b0f4a-a76e-499e-b5f7-testautomationazureasset"
            }
        }
        resp, body = self.api_client.update_account(body, id1)
        print(resp)
        logger.info("API response:" + str(resp))
        passOfResponseCode = assertEqual(resp, 200)
        if (passOfResponseCode):
            passed = True
            status['CAM-APITest'] = passed
            return passed
        else:
            status['CAM-APITest'] = False
            return False
    def put_serviceProviderMetadata_test(self):
        passed = False
        body = {
            "providerType": "testcoreauto",
            "displayName": "testcoreauto",
            "iconImage": "path of icon for this provider",
            "canSupportSubAccounts": "true",
            "canDiscoverSubAccounts": "true",
            "canDetachSubAccounts": "false",
            "canDoTestConnection": "false",
            "version": 1,
            "accountMetadata": {
                "dummyField1": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 25,
                    "canUpdate": "true",
                    "regex": "",
                    "displayLabel": "dummy field",
                    "helpText": "dummy field",
                    "appliesTo": [
                        {
                            "accountType": "billing",
                            "isRequired": "false"
                        },
                        {
                            "accountType": "asset",
                            "isRequired": "false"
                        }
                    ]
                }
            },
            "credentialMetadata": {
                "provisioning": {
                    "dummyfield2": {
                        "type": "password",
                        "canUpdate": "true",
                        "minLength": 8,
                        "maxLength": 20,
                        "isRequired": "true",
                        "displayLabel": "dummyfield2",
                        "helpText": "dummyfield2"
                    }
                }
            }
        };

        resp, body = self.api_client.update_serviceProviderMetadata(body, "testcoreauto")
        print resp
        logger.info("API response:" + str(resp))
        passOfResponseCode = assertEqual(resp, 200)
        if (passOfResponseCode):
            passed = True
        status['CAM-APITest'] = passed
        return passed
Exemplo n.º 14
0
    def putAccountSnowSystem(self):
        passed = False
        randID = 'MyAmazon'
        randID += str(x)
        print(randID)
        version = utils.decodeCredential(snow_username)
        url = utils.decodeCredential(snow_password)
        userName = utils.decodeCredential(snow_version)
        password = utils.decodeCredential(snow_url)

        id1 = "f16b0f4a-a76e-499e-b5f7-testautomationsnowsystemNewV"
        resp, body = self.api_client.get_AccountById(id1)
        data = json.dumps(body)
        data = json.loads(data)

        body = {
            "account": {
                "basicInfo": {
                    "accountName": data["basicInfo"]["accountName"],
                    "accountType": "master",
                    "isActive": "Active",
                    "userType": "system",
                    "serviceProviderCode": "snow",
                    "serviceProviderType": "snow",
                    "credential_count": 1
                },
                "advancedInfo": {
                    "version": version,
                    "url": url
                },
                "credentials": [{
                    "credentialName": "kjkkkjk",
                    "purpose": ["systemIntegration"],
                    "passwordFields": {
                        "userName": userName,
                        "url": url,
                        "password": password
                    },
                    "context": [{
                        "team": ["CORE-X"]
                    }],
                    "status": "Active"
                }],
                "accountId":
                "f16b0f4a-a76e-499e-b5f7-testautomationsnowsystemNewV"
            }
        }
        resp, body = self.api_client.update_account(body, id1)
        print(resp)
        logger.info("API response:" + str(resp))
        passOfResponseCode = assertEqual(resp, 200)
        if (passOfResponseCode):
            passed = True
        status['CAM-APITest'] = passed
        return passed
Exemplo n.º 15
0
    def patch_rule_status_failure(self):
        '''
        Failure case for patch Rule status with wrong Rule Id
        '''
        passed = False
        randID = 'TestRuleAPI'
        randID += str(x)
        print(randID)

        body = self.testdatajson["rule_status_enable"]
        resp, body = self.api_client.patch_rule_status(body, "ruleId")
        print(resp)
        #print body

        passOfResponseCode = (assertEqual(resp, 404) & assertEqual(
            body, self.testdatajson["rule_patch_fail"]))
        if (passOfResponseCode):
            passed = True
        status['CAM-APITest'] = passed
        return passed
Exemplo n.º 16
0
    def delete_rule_failure(self):
        '''
        Fail case for deleting new Rule
        '''
        passed = False
        randID = 'TestRuleAPI'
        randID += str(x)
        print(randID)
        body = self.testdatajson["new_rule"]

        #print body
        resp, body = self.api_client.delete_rule_by_id("ruleId")
        print(resp)
        #print body
        passOfResponseCode = (assertEqual(resp, 404) & assertEqual(
            body, self.testdatajson["delete_rule_fail"]))
        if (passOfResponseCode):
            passed = True
        status['CAM-APITest'] = passed
        return passed
Exemplo n.º 17
0
    def postAccountAWS(self):
        passed = False
        randID = 'TestAWSAc'
        randID += str(x)
        print (randID)

        s3Bucket=utils.decodeCredential(aws_s3Bucket)

        body = {
            "account": {
                "basicInfo": {
                    "accountName": randID,
                    "accountType": "master",
                    "isActive": "Active",
                    "userType": "billing",
                    "serviceProviderType": "amazon",
                    "serviceProviderCode": "amazon",
                    "credential_count": 1
                },
                "advancedInfo": {
                    "accountNumber": "098098908098098",
                    "s3Bucket": s3Bucket
                },
                "credentials": [
                    {
                        "credentialName": "hjhkjh",
                        "purpose": [
                            "costIngestion"
                        ],
                        "status":"Active",
                        "crefId": crefId_amazon,
                        "context": [
                                {
                                    "team": [
                                        "CORE-X"
                                    ]
                                }
                            ]
                    }
                ],
                "accountId": "123f16b0f4a-a76e-499e-b5f7-testautomationawsbilllingAccount"
            }
        };

        #print body
        resp, body = self.api_client.create_account(body)
        print (resp)
        #print body
        logger.info("API response:" + str(resp))
        passOfResponseCode = assertEqual(resp, 200)
        if (passOfResponseCode):
            passed = True
        status['CAM-APITest'] = passed
        return passed
Exemplo n.º 18
0
    def test_get_val_res_by_id_failure(self):
        '''
        Failure case for get validation result by id
        '''
        passed = False
        randID = 'TestValidationResultGetAPI-'
        randID += str(x)
        print(randID)

        resp, body = self.api_client.get_validation_result_by_id("wrongId")
        print(resp)
        #print body

        logger.info("API response:" + str(resp))
        passOfResponseCode = (assertEqual(resp, 404) & assertEqual(
            body, self.testdatajson["invalid_get_val_res_by_id"]))
        if (passOfResponseCode):
            passed = True
        status['CAM-APITest'] = passed
        return passed
Exemplo n.º 19
0
    def postAccountSnowAsset(self):
        passed = False
        randID = 'TestSnowAssetAc'
        randID += str(x)
        print(randID)
        # print metadata[0]

        version = utils.decodeCredential(snow_username)
        url = utils.decodeCredential(snow_password)
        userName = utils.decodeCredential(snow_version)
        password = utils.decodeCredential(snow_url)

        body = {
            "account": {
                "basicInfo": {
                    "accountName": randID,
                    "serviceProviderType": "snow",
                    "isActive": "Active",
                    "accountType": "subaccount",
                    "userType": "asset",
                    "serviceProviderCode": "snow",
                    "credential_count": 1
                },
                "advancedInfo": {
                    "version": version,
                    "url": url
                },
                "credentials": [{
                    "credentialName": "lkjalksdfjlkj",
                    "purpose": ["provisioning"],
                    "status": "Active",
                    "context": [{
                        "team": ["CORE-X"]
                    }],
                    "passwordFields": {
                        "userName": userName,
                        "password": password
                    }
                }],
                "accountId":
                "f16b0f4a-a76e-499e-b5f7-testautomationsnowasset"
            }
        }

        #print body
        resp, body = self.api_client.create_account(body)
        print(resp)
        #print body
        logger.info("API response:" + str(resp))
        passOfResponseCode = assertEqual(resp, 200)
        if (passOfResponseCode):
            passed = True
        status['CAM-APITest'] = passed
        return passed
    def postAccountSnow(self):
        try:
            passed = False
            randID = 'TestSnowAc'
            randID += str(x)
            print(randID)

            version = utils.decodeCredential(snow_version)
            url = utils.decodeCredential(snow_url)

            body = {
                "account": {
                    "basicInfo": {
                        "accountName": randID,
                        "accountType": "master",
                        "isActive": "Active",
                        "userType": "billing",
                        "serviceProviderCode": "snow",
                        "serviceProviderType": "snow"
                    },
                    "advancedInfo": {
                        "version": version,
                        "url": url
                    },
                    "credentials": [{
                        "credentialName": "kjkkkjk",
                        "purpose": ["costIngestion"],
                        "crefId": snowcredRef_billing,
                        "context": [{
                            "team": ["CORE-X"]
                        }],
                        "status": "Active"
                    }],
                    "accountId":
                    "f16b0f4a-a76e-499e-b5f7-testautomationsnowNewV"
                }
            }

            #print body
            resp, body = self.api_client.create_account(body)
            print(resp)
            #print body
            logger.info("API response:" + str(resp))
            passOfResponseCode = assertEqual(resp, 200)
            if (passOfResponseCode):
                passed = True
                status['CAM-APITest'] = passed
                return passed
            else:
                status['CAM-APITest'] = False
                return False
        except:
            status['CAM-APITest'] = False
            return False
Exemplo n.º 21
0
    def Request_methods_post_raw_data(self):
        passed = False
        body = "Duis posuere augue vel cursus pharetra. In luctus a ex nec pretium. Praesent neque quam, tincidunt"

        resp, body = self.test_client.post_raw_data(body)
        print(resp)
        logger.info("API response:" + str(resp))
        passOfResponseCode = assertEqual(resp, 200)
        if passOfResponseCode:
            passed = True
        status['Requestmethods-APITest'] = passed
        return passed
Exemplo n.º 22
0
    def add_rule_failure(self):
        '''
        Failure case for adding new Rule
        '''
        passed = False
        randID = 'TestRuleAPI'
        randID += str(x)
        print(randID)
        body = self.testdatajson["invalid_rule_payload"]

        #print body
        resp, body = self.api_client.add_rule(body)
        print(resp)
        #print body
        logger.info("API response:" + str(resp))
        passOfResponseCode = (assertEqual(resp, 400) & assertEqual(
            body, self.testdatajson["invalid_rule_resp"]))
        if (passOfResponseCode):
            passed = True
        status['CAM-APITest'] = passed
        return passed
Exemplo n.º 23
0
    def Request_methods_delete_data(self):
        passed = False
        body = "Test"

        resp, body = self.test_client.delete_with_body(body)
        print(resp)
        logger.info("API response:" + str(resp))
        passOfResponseCode = assertEqual(resp, 200)
        if passOfResponseCode:
            passed = True
        status['Requestmethods-APITest'] = passed
        return passed
    def putAccountIBMAsset(self):
        try:
            passed = False
            randID = 'TestIBMAssetAc'
            randID += str(x)
            print(randID)
            id1 = "f16b0f4a-a76e-499e-b5f7-testautomationibmasset"
            resp, body = self.api_client.get_AccountById(id1)
            data = json.dumps(body)
            data = json.loads(data)

            body = {
                "account": {
                    "basicInfo": {
                        "accountName": data["basicInfo"]["accountName"],
                        "serviceProviderType": "ibm",
                        "isActive": "Active",
                        "accountType": "subaccount",
                        "userType": "asset",
                        "serviceProviderCode": "softlayer",
                        "credential_count": 1
                    },
                    "advancedInfo": {
                        "accountNumber": "klajdsflkj"
                    },
                    "credentials": [{
                        "credentialName": "kjahdslkj",
                        "purpose": ["provisioning"],
                        "status": "Active",
                        "context": [{
                            "team": ["CORE-X"]
                        }],
                        "crefId": ibmcredRef
                    }],
                    "accountId":
                    "f16b0f4a-a76e-499e-b5f7-testautomationibmasset"
                }
            }

            resp, body = self.api_client.update_account(body, id1)
            print(resp)
            logger.info("API response:" + str(resp))
            passOfResponseCode = assertEqual(resp, 200)
            if (passOfResponseCode):
                passed = True
                status['CAM-APITest'] = passed
                return passed
            else:
                status['CAM-APITest'] = False
                return False
        except:
            status['CAM-APITest'] = False
            return False
Exemplo n.º 25
0
    def postAccountICD(self):
        passed = False
        randID = 'TestICDAc'
        randID += str(x)
        print (randID)

        url=utils.decodeCredential(icd_url)

        body = {
            "account": {
                "basicInfo": {
                        "accountName": "testDataAccountforICDNewAccountViz",
                        "serviceProviderType": "icd",
                        "isActive": "Active",
                        "accountType": "master",
                        "userType": "system",
                        "serviceProviderCode": "icd",
                        "credential_count": 1
                },
                "advancedInfo": {
                    "url": url
                },
                "credentials": [
                    {
                        "credentialName": "fasdf",
                        "purpose": [
                            "systemIntegration"
                        ],
                        "status": "Active",
                        "context": [
                                {
                                    "team": [
                                        "CORE-X"
                                    ]
                                }
                            ],
                         "crefId":crefId_icd
                    }
                ],
                "accountId": "123f16b0f4a-a76e-499e-b5f7-testautomationicdviz12211AccountViz"
            }
        };

        #print body
        resp, body = self.api_client.create_account(body)
        print (resp)
        #print body
        logger.info("API response:" + str(resp))
        passOfResponseCode = assertEqual(resp, 200)
        if (passOfResponseCode):
            passed = True
        status['CAM-APITest'] = passed
        return passed
Exemplo n.º 26
0
 def AMAZON_Order_History_instances(self):
     global service_id
     passed = False
     url = order_historyURL + "/" + service_id
     resp, body = self.api_client.get_greenfiled_services(url)
     print(resp)
     logger.info("API response:" + str(resp))
     passOfResponseCode = assertEqual(resp, 200)
     if (passOfResponseCode):
         passed = True
     status['CAM-APITest'] = passed
     return passed
Exemplo n.º 27
0
 def Authorised_basicauth_get_request(self):
     passed = False
     username = "******"
     password = "******"
     resp, body = self.test_client.get_basic_auth(username, password)
     print(resp)
     logger.info("API response:" + str(resp))
     passOfResponseCode = assertEqual(resp, 200)
     if passOfResponseCode:
         passed = True
     status['auth-APITest'] = passed
     return passed
Exemplo n.º 28
0
 def Authorised_hawkauth_get_request(self):
     passed = False
     hawk_id = "dh37fgj492je"
     hawk_key = "werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn"
     resp, body = self.test_client.get_hawk_auth(hawk_id, hawk_key)
     print(resp)
     logger.info("API response:" + str(resp))
     passOfResponseCode = assertEqual(resp, 200)
     if passOfResponseCode:
         passed = True
     status['auth-APITest'] = passed
     return passed
Exemplo n.º 29
0
    def Request_methods_post_url_encoded(self):
        passed = False
        body = {"strange": "boom"}

        resp, body = self.test_client.post_urlencoded_data(body)
        print(resp)
        logger.info("API response:" + str(resp))
        passOfResponseCode = assertEqual(resp, 200)
        if passOfResponseCode:
            passed = True
        status['Requestmethods-APITest'] = passed
        return passed
    def postAccountIBM(self):
        try:
            passed = False
            randID = 'IBMAccountTest'
            randID += str(x)
            print(randID)
            # print metadata[0]

            body = {
                "account": {
                    "basicInfo": {
                        "accountName": randID,
                        "accountType": "master",
                        "isActive": "Active",
                        "userType": "billing",
                        "serviceProviderCode": "softlayer",
                        "serviceProviderType": "ibm",
                        "credential_count": 1
                    },
                    "advancedInfo": {
                        "accountNumber": "456435"
                    },
                    "credentials": [{
                        "credentialName": "credpp",
                        "purpose": ["costIngestion"],
                        "crefId": ibmcredRef,
                        "context": [{
                            "team": ["CORE-X"]
                        }],
                        "status": "Active"
                    }],
                    "accountId":
                    "f16b0f4a-a76e-499e-b5f7-IBMAccountTest"
                }
            }

            ##print body
            resp, body = self.api_client.create_account(body)
            print(resp)
            ##print body
            logger.info("API response:" + str(resp))
            passOfResponseCode = assertEqual(resp, 200)
            if (passOfResponseCode):
                passed = True
                status['CAM-APITest'] = passed
                return passed
            else:
                status['CAM-APITest'] = False
                return False
        except:
            status['CAM-APITest'] = False
            return False
    def putAccountSnowAsset(self):
        passed = False
        randID = 'MyAmazon'
        randID += str(x)
        print(randID)

        version = utils.decodeCredential(snow_version)
        url = utils.decodeCredential(snow_url)

        id1 = "f16b0f4a-a76e-499e-b5f7-testautomationsnowasset"
        resp, body = self.api_client.get_AccountById(id1)
        data = json.dumps(body)
        data = json.loads(data)

        body = {
            "account": {
                "basicInfo": {
                    "accountName": data["basicInfo"]["accountName"],
                    "serviceProviderType": "snow",
                    "isActive": "Active",
                    "accountType": "subaccount",
                    "userType": "asset",
                    "serviceProviderCode": "snow"
                },
                "advancedInfo": {
                    "version": version,
                    "url": url
                },
                "credentials": [{
                    "credentialName": "lkjalksdfjlkj",
                    "purpose": ["provisioning"],
                    "status": "Active",
                    "context": [{
                        "team": ["CORE-X"]
                    }],
                    "crefId": snowcredRef_asset
                }],
                "accountId":
                "f16b0f4a-a76e-499e-b5f7-testautomationsnowasset"
            }
        }
        resp, body = self.api_client.update_account(body, id1)
        print(resp)
        logger.info("API response:" + str(resp))
        passOfResponseCode = assertEqual(resp, 200)
        if (passOfResponseCode):
            passed = True
            status['CAM-APITest'] = passed
            return passed
        else:
            status['CAM-APITest'] = False
            return False
    def CORE2250_postAccountGoogleMinimalInfo(self):
        try:
            passed = False
            randID = 'TestGoogleAcMinimal'
            randID += str(x)
            print (randID)

            projectName=utils.decodeCredential(google_projectName)
            serviceAccountName=utils.decodeCredential(google_serviceAccountName)
            projectId=utils.decodeCredential(google_projectId)
            bucket=utils.decodeCredential(google_bucket)

            body = {
                "account": {
                    "basicInfo": {
                        "accountName": randID,
                        "accountType": "master",
                        "isActive": "Active",
                        "userType": "billing",
                        "serviceProviderCode": "google",
                        "serviceProviderType": "google",
                        "credential_count": 1
                    },
                    "advancedInfo": {
                        "projectName": projectName,
                        "serviceAccountName": serviceAccountName,
                        "projectId": projectId,
                        "bucket": bucket
                    },
                    "credentials": [

                    ],
                    "accountId": "f16b0f4a-a76e-499e-google-testautomationgoogle1"
                }
            };

            #print body
            resp, body = self.api_client.create_account(body)
            print (resp)
            #print body
            logger.info("API response:" + str(resp))
            passOfResponseCode = assertEqual(resp, 200)
            if (passOfResponseCode):
                passed = True
                status['CAM-APITest'] = passed
                return passed
            else :
                status['CAM-APITest'] = False
                return False
        except:
            status['CAM-APITest'] = False
            return False
    def postAccountAWS_InactiveAccount_WithActiveCredential_Id(self):
        try:
            passed = False
            randID = 'TestAWSAcTest3'
            randID += str(x)
            print(randID)

            body = {
                "account": {
                    "accountId":
                    "inactive_cred_9",
                    "basicInfo": {
                        "accountName": "inactive_cred_9" + randID,
                        "serviceProviderType": "amazon",
                        "serviceProviderCode": "amazon",
                        "accountType": "subaccount",
                        "isActive": "InActive",
                        "userType": "asset",
                        "parentAccountId": "default_billing_account_amazon"
                    },
                    "advancedInfo": {
                        "accountNumber": "amazon11158"
                    },
                    "credentials": [{
                        "credentialName": "testcred1",
                        "passwordFields": {
                            "secretKey": "amazon11158",
                            "accessKey": "amazon11158"
                        },
                        "purpose": ["provisioning"],
                        "context": [{
                            "team": ["CORE-X"]
                        }],
                        "status": "Active"
                    }],
                    "id":
                    "cred1"
                }
            }

            resp, body = self.api_client.create_account(body)
            print(resp)
            #print body
            logger.info("API response:" + str(resp))
            passOfResponseCode = assertEqual(resp, 200)
            if (passOfResponseCode):
                passed = True
            status['CAM-APITest'] = passed
            return passed
        except:
            status['CAM-APITest'] = False
            return False
Exemplo n.º 34
0
 def AMAZON_Order_History_valid_data(self):
     global service_id
     passed = False
     url = order_historyURL + "/" + service_id
     resp, body, roundtrip = self.api_client.get_response_data(url)
     print(resp)
     logger.info("API response:" + str(resp))
     # print body
     passOfResponseCode = assertEqual(resp, 200)
     if (passOfResponseCode):
         passed = True
     status['CAM-APITest'] = passed
     return passed
Exemplo n.º 35
0
 def AMAZON_List_Service_Details_By_ServiceId_responsetime(self):
     global service_id
     passed = False
     print("Expected Response Time : " + ResponseTime)
     resp, body, roundtrip = self.api_client.get_api_response_time(
         componentURL + "/" + provider + "/" + service_id)
     print(resp)
     logger.info("API response:" + str(resp))
     passOfResponseCode = assertEqual(resp, 200)
     if (passOfResponseCode):
         passed = True
     status['CAM-APITest'] = passed
     return passed
Exemplo n.º 36
0
def checkBSExpect(env, case):
    if case.expSqls is not None and len(case.expSqls) > 0:
        for i in range(len(case.expSqls)):
            sql = case.expSqls[i]
            logger.info('执行期望SQL[%s]' % (sql.cmd))
            mycon = None
            try:
                if sql.chkdb == None:
                    sql.chkdb = env['db.host']
                mycon = DbConnect(sql.chkdb, sql.chkusr, sql.chkpwd, sql.chkschema)
                resp = mycon.queryTable(sql.cmd)
                logger.debug('实际结果: [%s],期望结果:[%s]' % (resp[0], sql.expResult))
                if sql.cmp is None:
                    utils.assertEqual(sql.expResult, str(resp[0]))
                else:
                    utils.assertCmp(sql.expResult, str(resp[0]), sql.cmp)
            except Exception as msg:
                newMsg = '测试业务数据结果失败。原因:%s' % (msg)
                logger.error(newMsg)
                raise Exception(newMsg)
            finally:
                mycon.close()
Exemplo n.º 37
0
def checkStatusExpect(case, resp):
    if case.expStatusEqual:
       utils.assertEqual(case.expStatus, resp['headers']['status'])
        #utils.assertIn(case.expStatus, resp['headers']['status'])
    else:
        utils.assertNotIn(case.expStatus, resp['headers']['status'])