Best Python code snippet using pyresttest_python
currency.py
Source:currency.py
1import time2import subprocess3import utils4from utils import assignOrder5from utils import assertEqual6from utils import assertContains7from utils import randomString8import threading9import queue10import random11from collections import OrderedDict12import logging13import pprint14import configparser15import json16import random17import requests18import datetime19# from urllib2 import urlopen20import random21global status22status = {}23logger = logging.getLogger("Test Run")24config = configparser.ConfigParser()25config.read('settings.conf')26ResponseTime = config.get('params', 'response_time')27config.read('testdata.conf')28now = datetime.datetime.now()29# db=config.get('params','db')30# invalidUrl =config.get('params', 'invalidUrl')31x = random.randint(0, 50000)32global id_cred,metadata,audit_log_download_id33id_cred={}34metadata={}35audit_log_download_id={}36class Currency(object):37 def __init__(self,client):38 self.api_client = client39 self.invoice_id = random.randint(100000,999999)40#################CORE-2327##################41 # @assignOrder(482)42 # def CORE2327_defaultCurreny(self):43 # passed = False44 # body = {45 # "configurationkey": "default_currency",46 # "configurationvalue": "USD"47 # };48 # resp, body = self.api_client.postdefaultCurreny(body)49 # print (resp)50 # logger.info("API response:" + str(resp))51 # passOfResponseCode = assertEqual(resp, 200)52 # if (passOfResponseCode):53 # passed = True54 # status['CAM-APITest'] = passed55 # return passed56 # @assignOrder(483)57 # def CORE2327_lockCurreny(self):58 # try:59 # passed = False60 # body = {61 # "configurationkey": "default_currency_status",62 # "configurationvalue": "true"63 # };64 # resp, body = self.api_client.lockdefaultCurreny(body)65 # print (resp)66 # logger.info("API response:" + str(resp))67 # passOfResponseCode = assertEqual(resp, 200)68 # if (passOfResponseCode):69 # passed = True70 # status['CAM-APITest'] = passed71 # return passed72 # except:73 # status['CAM-APITest'] = False74 # return False75 # @assignOrder(484)76 # def CORE2327_getLockStatus(self):77 # try:78 # passed = False79 # resp, body = self.api_client.getCurrencyLockStatus()80 # print (resp)81 # logger.info("API response:" + str(resp))82 # passOfResponseCode = assertEqual(resp, 200)83 # if (passOfResponseCode):84 # passed = True85 # status['CAM-APITest'] = passed86 # return passed87 # except:88 # status['CAM-APITest'] = False89 # return False90 @assignOrder(485)91 def CORE2327_getdefaultCurrency(self):92 try:93 passed = False94 resp, body = self.api_client.getdefaultCurrency()95 print (resp)96 logger.info("API response:" + str(resp))97 passOfResponseCode = assertEqual(resp, 200)98 if (passOfResponseCode):99 passed = True100 status['CAM-APITest'] = passed101 return passed102 except:103 status['CAM-APITest'] = False104 return False105 @assignOrder(486)106 def CORE2327_getAllConvertions(self):107 try:108 passed = False109 resp, body = self.api_client.getAllConvertion()110 print (resp)111 logger.info("API response:" + str(resp))112 passOfResponseCode = assertEqual(resp, 200)113 if (passOfResponseCode):114 passed = True115 status['CAM-APITest'] = passed116 return passed117 except:118 status['CAM-APITest'] = False119 return False120 @assignOrder(487)121 def CORE2327_Post_Delete_Future_DateConvertionRates(self):122 try:123 passed = False124 body = {125 "currencyfrom": "EUR",126 "currencyto": "USD",127 "source": "default",128 "startdate": "2139-02-07T18:25:43.511Z",129 "enddate": "2139-03-07T18:25:43.511Z",130 "exchangerate": "64.6",131 "status": "ACTIVE"132 };133 resp, body1 = self.api_client.postConvertionRates(body)134 print (resp)135 logger.info("API response:" + str(resp))136 # Verify POST137 get_resp, get_body = self.api_client.getConversionRatesById(body1['id'])138 passOfResponseCode = assertEqual(resp, 201) & assertEqual(body['currencyfrom'], get_body['currencyfrom']) & assertEqual(body['currencyto'], get_body['currencyto']) & assertEqual(body['source'], get_body['source']) & assertEqual(body['startdate'], get_body['startdate']) & assertEqual(body['enddate'], get_body['enddate']) & assertEqual(body['exchangerate'], get_body['exchangerate']) & assertEqual(body['status'], get_body['status'])139 data = json.dumps(body1)140 data = json.loads(data)141 print (data['id'])142 resp, body = self.api_client.deleteConvertionRates(data['id'])143 print (resp)144 logger.info("API response:" + str(resp))145 passOfResponseCode = assertEqual(resp, 204)146 if (passOfResponseCode):147 passed = True148 status['CAM-APITest'] = passed149 return passed150 except:151 status['CAM-APITest'] = False152 return False153 @assignOrder(488)154 def CORE2605_getSupportedCurrencies(self):155 try:156 passed = False157 resp, body = self.api_client.getSupportedCurrencies()158 print (resp)159 logger.info("API response:" + str(resp))160 passOfResponseCode = assertEqual(resp, 200)161 if (passOfResponseCode):162 passed = True163 status['CAM-APITest'] = passed164 return passed165 except:166 status['CAM-APITest'] = False167 return False168 # @assignOrder(489)169 # def CORE2327_postWithUnlockedStatus(self):170 # try:171 # passed = False172 # body = {173 # "configurationkey": "default_currency_status",174 # "configurationvalue": "false"175 # };176 # resp, body = self.api_client.lockdefaultCurreny(body)177 # print (resp)178 # logger.info("API response:" + str(resp))179 # ######post convertion rate##############180 # body = {181 # "currencyfrom": "EUR",182 # "currencyto": "USD",183 # "source": "default",184 # "startdate": "02/07/2020",185 # "enddate": "03/07/2020",186 # "exchangerate": "64.6"187 # };188 # resp, body = self.api_client.postConvertionRates(body)189 # print (resp)190 # logger.info("API response:" + str(resp))191 # passOfResponseCode = assertEqual(resp, 400)192 # if (passOfResponseCode):193 # passed = True194 # status['CAM-APITest'] = passed195 # body = {196 # "configurationkey": "default_currency_status",197 # "configurationvalue": "true"198 # };199 # resp, body = self.api_client.lockdefaultCurreny(body)200 # print (resp)201 # logger.info("API response:" + str(resp))202 # return passed203 # except:204 # status['CAM-APITest'] = False205 # return False206 @assignOrder(490)207 def CORE2327_Post_Invalid_ConvertionFormat(self):208 try:209 passed = False210 body = {211 "configurationkey": "default_currency_status",212 "configurationvalue": "true"213 };214 resp, body = self.api_client.lockdefaultCurreny(body)215 print (resp)216 logger.info("API response:" + str(resp))217 body = {218 "currencyfrom": "EUR@@@",219 "currencyto": "USD",220 "source": "default",221 "startdate": "2139-02-07T18:25:43.511Z",222 "enddate": "2139-03-07T18:25:43.511Z",223 "exchangerate": "64.6",224 "status": "ACTIVE"225 };226 resp, body = self.api_client.postConvertionRates(body)227 print (resp)228 logger.info("API response:" + str(resp))229 passOfResponseCode = assertEqual(resp, 400)230 if (passOfResponseCode):231 passed = True232 status['CAM-APITest'] = passed233 return passed234 except:235 status['CAM-APITest'] = False236 return False237 @assignOrder(491)238 def CORE2327_Post_Delete_PresentDate_ConvertionRates(self):239 try:240 passed = False241 print ("Current date and time using str method of datetime object:")242 print (str(now))243 print ("Current year: %d" % now.year)244 print ("Current month: %d" % now.month)245 print ("Current day: %d" % now.day)246 day = len(str(now.day))247 if day < 2:248 day1 = "0" + str(now.day)249 else:250 day1 = str(now.day)251 month = len(str(now.month))252 if month < 2:253 month1 = "0" + str(now.month)254 else:255 month1 = str(now.month)256 completeDate = str(now.year) + "-" + str(month1) + "-" + str(day1) + "T" + "18:25:43.511" + "Z"257 print (completeDate)258 body = {259 "currencyfrom": "EUR",260 "currencyto": "USD",261 "source": "default",262 "startdate": completeDate,263 "enddate": completeDate,264 "exchangerate": "64.2"265 };266 resp, body = self.api_client.postConvertionRates(body)267 print (resp)268 logger.info("API response:" + str(resp))269 if resp == 409:270 print ("Record Already Exist")271 passOfResponseCode = assertEqual(resp, 409)272 if (passOfResponseCode):273 passed = True274 status['CAM-APITest'] = passed275 return passed276 else:277 # Verify POST278 get_resp, get_body = self.api_client.getConversionRatesById(body['id'])279 passOfResponseCode = assertEqual(resp, 201) & assertEqual(body['currencyfrom'], get_body['currencyfrom']) & assertEqual(body['currencyto'], get_body['currencyto']) & assertEqual(body['source'], get_body['source']) & assertEqual(body['startdate'], get_body['startdate']) & assertEqual(body['enddate'], get_body['enddate']) & assertEqual(body['exchangerate'], get_body['exchangerate']) & assertEqual(body['status'], get_body['status'])280 data = json.dumps(body)281 data = json.loads(data)282 print (data['id'])283 resp, body = self.api_client.deleteConvertionRates(data['id'])284 print (resp)285 logger.info("API response:" + str(resp))286 passOfResponseCode = assertEqual(resp, 204)287 if (passOfResponseCode):288 passed = True289 status['CAM-APITest'] = passed290 return passed291 except:292 status['CAM-APITest'] = False293 return False294 @assignOrder(492)295 def CORE2327_Post_Delete_PastDate_ConvertionRates(self):296 try:297 passed = False298 year = random.randint(1900, 1986)299 month = random.randint(10, 12)300 day = random.randint(10, 28)301 print ("Current year: %d" % year)302 print ("Current month: %d" % month)303 print ("Current day: %d" % day)304 completeDate = str(year) + "-" + str(month) + "-" + str(day) + "T" + "18:25:43.511" + "Z"305 print (completeDate)306 body = {307 "currencyfrom": "EUR",308 "currencyto": "USD",309 "source": "default",310 "startdate": completeDate,311 "enddate": completeDate,312 "exchangerate": "64.2"313 };314 resp, body = self.api_client.postConvertionRates(body)315 print (resp)316 logger.info("API response:" + str(resp))317 if resp == 409:318 print ("Record Already Exist")319 passOfResponseCode = assertEqual(resp, 409)320 if (passOfResponseCode):321 passed = True322 status['CAM-APITest'] = passed323 return passed324 else:325 # Verify POST326 get_resp, get_body = self.api_client.getConversionRatesById(body['id'])327 passOfResponseCode = assertEqual(resp, 201) & assertEqual(body['currencyfrom'], get_body['currencyfrom']) & assertEqual(body['currencyto'], get_body['currencyto']) & assertEqual(body['source'], get_body['source']) & assertEqual(body['startdate'], get_body['startdate']) & assertEqual(body['enddate'], get_body['enddate']) & assertEqual(body['exchangerate'], get_body['exchangerate']) & assertEqual(body['status'], get_body['status'])328 data = json.dumps(body)329 data = json.loads(data)330 print (data['id'])331 resp, body = self.api_client.deleteConvertionRates(data['id'])332 print (resp)333 logger.info("API response:" + str(resp))334 passOfResponseCode = assertEqual(resp, 204)335 if (passOfResponseCode):336 passed = True337 status['CAM-APITest'] = passed338 return passed339 except:340 status['CAM-APITest'] = False341 return False342 @assignOrder(493)343 def CORE2327_update_FutureDate_ConvertionRates(self):344 try:345 passed = False346 year = random.randint(2500, 2600)347 month = random.randint(10, 12)348 day = random.randint(10, 28)349 print ("Current year: %d" % year)350 print ("Current month: %d" % month)351 print ("Current day: %d" % day)352 completeDate = str(year) + "-" + str(month) + "-" + str(day) + "T" + "18:25:43.511" + "Z"353 print (completeDate)354 body = {355 "currencyfrom": "EUR",356 "currencyto": "USD",357 "source": "default",358 "startdate": completeDate,359 "enddate": completeDate,360 "exchangerate": "64.2",361 "status": "ACTIVE"362 };363 resp, body = self.api_client.postConvertionRates(body)364 print (resp)365 data = json.dumps(body)366 data = json.loads(data)367 print (data['id'])368 logger.info("API response:" + str(resp))369 if resp == 409:370 print ("Record Already Exist")371 passOfResponseCode = assertEqual(resp, 409)372 if (passOfResponseCode):373 passed = True374 status['CAM-APITest'] = passed375 return passed376 else:377 # Verify POST378 get_resp, get_body = self.api_client.getConversionRatesById(body['id'])379 passOfResponseCode = assertEqual(resp, 201) & assertEqual(body['currencyfrom'], get_body['currencyfrom']) & assertEqual(body['currencyto'], get_body['currencyto']) & assertEqual(body['source'], get_body['source']) & assertEqual(body['startdate'], get_body['startdate']) & assertEqual(body['enddate'], get_body['enddate']) & assertEqual(body['exchangerate'], get_body['exchangerate']) & assertEqual(body['status'], get_body['status'])380 data = json.dumps(body)381 data = json.loads(data)382 print (data['id'])383 year = random.randint(2700, 4000)384 month = random.randint(10, 12)385 day = random.randint(11, 28)386 print ("Current year: %d" % year)387 print ("Current month: %d" % month)388 print ("Current day: %d" % day)389 newcompleteDate = str(year) + "-" + str(month) + "-" + str(day) + "T18:25:43.511Z"390 print (newcompleteDate)391 body = {392 "currencyfrom": "AUD",393 "currencyto": "USD",394 "source": "default",395 "startdate": completeDate,396 "enddate": newcompleteDate,397 "exchangerate": "61.0",398 "status": "ACTIVE"399 };400 resp, body = self.api_client.update_convertionRates(body, data['id']);401 print (resp)402 logger.info("API response:" + str(resp))403 # Verify Update404 get_resp, get_body = self.api_client.getConversionRatesById(body['id'])405 passOfResponseCode = assertEqual(resp, 200) & assertEqual(body['currencyfrom'], get_body['currencyfrom']) & assertEqual(body['currencyto'], get_body['currencyto']) & assertEqual(body['source'], get_body['source']) & assertEqual(body['startdate'], get_body['startdate']) & assertEqual(body['enddate'], get_body['enddate']) & assertEqual(body['exchangerate'], get_body['exchangerate']) & assertEqual(body['status'], get_body['status'])406 resp, body = self.api_client.deleteConvertionRates(data['id'])407 print (resp)408 if (passOfResponseCode):409 passed = True410 status['CAM-APITest'] = passed411 return passed412 except:413 status['CAM-APITest'] = False414 return False415 @assignOrder(494)416 def CORE2327_update_PastDate_ConvertionRates(self):417 try:418 passed = False419 year = random.randint(1986, 2014)420 month = random.randint(10, 12)421 day = random.randint(11, 28)422 print ("Current year: %d" % year)423 print ("Current month: %d" % month)424 print ("Current day: %d" % day)425 completeDate = str(year) + "-" + str(month) + "-" + str(day) + "T18:25:43.511Z"426 print (completeDate)427 body = {428 "currencyfrom": "EUR",429 "currencyto": "USD",430 "source": "default",431 "startdate": completeDate,432 "enddate": completeDate,433 "exchangerate": "64.2",434 "status": "ACTIVE"435 };436 resp, body = self.api_client.postConvertionRates(body)437 print (resp)438 logger.info("API response:" + str(resp))439 if resp == 409:440 print ("Record Already Exist")441 passOfResponseCode = assertEqual(resp, 409)442 if (passOfResponseCode):443 passed = True444 status['CAM-APITest'] = passed445 return passed446 else:447 # Verify POST448 get_resp, get_body = self.api_client.getConversionRatesById(body['id'])449 passOfResponseCode = assertEqual(resp, 201) & assertEqual(body['currencyfrom'], get_body['currencyfrom']) & assertEqual(body['currencyto'], get_body['currencyto']) & assertEqual(body['source'], get_body['source']) & assertEqual(body['startdate'], get_body['startdate']) & assertEqual(body['enddate'], get_body['enddate']) & assertEqual(body['exchangerate'], get_body['exchangerate']) & assertEqual(body['status'], get_body['status'])450 data = json.dumps(body)451 data = json.loads(data)452 print (data['id'])453 year = random.randint(2020, 2040)454 month = random.randint(10, 12)455 day = random.randint(11, 28)456 print ("Current year: %d" % year)457 print ("Current month: %d" % month)458 print ("Current day: %d" % day)459 NewcompleteDate = str(year) + "-" + str(month) + "-" + str(day) + "T18:25:43.511Z"460 print (NewcompleteDate)461 body = {462 "currencyfrom": "AUD",463 "currencyto": "USD",464 "source": "default",465 "startdate": completeDate,466 "enddate": NewcompleteDate,467 "exchangerate": "61.0",468 "status": "ACTIVE"469 };470 resp, body = self.api_client.update_convertionRates(body, data['id']);471 print (resp)472 logger.info("API response:" + str(resp))473 # Verify Update474 get_resp, get_body = self.api_client.getConversionRatesById(body['id'])475 passOfResponseCode = assertEqual(resp, 200) & assertEqual(body['currencyfrom'], get_body['currencyfrom']) & assertEqual(body['currencyto'], get_body['currencyto']) & assertEqual(body['source'], get_body['source']) & assertEqual(body['startdate'], get_body['startdate']) & assertEqual(body['enddate'], get_body['enddate']) & assertEqual(body['exchangerate'], get_body['exchangerate']) & assertEqual(body['status'], get_body['status'])476 resp, body = self.api_client.deleteConvertionRates(data['id'])477 print (resp)478 if (passOfResponseCode):479 passed = True480 status['CAM-APITest'] = passed481 return passed482 else:483 status['CAM-APITest'] = False484 return False485 except:486 status['CAM-APITest'] = False487 return False488 @assignOrder(495)489 def CORE2327_update_CurrentDate_ConvertionRates(self):490 try:491 passed = False492 print ("Current date and time using str method of datetime object:")493 print (str(now))494 print ("Current year: %d" % now.year)495 print ("Current month: %d" % now.month)496 print ("Current day: %d" % now.day)497 day = len(str(now.day))498 if day < 2:499 day1 = "0" + str(now.day)500 else:501 day1 = str(now.day)502 month = len(str(now.month))503 if month < 2:504 month1 = "0" + str(now.month)505 else:506 month1 = str(now.month)507 completeDate = str(now.year) + "-" + str(month1) + "-" + str(day1) + "T" + "18:25:43.511" + "Z"508 print (completeDate)509 body = {510 "currencyfrom": "INR",511 "currencyto": "EUR",512 "source": "default",513 "startdate": completeDate,514 "enddate": completeDate,515 "exchangerate": "64.2",516 "status": "ACTIVE"517 };518 resp, body = self.api_client.postConvertionRates(body)519 print (resp)520 logger.info("API response:" + str(resp))521 if resp == 409:522 print ("Record Already Exist")523 passOfResponseCode = assertEqual(resp, 409)524 if (passOfResponseCode):525 passed = True526 status['CAM-APITest'] = passed527 return passed528 else:529 # Verify POST530 get_resp, get_body = self.api_client.getConversionRatesById(body['id'])531 passOfResponseCode = assertEqual(resp, 201) & assertEqual(body['currencyfrom'], get_body['currencyfrom']) & assertEqual(body['currencyto'], get_body['currencyto']) & assertEqual(body['source'], get_body['source']) & assertEqual(body['startdate'], get_body['startdate']) & assertEqual(body['enddate'], get_body['enddate']) & assertEqual(body['exchangerate'], get_body['exchangerate']) & assertEqual(body['status'], get_body['status'])532 data = json.dumps(body)533 data = json.loads(data)534 print (data['id'])535 year = random.randint(2020, 2040)536 month = random.randint(10, 12)537 day = random.randint(11, 28)538 print ("Current year: %d" % year)539 print ("Current month: %d" % month)540 print ("Current day: %d" % day)541 NewcompleteDate = str(year) + "-" + str(month) + "-" + str(day) + "T18:25:43.511Z"542 print (NewcompleteDate)543 body = {544 "currencyfrom": "SEK",545 "currencyto": "USD",546 "source": "default",547 "startdate": completeDate,548 "enddate": NewcompleteDate,549 "exchangerate": "61.0",550 "status": "ACTIVE"551 };552 resp, body = self.api_client.update_convertionRates(body, data['id']);553 print (resp)554 logger.info("API response:" + str(resp))555 # Verify Update556 get_resp, get_body = self.api_client.getConversionRatesById(body['id'])557 passOfResponseCode = assertEqual(resp, 200) & assertEqual(body['currencyfrom'], get_body['currencyfrom']) & assertEqual(body['currencyto'], get_body['currencyto']) & assertEqual(body['source'], get_body['source']) & assertEqual(body['startdate'], get_body['startdate']) & assertEqual(body['enddate'], get_body['enddate']) & assertEqual(body['exchangerate'], get_body['exchangerate']) & assertEqual(body['status'], get_body['status'])558 resp, body = self.api_client.deleteConvertionRates(data['id'])559 if (passOfResponseCode):560 passed = True561 print (resp)562 status['CAM-APITest'] = passed563 return passed564 else:565 status['CAM-APITest'] = False566 return False567 except:568 status['CAM-APITest'] = False569 return False570 @assignOrder(496)571 def CORE2327_update_StartDate_ConvertionRates(self):572 try:573 passed = False574 print ("Current date and time using str method of datetime object:")575 print (str(now))576 print ("Current year: %d" % now.year)577 print ("Current month: %d" % now.month)578 print ("Current day: %d" % now.day)579 day = len(str(now.day))580 if day < 2:581 day1 = "0" + str(now.day)582 else:583 day1 = str(now.day)584 month = len(str(now.month))585 if month < 2:586 month1 = "0" + str(now.month)587 else:588 month1 = str(now.month)589 completeDate = str(now.year) + "-" + str(month1) + "-" + str(day1) + "T" + "18:25:43.511" + "Z"590 print (completeDate)591 body = {592 "currencyfrom": "NZD",593 "currencyto": "AUD",594 "source": "default",595 "startdate": completeDate,596 "enddate": completeDate,597 "exchangerate": "64.2",598 "status": "ACTIVE"599 };600 resp, body = self.api_client.postConvertionRates(body)601 print (resp)602 logger.info("API response:" + str(resp))603 if resp == 409:604 print ("Record Already Exist")605 passOfResponseCode = assertEqual(resp, 409)606 if (passOfResponseCode):607 passed = True608 status['CAM-APITest'] = passed609 return passed610 else:611 # Verify POST612 get_resp, get_body = self.api_client.getConversionRatesById(body['id'])613 passOfResponseCode = assertEqual(resp, 201) & assertEqual(body['currencyfrom'], get_body['currencyfrom']) & assertEqual(body['currencyto'], get_body['currencyto']) & assertEqual(body['source'], get_body['source']) & assertEqual(body['startdate'], get_body['startdate']) & assertEqual(body['enddate'], get_body['enddate']) & assertEqual(body['exchangerate'], get_body['exchangerate']) & assertEqual(body['status'], get_body['status'])614 data = json.dumps(body)615 data = json.loads(data)616 print (data['id'])617 year = random.randint(2020, 2040)618 month = random.randint(10, 12)619 day = random.randint(11, 28)620 print ("Current year: %d" % year)621 print ("Current month: %d" % month)622 print ("Current day: %d" % day)623 NewcompleteDate = str(year) + "-" + str(month) + "-" + str(day) + "T18:25:43.511Z"624 print (NewcompleteDate)625 body = {626 "currencyfrom": "SEK",627 "currencyto": "USD",628 "source": "default",629 "startdate": NewcompleteDate,630 "enddate": NewcompleteDate,631 "exchangerate": "61.0",632 "status": "ACTIVE"633 };634 resp, body = self.api_client.update_convertionRates(body, data['id']);635 print (resp)636 logger.info("API response:" + str(resp))637 # Verify Update638 get_resp, get_body = self.api_client.getConversionRatesById(body['id'])639 passOfResponseCode = assertEqual(resp, 200) & assertEqual(body['currencyfrom'], get_body['currencyfrom']) & assertEqual(body['currencyto'], get_body['currencyto']) & assertEqual(body['source'], get_body['source']) & assertEqual(body['startdate'], get_body['startdate']) & assertEqual(body['enddate'], get_body['enddate']) & assertEqual(body['exchangerate'], get_body['exchangerate']) & assertEqual(body['status'], get_body['status'])640 resp, body = self.api_client.deleteConvertionRates(data['id'])641 print (resp)642 if (passOfResponseCode):643 passed = True644 print (resp)645 status['CAM-APITest'] = passed646 return passed647 else:648 status['CAM-APITest'] = False649 return False650 except:651 status['CAM-APITest'] = False652 return False653 ##########################################CORE -3671 #######################3654 @assignOrder(497)655 def CORE3671_getConversionRateWithHistrory(self):656 try:657 passed = False658 resp, body = self.api_client.getConversionRatesWithHistory()659 print (resp)660 logger.info("API response:" + str(resp))661 passOfResponseCode = assertEqual(resp, 200)662 if (passOfResponseCode):663 passed = True664 status['CAM-APITest'] = passed665 return passed666 except:667 status['CAM-APITest'] = False668 return False669 @assignOrder(498)670 def CORE3671_getConversionRateWithoutHistrory(self):671 try:672 passed = False673 resp, body = self.api_client.getConversionRatesWithoutHistory()674 print (resp)675 logger.info("API response:" + str(resp))676 passOfResponseCode = assertEqual(resp, 200)677 if (passOfResponseCode):678 passed = True679 status['CAM-APITest'] = passed680 return passed681 except:682 status['CAM-APITest'] = False683 return False684 @assignOrder(499)685 def CORE3671_getConversionRateById(self): #doubtful686 try:687 recordId=""688 passed = False689 body = {690 "currencyfrom": "EUR",691 "currencyto": "USD",692 "source": "default",693 "startdate": "2139-02-07T18:25:43.511Z",694 "enddate": "2139-03-07T18:25:43.511Z",695 "exchangerate": "64.6",696 "status": "ACTIVE"697 };698 resp, body = self.api_client.postConvertionRates(body)699 print (resp)700 logger.info("API response:" + str(resp))701 data = json.dumps(body)702 data = json.loads(data)703 print (data['id'])704 recordId = data['id']705 resp, body = self.api_client.getConversionRatesById(recordId)706 print (resp)707 logger.info("API response:" + str(resp))708 passOfResponseCode = assertEqual(resp, 200)709 if (passOfResponseCode):710 passed = True711 status['CAM-APITest'] = passed712 resp, body = self.api_client.deleteConvertionRates(recordId)713 return passed714 except:715 status['CAM-APITest'] = False716 resp, body = self.api_client.deleteConvertionRates(recordId)717 return False718 @assignOrder(500)719 def CORE3671_getConversionRateByInvalidID(self):720 try:721 passed = False722 resp, body = self.api_client.getConversionRatesById("TestDataCurrency123456")723 print (resp)724 logger.info("API response For GET:" + str(resp))725 passOfResponseCode = assertEqual(resp, 404)726 if (passOfResponseCode):727 passed = True728 status['CAM-APITest'] = passed729 return passed730 except:731 status['CAM-APITest'] = False732 return False733 @assignOrder(501)734 def CORE3671_deleteConversionRateByInvalidID(self):735 try:736 passed = False737 resp, body = self.api_client.deleteConvertionRates("338383838989")738 print (resp)739 logger.info("API response:" + str(resp))740 passOfResponseCode = assertEqual(resp, 404)741 if (passOfResponseCode):742 passed = True743 status['CAM-APITest'] = passed744 return passed745 except:746 status['CAM-APITest'] = False747 return False748 @assignOrder(502)749 def CORE3671_getAllConversionRate_DeletedStatus(self):750 try:751 passed = False752 resp, body = self.api_client.getConversionRates_DeletedStaus()753 print (resp)754 logger.info("API response:" + str(resp))755 passOfResponseCode = assertEqual(resp, 200)756 if (passOfResponseCode):757 passed = True758 status['CAM-APITest'] = passed759 return passed760 except:761 status['CAM-APITest'] = False762 return False763 @assignOrder(503)764 def CORE3671_getAllConversionRate_validStatus(self):765 try:766 passed = False767 resp, body = self.api_client.getConversionRates_validStaus()768 print (resp)769 logger.info("API response:" + str(resp))770 passOfResponseCode = assertEqual(resp, 200)771 if (passOfResponseCode):772 passed = True773 status['CAM-APITest'] = passed774 return passed775 except:776 status['CAM-APITest'] = False777 return False778 @assignOrder(504)779 def CORE3671_getConversionRate_MultipleParameter(self): #doubtful780 try:781 passed = False782 body = {783 "currencyfrom": "NOK",784 "currencyto": "NZD",785 "source": "apiAutomationNewTest",786 "startdate": "2019-01-05T18:25:43.511Z",787 "enddate": "2019-01-08T18:25:43.511Z",788 "exchangerate": "64.2"789 };790 resp, body = self.api_client.postConvertionRates(body)791 print (resp)792 data = json.dumps(body)793 data = json.loads(data)794 print (data['id'])795 logger.info("API response:" + str(resp))796 if resp == 409:797 print ("Record Already Exist")798 passOfResponseCode = assertEqual(resp, 409)799 if (passOfResponseCode):800 passed = True801 status['CAM-APITest'] = passed802 return passed803 else:804 passOfResponseCode = assertEqual(resp, 201)805 resp, body = self.api_client.getConversionRates_MultipleParamter('NOK','NZD','apiAutomationNewTest')806 print (resp)807 logger.info("API response:" + str(resp))808 passOfResponseCode = assertEqual(resp, 200)809 resp, body = self.api_client.deleteConvertionRates(data['id'])810 print (resp)811 if (passOfResponseCode):812 passed = True813 status['CAM-APITest'] = passed814 return passed815 except:816 status['CAM-APITest'] = False817 return False818 @assignOrder(505)819 def CORE3671_getStatus_DeletedConversionRates(self):820 try:821 passed = False822 body = {823 "currencyfrom": "DKK",824 "currencyto": "GBP",825 "source": "default",826 "startdate": "2058-12-06T18:25:43.511Z",827 "enddate": "2058-12-06T18:25:43.511Z",828 "exchangerate": "64.2"829 };830 resp, body = self.api_client.postConvertionRates(body)831 print (resp)832 logger.info("API response For POST:" + str(resp))833 if resp == 409:834 print ("Record Already Exist")835 passOfResponseCode = assertEqual(resp, 409)836 if (passOfResponseCode):837 passed = True838 status['CAM-APITest'] = passed839 return passed840 else:841 # Verify POST842 get_resp, get_body = self.api_client.getConversionRatesById(body['id'])843 passOfResponseCode = assertEqual(resp, 201) & assertEqual(body['currencyfrom'], get_body['currencyfrom']) & assertEqual(body['currencyto'], get_body['currencyto']) & assertEqual(body['source'], get_body['source']) & assertEqual(body['startdate'], get_body['startdate']) & assertEqual(body['enddate'], get_body['enddate']) & assertEqual(body['exchangerate'], get_body['exchangerate']) & assertEqual(body['status'], get_body['status'])844 data = json.dumps(body)845 data = json.loads(data)846 print (data['id'])847 resp, body = self.api_client.deleteConvertionRates(data['id'])848 print (resp)849 logger.info("API response for Delete by ID:" + str(resp))850 resp, body = self.api_client.getConversionRatesById(data['id'])851 print (resp)852 logger.info("API response:" + str(resp))853 passOfResponseCode = assertEqual(resp, 404)854 if (passOfResponseCode):855 passed = True856 status['CAM-APITest'] = passed857 return passed858 except:859 status['CAM-APITest'] = False860 return False861 @assignOrder(506)862 def CORE3671_DeletedConversionRates_for_ZAR_BRL(self):863 try:864 passed = False865 body = {866 "currencyfrom": "ZAR",867 "currencyto": "BRL",868 "source": "default",869 "startdate": "2058-12-06T18:25:43.511Z",870 "enddate": "2058-12-06T18:25:43.511Z",871 "exchangerate": "64.2"872 };873 resp, body = self.api_client.postConvertionRates(body)874 print (resp)875 logger.info("API response For POST:" + str(resp))876 if resp == 409:877 print ("Record Already Exist")878 passOfResponseCode = assertEqual(resp, 409)879 if (passOfResponseCode):880 passed = True881 status['CAM-APITest'] = passed882 return passed883 else:884 # Verify POST885 get_resp, get_body = self.api_client.getConversionRatesById(body['id'])886 passOfResponseCode = assertEqual(resp, 201) & assertEqual(body['currencyfrom'], get_body['currencyfrom']) & assertEqual(body['currencyto'], get_body['currencyto']) & assertEqual(body['source'], get_body['source']) & assertEqual(body['startdate'], get_body['startdate']) & assertEqual(body['enddate'], get_body['enddate']) & assertEqual(body['exchangerate'], get_body['exchangerate']) & assertEqual(body['status'], get_body['status'])887 data = json.dumps(body)888 data = json.loads(data)889 print (data['id'])890 resp, body = self.api_client.deleteConvertionRates(data['id'])891 print (resp)892 logger.info("API response for Delete by ID:" + str(resp))893 resp, body = self.api_client.getConversionRatesById(data['id'])894 print (resp)895 logger.info("API response for Delete by ID:" + str(resp))896 resp, body = self.api_client.getConversionRatesById(data['id'])897 print (resp)898 logger.info("API response:" + str(resp))899 passOfResponseCode = assertEqual(resp, 404)900 if (passOfResponseCode):901 passed = True902 status['CAM-APITest'] = passed903 return passed904 except:905 status['CAM-APITest'] = False906 return False907 @assignOrder(507)908 def CORE3671_DeletedConversionRates_for_HKD_CAD(self):909 try:910 passed = False911 body = {912 "currencyfrom": "HKD",913 "currencyto": "CAD",914 "source": "default",915 "startdate": "2058-12-06T18:25:43.511Z",916 "enddate": "2058-12-06T18:25:43.511Z",917 "exchangerate": "64.2"918 };919 resp, body = self.api_client.postConvertionRates(body)920 print (resp)921 logger.info("API response For POST:" + str(resp))922 if resp == 409:923 print ("Record Already Exist")924 passOfResponseCode = assertEqual(resp, 409)925 if (passOfResponseCode):926 passed = True927 status['CAM-APITest'] = passed928 return passed929 else:930 # Verify POST931 get_resp, get_body = self.api_client.getConversionRatesById(body['id'])932 passOfResponseCode = assertEqual(resp, 201) & assertEqual(body['currencyfrom'], get_body['currencyfrom']) & assertEqual(body['currencyto'], get_body['currencyto']) & assertEqual(body['source'], get_body['source']) & assertEqual(body['startdate'], get_body['startdate']) & assertEqual(body['enddate'], get_body['enddate']) & assertEqual(body['exchangerate'], get_body['exchangerate']) & assertEqual(body['status'], get_body['status'])933 # passOfResponseCode = assertEqual(resp, 201)934 data = json.dumps(body)935 data = json.loads(data)936 print (data['id'])937 resp, body = self.api_client.deleteConvertionRates(data['id'])938 print (resp)939 logger.info("API response for Delete by ID:" + str(resp))940 resp, body = self.api_client.getConversionRatesById(data['id'])941 print (resp)942 logger.info("API response:" + str(resp))943 passOfResponseCode = assertEqual(resp, 404)944 if (passOfResponseCode):945 passed = True946 status['CAM-APITest'] = passed947 return passed948 except:949 status['CAM-APITest'] = False950 return False951 @assignOrder(508)952 def CORE3671_DeletedConversionRates_for_CAD_CHF(self):953 try:954 passed = False955 body = {956 "currencyfrom": "CAD",957 "currencyto": "CHF",958 "source": "default",959 "startdate": "2058-12-06T18:25:43.511Z",960 "enddate": "2058-12-06T18:25:43.511Z",961 "exchangerate": "64.2"962 };963 resp, body = self.api_client.postConvertionRates(body)964 print (resp)965 logger.info("API response For POST:" + str(resp))966 if resp == 409:967 print ("Record Already Exist")968 passOfResponseCode = assertEqual(resp, 409)969 if (passOfResponseCode):970 passed = True971 status['CAM-APITest'] = passed972 return passed973 else:974 # Verify POST975 get_resp, get_body = self.api_client.getConversionRatesById(body['id'])976 passOfResponseCode = assertEqual(resp, 201) & assertEqual(body['currencyfrom'], get_body['currencyfrom']) & assertEqual(body['currencyto'], get_body['currencyto']) & assertEqual(body['source'], get_body['source']) & assertEqual(body['startdate'], get_body['startdate']) & assertEqual(body['enddate'], get_body['enddate']) & assertEqual(body['exchangerate'], get_body['exchangerate']) & assertEqual(body['status'], get_body['status'])977 data = json.dumps(body)978 data = json.loads(data)979 print (data['id'])980 resp, body = self.api_client.deleteConvertionRates(data['id'])981 print (resp)982 logger.info("API response for Delete by ID:" + str(resp))983 resp, body = self.api_client.getConversionRatesById(data['id'])984 print (resp)985 logger.info("API response:" + str(resp))986 passOfResponseCode = assertEqual(resp, 404)987 if (passOfResponseCode):988 passed = True989 status['CAM-APITest'] = passed990 return passed991 except:992 status['CAM-APITest'] = False993 return False994 @assignOrder(509)995 def CORE3671_DeletedConversionRates_for_ZAR_CHF(self):996 try:997 passed = False998 body = {999 "currencyfrom": "ZAR",1000 "currencyto": "CHF",1001 "source": "default",1002 "startdate": "2058-12-06T18:25:43.511Z",1003 "enddate": "2058-12-06T18:25:43.511Z",1004 "exchangerate": "64.2"1005 };1006 resp, body = self.api_client.postConvertionRates(body)1007 print (resp)1008 logger.info("API response For POST:" + str(resp))1009 if resp == 409:1010 print ("Record Already Exist")1011 passOfResponseCode = assertEqual(resp, 409)1012 if (passOfResponseCode):1013 passed = True1014 status['CAM-APITest'] = passed1015 return passed1016 else:1017 # Verify POST1018 get_resp, get_body = self.api_client.getConversionRatesById(body['id'])1019 passOfResponseCode = assertEqual(resp, 201) & assertEqual(body['currencyfrom'], get_body['currencyfrom']) & assertEqual(body['currencyto'], get_body['currencyto']) & assertEqual(body['source'], get_body['source']) & assertEqual(body['startdate'], get_body['startdate']) & assertEqual(body['enddate'], get_body['enddate']) & assertEqual(body['exchangerate'], get_body['exchangerate']) & assertEqual(body['status'], get_body['status'])1020 data = json.dumps(body)1021 data = json.loads(data)1022 print (data['id'])1023 resp, body = self.api_client.deleteConvertionRates(data['id'])1024 print (resp)1025 logger.info("API response for Delete by ID:" + str(resp))1026 resp, body = self.api_client.getConversionRatesById(data['id'])1027 print (resp)1028 logger.info("API response:" + str(resp))1029 passOfResponseCode = assertEqual(resp, 404)1030 if (passOfResponseCode):1031 passed = True1032 status['CAM-APITest'] = passed1033 return passed1034 except:1035 status['CAM-APITest'] = False1036 return False1037 @assignOrder(510)1038 def CORE3671_DeletedConversionRates_for_ZAR_CAD(self):1039 try:1040 passed = False1041 body = {1042 "currencyfrom": "ZAR",1043 "currencyto": "CAD",1044 "source": "default",1045 "startdate": "2058-12-06T18:25:43.511Z",1046 "enddate": "2058-12-06T18:25:43.511Z",1047 "exchangerate": "64.2"1048 };1049 resp, body = self.api_client.postConvertionRates(body)1050 print (resp)1051 logger.info("API response For POST:" + str(resp))1052 if resp == 409:1053 print ("Record Already Exist")1054 passOfResponseCode = assertEqual(resp, 409)1055 if (passOfResponseCode):1056 passed = True1057 status['CAM-APITest'] = passed1058 return passed1059 else:1060 # Verify POST1061 get_resp, get_body = self.api_client.getConversionRatesById(body['id'])1062 passOfResponseCode = assertEqual(resp, 201) & assertEqual(body['currencyfrom'], get_body['currencyfrom']) & assertEqual(body['currencyto'], get_body['currencyto']) & assertEqual(body['source'], get_body['source']) & assertEqual(body['startdate'], get_body['startdate']) & assertEqual(body['enddate'], get_body['enddate']) & assertEqual(body['exchangerate'], get_body['exchangerate']) & assertEqual(body['status'], get_body['status'])1063 data = json.dumps(body)1064 data = json.loads(data)1065 print (data['id'])1066 resp, body = self.api_client.deleteConvertionRates(data['id'])1067 print (resp)1068 logger.info("API response for Delete by ID:" + str(resp))1069 resp, body = self.api_client.getConversionRatesById(data['id'])1070 print (resp)1071 logger.info("API response:" + str(resp))1072 passOfResponseCode = assertEqual(resp, 404)1073 if (passOfResponseCode):1074 passed = True1075 status['CAM-APITest'] = passed1076 return passed1077 except:1078 status['CAM-APITest'] = False1079 return False1080 @assignOrder(511)1081 def CORE3671_DeletedConversionRates_for_BRL_CAD(self):1082 try:1083 passed = False1084 body = {1085 "currencyfrom": "BRL",1086 "currencyto": "CAD",1087 "source": "default",1088 "startdate": "2058-12-06T18:25:43.511Z",1089 "enddate": "2058-12-06T18:25:43.511Z",1090 "exchangerate": "64.2"1091 };1092 resp, body = self.api_client.postConvertionRates(body)1093 print (resp)1094 logger.info("API response For POST:" + str(resp))1095 if resp == 409:1096 print ("Record Already Exist")1097 passOfResponseCode = assertEqual(resp, 409)1098 if (passOfResponseCode):1099 passed = True1100 status['CAM-APITest'] = passed1101 return passed1102 else:1103 # Verify POST1104 get_resp, get_body = self.api_client.getConversionRatesById(body['id'])1105 passOfResponseCode = assertEqual(resp, 201) & assertEqual(body['currencyfrom'], get_body['currencyfrom']) & assertEqual(body['currencyto'], get_body['currencyto']) & assertEqual(body['source'], get_body['source']) & assertEqual(body['startdate'], get_body['startdate']) & assertEqual(body['enddate'], get_body['enddate']) & assertEqual(body['exchangerate'], get_body['exchangerate']) & assertEqual(body['status'], get_body['status'])1106 data = json.dumps(body)1107 data = json.loads(data)1108 print (data['id'])1109 resp, body = self.api_client.deleteConvertionRates(data['id'])1110 print (resp)1111 logger.info("API response for Delete by ID:" + str(resp))1112 resp, body = self.api_client.getConversionRatesById(data['id'])1113 print (resp)1114 logger.info("API response:" + str(resp))1115 passOfResponseCode = assertEqual(resp, 404)1116 if (passOfResponseCode):1117 passed = True1118 status['CAM-APITest'] = passed1119 return passed1120 except:1121 status['CAM-APITest'] = False1122 return False1123 @assignOrder(512)1124 def CORE3671_DeletedConversionRates_for_BRL_CAD(self):1125 try:1126 passed = False1127 body = {1128 "currencyfrom": "BRL",1129 "currencyto": "ZAR",1130 "source": "default",1131 "startdate": "2058-12-06T18:25:43.511Z",1132 "enddate": "2058-12-06T18:25:43.511Z",1133 "exchangerate": "64.2"1134 };1135 resp, body = self.api_client.postConvertionRates(body)1136 print (resp)1137 logger.info("API response For POST:" + str(resp))1138 if resp == 409:1139 print ("Record Already Exist")1140 passOfResponseCode = assertEqual(resp, 409)1141 if (passOfResponseCode):1142 passed = True1143 status['CAM-APITest'] = passed1144 return passed1145 else:1146 # Verify POST1147 get_resp, get_body = self.api_client.getConversionRatesById(body['id'])1148 passOfResponseCode = assertEqual(resp, 201) & assertEqual(body['currencyfrom'], get_body['currencyfrom']) & assertEqual(body['currencyto'], get_body['currencyto']) & assertEqual(body['source'], get_body['source']) & assertEqual(body['startdate'], get_body['startdate']) & assertEqual(body['enddate'], get_body['enddate']) & assertEqual(body['exchangerate'], get_body['exchangerate']) & assertEqual(body['status'], get_body['status'])1149 data = json.dumps(body)1150 data = json.loads(data)1151 print (data['id'])1152 resp, body = self.api_client.deleteConvertionRates(data['id'])1153 print (resp)1154 logger.info("API response for Delete by ID:" + str(resp))1155 resp, body = self.api_client.getConversionRatesById(data['id'])1156 print (resp)1157 logger.info("API response:" + str(resp))1158 passOfResponseCode = assertEqual(resp, 404)1159 if (passOfResponseCode):1160 passed = True1161 status['CAM-APITest'] = passed1162 return passed1163 except:1164 status['CAM-APITest'] = False1165 return False1166 @assignOrder(513)1167 def CORE3671_DeletedConversionRates_for_CHF_CAD(self):1168 try:1169 passed = False1170 body = {1171 "currencyfrom": "CHF",1172 "currencyto": "ZAR",1173 "source": "default",1174 "startdate": "2058-12-06T18:25:43.511Z",1175 "enddate": "2058-12-06T18:25:43.511Z",1176 "exchangerate": "64.2"1177 };1178 resp, body = self.api_client.postConvertionRates(body)1179 print (resp)1180 logger.info("API response For POST:" + str(resp))1181 if resp == 409:1182 print ("Record Already Exist")1183 passOfResponseCode = assertEqual(resp, 409)1184 if (passOfResponseCode):1185 passed = True1186 status['CAM-APITest'] = passed1187 return passed1188 else:1189 # Verify POST1190 get_resp, get_body = self.api_client.getConversionRatesById(body['id'])1191 passOfResponseCode = assertEqual(resp, 201) & assertEqual(body['currencyfrom'], get_body['currencyfrom']) & assertEqual(body['currencyto'], get_body['currencyto']) & assertEqual(body['source'], get_body['source']) & assertEqual(body['startdate'], get_body['startdate']) & assertEqual(body['enddate'], get_body['enddate']) & assertEqual(body['exchangerate'], get_body['exchangerate']) & assertEqual(body['status'], get_body['status'])1192 data = json.dumps(body)1193 data = json.loads(data)1194 print (data['id'])1195 resp, body = self.api_client.deleteConvertionRates(data['id'])1196 print (resp)1197 logger.info("API response for Delete by ID:" + str(resp))1198 resp, body = self.api_client.getConversionRatesById(data['id'])1199 print (resp)1200 logger.info("API response:" + str(resp))1201 passOfResponseCode = assertEqual(resp, 404)1202 if (passOfResponseCode):1203 passed = True1204 status['CAM-APITest'] = passed1205 return passed1206 except:1207 status['CAM-APITest'] = False1208 return False1209 @assignOrder(514)1210 def CORE3671_DeletedConversionRates_for_HKD_CAD(self):1211 try:1212 passed = False1213 body = {1214 "currencyfrom": "HKD",1215 "currencyto": "ZAR",1216 "source": "default",1217 "startdate": "2058-12-06T18:25:43.511Z",1218 "enddate": "2058-12-06T18:25:43.511Z",1219 "exchangerate": "64.2"1220 };1221 resp, body = self.api_client.postConvertionRates(body)1222 print (resp)1223 logger.info("API response For POST:" + str(resp))1224 if resp == 409:1225 print ("Record Already Exist")1226 passOfResponseCode = assertEqual(resp, 409)1227 if (passOfResponseCode):1228 passed = True1229 status['CAM-APITest'] = passed1230 return passed1231 else:1232 # Verify POST1233 get_resp, get_body = self.api_client.getConversionRatesById(body['id'])1234 passOfResponseCode = assertEqual(resp, 201) & assertEqual(body['currencyfrom'], get_body['currencyfrom']) & assertEqual(body['currencyto'], get_body['currencyto']) & assertEqual(body['source'], get_body['source']) & assertEqual(body['startdate'], get_body['startdate']) & assertEqual(body['enddate'], get_body['enddate']) & assertEqual(body['exchangerate'], get_body['exchangerate']) & assertEqual(body['status'], get_body['status'])1235 data = json.dumps(body)1236 data = json.loads(data)1237 print (data['id'])1238 resp, body = self.api_client.deleteConvertionRates(data['id'])1239 print (resp)1240 logger.info("API response for Delete by ID:" + str(resp))1241 resp, body = self.api_client.getConversionRatesById(data['id'])1242 print (resp)1243 logger.info("API response:" + str(resp))1244 passOfResponseCode = assertEqual(resp, 404)1245 if (passOfResponseCode):1246 passed = True1247 status['CAM-APITest'] = passed1248 return passed1249 except:1250 status['CAM-APITest'] = False1251 return False1252 @assignOrder(515)1253 def CORE3671_OverWriteConversionRates_for_BRL_AUD(self):1254 try:1255 passed = False1256 body = {1257 "currencyfrom": "BRL",1258 "currencyto": "AUD",1259 "source": "default",1260 "startdate": "2058-12-06T18:25:43.511Z",1261 "enddate": "2058-12-10T18:25:43.511Z",1262 "exchangerate": "64.2"1263 };1264 resp, body = self.api_client.postConvertionRates(body)1265 print (resp)1266 logger.info("API response For POST:" + str(resp))1267 if resp == 409:1268 print ("Record Already Exist")1269 status['CAM-APITest'] = False1270 return passed1271 else:1272 # Verify POST1273 get_resp, get_body = self.api_client.getConversionRatesById(body['id'])1274 passOfResponseCode = assertEqual(resp, 200) & assertEqual(body['currencyfrom'], get_body['currencyfrom']) & assertEqual(body['currencyto'], get_body['currencyto']) & assertEqual(body['source'], get_body['source']) & assertEqual(body['startdate'], get_body['startdate']) & assertEqual(body['enddate'], get_body['enddate']) & assertEqual(body['exchangerate'], get_body['exchangerate']) & assertEqual(body['status'], get_body['status'])1275 data = json.dumps(body)1276 data = json.loads(data)1277 print (data['id'])1278 oldID = data['id']1279 logger.info("ID1 is:" + str(oldID))1280 #overwrite one more record1281 body = {1282 "currencyfrom": "BRL",1283 "currencyto": "AUD",1284 "source": "default",1285 "startdate": "2058-12-05T18:25:43.511Z",1286 "enddate": "2058-12-11T18:25:43.511Z",1287 "exchangerate": "64.2"1288 };1289 resp, body = self.api_client.postConvertionRates(body)1290 print (resp)1291 print ("Actual Code is :"+str(resp))1292 print ("Expected Code is 409")1293 logger.info("API response For POST:" + str(resp))1294 if resp == 409:1295 print ("Record Already Exist")1296 passOfResponseCode = assertEqual(resp, 409)1297 if(passOfResponseCode):1298 passed = True1299 resp, body = self.api_client.deleteConvertionRates(oldID)1300 print (resp)1301 logger.info("Deleted The Record1:" + str(resp))1302 print ("Deleted The Record1")1303 status['CAM-APITest'] = passed1304 return passed1305 except:1306 data = json.dumps(body)1307 data = json.loads(data)1308 print (data['id'])1309 newId = data['id']1310 logger.info("ID1 is:" + str(newId))1311 resp, body = self.api_client.deleteConvertionRates(oldID)1312 print (resp)1313 print ("Deleted The Record1")1314 resp, body = self.api_client.deleteConvertionRates(newId)1315 print (resp)1316 print ("Deleted The Record2")1317 logger.info("Deleted The Record2:" + str(resp))1318 status['CAM-APITest'] = False1319 return False1320 @assignOrder(516)1321 def CORE3671_VerifyActiveAPI_DeletedRecords(self):1322 try:1323 passed = False1324 body = {1325 "currencyfrom": "HKD",1326 "currencyto": "USD",1327 "source": "default",1328 "startdate": "2058-12-06T18:25:43.511Z",1329 "enddate": "2058-12-06T18:25:43.511Z",1330 "exchangerate": "64.2"1331 };1332 resp, body = self.api_client.postConvertionRates(body)1333 print (resp)1334 data = json.dumps(body)1335 data = json.loads(data)1336 print (data['id'])1337 generatedId=data['id']1338 body = {1339 "currencyfrom": "HKD",1340 "currencyto": "USD",1341 "source": "default11",1342 "startdate": "2058-12-06T18:25:43.511Z",1343 "enddate": "2058-12-06T18:25:43.511Z",1344 "exchangerate": "64.2"1345 };1346 resp, body = self.api_client.postConvertionRates(body)1347 print (resp)1348 # Verify POST1349 get_resp, get_body = self.api_client.getConversionRatesById(body['id'])1350 passOfResponseCode = assertEqual(resp, 201) & assertEqual(body['currencyfrom'], get_body['currencyfrom']) & assertEqual(body['currencyto'], get_body['currencyto']) & assertEqual(body['source'], get_body['source']) & assertEqual(body['startdate'], get_body['startdate']) & assertEqual(body['enddate'], get_body['enddate']) & assertEqual(body['exchangerate'], get_body['exchangerate']) & assertEqual(body['status'], get_body['status'])1351 data = json.dumps(body)1352 data = json.loads(data)1353 print (data['id'])1354 generatedId1 = data['id']1355 body = {1356 "currencyfrom": "HKD",1357 "currencyto": "USD",1358 "source": "default22",1359 "startdate": "2058-12-06T18:25:43.511Z",1360 "enddate": "2058-12-06T18:25:43.511Z",1361 "exchangerate": "64.2"1362 };1363 resp, body = self.api_client.postConvertionRates(body)1364 print (resp)1365 # Verify POST1366 get_resp, get_body = self.api_client.getConversionRatesById(body['id'])1367 passOfResponseCode = assertEqual(resp, 201) & assertEqual(body['currencyfrom'], get_body['currencyfrom']) & assertEqual(body['currencyto'], get_body['currencyto']) & assertEqual(body['source'], get_body['source']) & assertEqual(body['startdate'], get_body['startdate']) & assertEqual(body['enddate'], get_body['enddate']) & assertEqual(body['exchangerate'], get_body['exchangerate']) & assertEqual(body['status'], get_body['status'])1368 data = json.dumps(body)1369 data = json.loads(data)1370 print (data['id'])1371 generatedId2 = data['id']1372 body = {1373 "currencyfrom": "HKD",1374 "currencyto": "USD",1375 "source": "default33",1376 "startdate": "2058-12-06T18:25:43.511Z",1377 "enddate": "2058-12-06T18:25:43.511Z",1378 "exchangerate": "64.2"1379 };1380 resp, body = self.api_client.postConvertionRates(body)1381 print (resp)1382 # Verify POST1383 get_resp, get_body = self.api_client.getConversionRatesById(body['id'])1384 passOfResponseCode = assertEqual(resp, 201) & assertEqual(body['currencyfrom'], get_body['currencyfrom']) & assertEqual(body['currencyto'], get_body['currencyto']) & assertEqual(body['source'], get_body['source']) & assertEqual(body['startdate'], get_body['startdate']) & assertEqual(body['enddate'], get_body['enddate']) & assertEqual(body['exchangerate'], get_body['exchangerate']) & assertEqual(body['status'], get_body['status'])1385 data = json.dumps(body)1386 data = json.loads(data)1387 print (data['id'])1388 generatedId3 = data['id']1389 #call the ACTIVE API1390 resp, body = self.api_client.getConversionRates_validStaus()1391 data = json.dumps(body)1392 data = json.loads(data)1393 print (data[0]['id'])1394 currencyId=data[0]['id']1395 # DELETE THE FIRST RECORD1396 resp, body = self.api_client.deleteConvertionRates(data[0]['id'])1397 print (resp)1398 logger.info("API response for Delete by ID:" + str(resp))1399 # call the ACTIVE API1400 resp, body = self.api_client.getConversionRates_validStaus()1401 data = json.dumps(body)1402 data = json.loads(data)1403 #Check whether id is not present on not1404 i = 01405 latestCurrencyId = ""1406 for currency in data:1407 print (data[i]['id'])1408 latestCurrencyId = data[i]['id']1409 if latestCurrencyId == currencyId:1410 passed = False1411 status['CAM-APITest'] = False1412 # resp, body = self.api_client.deleteConvertionRates(generatedId)1413 print (resp)1414 break1415 else:1416 passed = True1417 status['CAM-APITest'] = passed1418 i = i + 11419 resp, body = self.api_client.deleteConvertionRates(generatedId)1420 print (resp)1421 resp, body = self.api_client.deleteConvertionRates(generatedId1)1422 print (resp)1423 resp, body = self.api_client.deleteConvertionRates(generatedId2)1424 print (resp)1425 resp, body = self.api_client.deleteConvertionRates(generatedId3)1426 print (resp)1427 return passed1428 except:1429 status['CAM-APITest'] = False1430 return False1431 @assignOrder(517)1432 def CORE3671_VerifyActiveWithHistoryAPI_DeletedRecords(self):1433 try:1434 passed = False1435 # create and update the first record1436 body = {1437 "currencyfrom": "HKD",1438 "currencyto": "USD",1439 "source": "default",1440 "startdate": "2058-12-06T18:25:43.511Z",1441 "enddate": "2058-12-06T18:25:43.511Z",1442 "exchangerate": "64.2"1443 };1444 resp, body = self.api_client.postConvertionRates(body)1445 print (resp)1446 # Verify POST1447 get_resp, get_body = self.api_client.getConversionRatesById(body['id'])1448 passOfResponseCode = assertEqual(resp, 201) & assertEqual(body['currencyfrom'], get_body['currencyfrom']) & assertEqual(body['currencyto'], get_body['currencyto']) & assertEqual(body['source'], get_body['source']) & assertEqual(body['startdate'], get_body['startdate']) & assertEqual(body['enddate'], get_body['enddate']) & assertEqual(body['exchangerate'], get_body['exchangerate']) & assertEqual(body['status'], get_body['status'])1449 data = json.dumps(body)1450 data = json.loads(data)1451 print (data['id'])1452 generatedId = data['id']1453 # update the Record1454 body = {1455 "currencyfrom": "HKD",1456 "currencyto": "USD",1457 "source": "default",1458 "startdate": "2058-12-06T18:25:43.511Z",1459 "enddate": "2058-12-06T18:25:43.511Z",1460 "exchangerate": "64.3",1461 "status": "ACTIVE"1462 };1463 resp, body = self.api_client.update_convertionRates(body, generatedId);1464 print ("Response for Update is:" +str(resp))1465 logger.info("API response for Response:" + str(resp))1466 # Verify Update1467 get_resp, get_body = self.api_client.getConversionRatesById(body['id'])1468 passOfResponseCode = assertEqual(resp, 201) & assertEqual(body['currencyfrom'], get_body['currencyfrom']) & assertEqual(body['currencyto'], get_body['currencyto']) & assertEqual(body['source'], get_body['source']) & assertEqual(body['startdate'], get_body['startdate']) & assertEqual(body['enddate'], get_body['enddate']) & assertEqual(body['exchangerate'], get_body['exchangerate']) & assertEqual(body['status'], get_body['status'])1469 # create and update the 2nd record1470 body = {1471 "currencyfrom": "HKD",1472 "currencyto": "USD",1473 "source": "default44",1474 "startdate": "2058-12-06T18:25:43.511Z",1475 "enddate": "2058-12-06T18:25:43.511Z",1476 "exchangerate": "64.2"1477 };1478 resp, body = self.api_client.postConvertionRates(body)1479 print (resp)1480 # Verify POST1481 get_resp, get_body = self.api_client.getConversionRatesById(body['id'])1482 passOfResponseCode = assertEqual(resp, 201) & assertEqual(body['currencyfrom'], get_body['currencyfrom']) & assertEqual(body['currencyto'], get_body['currencyto']) & assertEqual(body['source'], get_body['source']) & assertEqual(body['startdate'], get_body['startdate']) & assertEqual(body['enddate'], get_body['enddate']) & assertEqual(body['exchangerate'], get_body['exchangerate']) & assertEqual(body['status'], get_body['status'])1483 data = json.dumps(body)1484 data = json.loads(data)1485 print (data['id'])1486 generatedId2 = data['id']1487 # update the Record1488 body = {1489 "currencyfrom": "HKD",1490 "currencyto": "USD",1491 "source": "default44",1492 "startdate": "2058-12-06T18:25:43.511Z",1493 "enddate": "2058-12-06T18:25:43.511Z",1494 "exchangerate": "64.3",1495 "status": "ACTIVE"1496 };1497 resp, body = self.api_client.update_convertionRates(body, generatedId);1498 print ("Response for Update is:" + str(resp))1499 logger.info("API response for Response:" + str(resp))1500 # Verify Update1501 get_resp, get_body = self.api_client.getConversionRatesById(body['id'])1502 passOfResponseCode = assertEqual(resp, 201) & assertEqual(body['currencyfrom'], get_body['currencyfrom']) & assertEqual(body['currencyto'], get_body['currencyto']) & assertEqual(body['source'], get_body['source']) & assertEqual(body['startdate'], get_body['startdate']) & assertEqual(body['enddate'], get_body['enddate']) & assertEqual(body['exchangerate'], get_body['exchangerate']) & assertEqual(body['status'], get_body['status'])1503 # create and update the 3rd record1504 body = {1505 "currencyfrom": "HKD",1506 "currencyto": "USD",1507 "source": "default55",1508 "startdate": "2058-12-06T18:25:43.511Z",1509 "enddate": "2058-12-06T18:25:43.511Z",1510 "exchangerate": "64.2"1511 };1512 resp, body = self.api_client.postConvertionRates(body)1513 print (resp)1514 # Verify POST1515 get_resp, get_body = self.api_client.getConversionRatesById(body['id'])1516 passOfResponseCode = assertEqual(resp, 201) & assertEqual(body['currencyfrom'], get_body['currencyfrom']) & assertEqual(body['currencyto'], get_body['currencyto']) & assertEqual(body['source'], get_body['source']) & assertEqual(body['startdate'], get_body['startdate']) & assertEqual(body['enddate'], get_body['enddate']) & assertEqual(body['exchangerate'], get_body['exchangerate']) & assertEqual(body['status'], get_body['status'])1517 data = json.dumps(body)1518 data = json.loads(data)1519 print (data['id'])1520 generatedId3 = data['id']1521 # update the Record1522 body = {1523 "currencyfrom": "HKD",1524 "currencyto": "USD",1525 "source": "default55",1526 "startdate": "2058-12-06T18:25:43.511Z",1527 "enddate": "2058-12-06T18:25:43.511Z",1528 "exchangerate": "64.3",1529 "status": "ACTIVE"1530 };1531 resp, body = self.api_client.update_convertionRates(body, generatedId);1532 print ("Response for Update is:" + str(resp))1533 logger.info("API response for Response:" + str(resp))1534 # Verify Update1535 get_resp, get_body = self.api_client.getConversionRatesById(body['id'])1536 passOfResponseCode = assertEqual(resp, 201) & assertEqual(body['currencyfrom'], get_body['currencyfrom']) & assertEqual(body['currencyto'], get_body['currencyto']) & assertEqual(body['source'], get_body['source']) & assertEqual(body['startdate'], get_body['startdate']) & assertEqual(body['enddate'], get_body['enddate']) & assertEqual(body['exchangerate'], get_body['exchangerate']) & assertEqual(body['status'], get_body['status'])1537 # call the ACTIVE API1538 resp, body = self.api_client.getConversionRates_validStausWithHistory()1539 data = json.dumps(body)1540 data = json.loads(data)1541 print (data[0]['id'])1542 currencyId = data[0]['id']1543 # DELETE THE FIRST RECORD1544 resp, body = self.api_client.deleteConvertionRates(data[0]['id'])1545 print (resp)1546 logger.info("API response for Delete by ID:" + str(resp))1547 # call the ACTIVE API1548 resp, body = self.api_client.getConversionRates_validStaus()1549 data = json.dumps(body)1550 data = json.loads(data)1551 # Check whether id is not present on not1552 i = 01553 latestCurrencyId = ""1554 for currency in data:1555 print (data[i]['id'])1556 latestCurrencyId = data[i]['id']1557 if latestCurrencyId == currencyId:1558 passed = False1559 status['CAM-APITest'] = False1560 print (resp)1561 break1562 else:1563 passed = True1564 status['CAM-APITest'] = passed1565 i = i + 11566 resp, body = self.api_client.deleteConvertionRates(generatedId)1567 print (resp)1568 resp, body = self.api_client.deleteConvertionRates(generatedId2)1569 print (resp)1570 resp, body = self.api_client.deleteConvertionRates(generatedId3)1571 print (resp)1572 return passed1573 except:1574 status['CAM-APITest'] = False1575 return False1576 @assignOrder(518)1577 def CORE3671_getCurrency_MultipleParameter_WithStartDate(self):1578 try:1579 passed = False1580 body = {1581 "currencyfrom": "HKD",1582 "currencyto": "USD",1583 "source": "automationDateParameter",1584 "startdate": "2088-12-06T18:25:43.511Z",1585 "enddate": "2088-12-11T18:25:43.511Z",1586 "exchangerate": "64.2"1587 };1588 resp, body = self.api_client.postConvertionRates(body)1589 print (resp)1590 # Verify POST1591 get_resp, get_body = self.api_client.getConversionRatesById(body['id'])1592 passOfResponseCode = assertEqual(resp, 201) & assertEqual(body['currencyfrom'], get_body['currencyfrom']) & assertEqual(body['currencyto'], get_body['currencyto']) & assertEqual(body['source'], get_body['source']) & assertEqual(body['startdate'], get_body['startdate']) & assertEqual(body['enddate'], get_body['enddate']) & assertEqual(body['exchangerate'], get_body['exchangerate']) & assertEqual(body['status'], get_body['status'])1593 data = json.dumps(body)1594 data = json.loads(data)1595 print (data['id'])1596 generatedId = data['id']1597 # call the multiple parameter api1598 resp, body = self.api_client.getConversionRates_multipleParameterwithDate('HKD','USD','automationDateParameter','2088-12-06T18:25:43.511Z')1599 print (resp)1600 data = json.dumps(body)1601 data = json.loads(data)1602 print (data[0]['id'])1603 i = 01604 latestCurrencyId = ""1605 for currency in data:1606 latestCurrencyId = data[i]['id']1607 print (latestCurrencyId)1608 latestCurrencyStatus = data[i]['status']1609 print (latestCurrencyStatus)1610 if (latestCurrencyId == generatedId) and (latestCurrencyStatus == 'ACTIVE') :1611 passed = True1612 status['CAM-APITest'] = passed1613 resp, body = self.api_client.deleteConvertionRates(generatedId)1614 print (resp)1615 return passed1616 else:1617 i = i + 11618 except:1619 resp, body = self.api_client.deleteConvertionRates(generatedId)1620 print (resp)1621 status['CAM-APITest'] = False1622 return False1623 @assignOrder(519)1624 def CORE3671_getCurrency_MultipleParameter_WithEndDate(self):1625 try:1626 passed = False1627 body = {1628 "currencyfrom": "HKD",1629 "currencyto": "USD",1630 "source": "automationDateParameter",1631 "startdate": "2088-12-06T18:25:43.511Z",1632 "enddate": "2088-12-12T18:25:43.511Z",1633 "exchangerate": "64.2"1634 };1635 resp, body = self.api_client.postConvertionRates(body)1636 print (resp)1637 # Verify POST1638 get_resp, get_body = self.api_client.getConversionRatesById(body['id'])1639 passOfResponseCode = assertEqual(resp, 201) & assertEqual(body['currencyfrom'], get_body['currencyfrom']) & assertEqual(body['currencyto'], get_body['currencyto']) & assertEqual(body['source'], get_body['source']) & assertEqual(body['startdate'], get_body['startdate']) & assertEqual(body['enddate'], get_body['enddate']) & assertEqual(body['exchangerate'], get_body['exchangerate']) & assertEqual(body['status'], get_body['status'])1640 data = json.dumps(body)1641 data = json.loads(data)1642 print (data['id'])1643 generatedId = data['id']1644 # call the multiple parameter api1645 resp, body = self.api_client.getConversionRates_multipleParameterwithDate('HKD','USD','automationDateParameter','2088-12-10T18:25:43.511Z')1646 print (resp)1647 data = json.dumps(body)1648 data = json.loads(data)1649 print (data)1650 # Check whether id is not present on not1651 i = 01652 latestCurrencyId = ""1653 for currency in data:1654 print (data[i]['id'])1655 print (data[i]['status'])1656 latestCurrencyId = data[i]['id']1657 latestCurrencyStatus = data[i]['status']1658 if (latestCurrencyId == generatedId) and (latestCurrencyStatus == 'ACTIVE'):1659 passed = True1660 status['CAM-APITest'] = passed1661 else:1662 i = i + 11663 resp, body = self.api_client.deleteConvertionRates(generatedId)1664 print (resp)1665 return passed1666 except:1667 resp, body = self.api_client.deleteConvertionRates(generatedId)1668 print (resp)1669 status['CAM-APITest'] = False1670 return False1671 @assignOrder(520)1672 def CORE3671_getCurrency_MultipleParameter_WithBetween_StartEndDate(self):1673 try:1674 passed = False1675 body = {1676 "currencyfrom": "HKD",1677 "currencyto": "USD",1678 "source": "automationDateParameter",1679 "startdate": "2088-12-06T18:25:43.511Z",1680 "enddate": "2088-12-11T18:25:43.511Z",1681 "exchangerate": "64.2"1682 };1683 resp, body = self.api_client.postConvertionRates(body)1684 print (resp)1685 # Verify POST1686 get_resp, get_body = self.api_client.getConversionRatesById(body['id'])1687 passOfResponseCode = assertEqual(resp, 201) & assertEqual(body['currencyfrom'], get_body['currencyfrom']) & assertEqual(body['currencyto'], get_body['currencyto']) & assertEqual(body['source'], get_body['source']) & assertEqual(body['startdate'], get_body['startdate']) & assertEqual(body['enddate'], get_body['enddate']) & assertEqual(body['exchangerate'], get_body['exchangerate']) & assertEqual(body['status'], get_body['status'])1688 data = json.dumps(body)1689 data = json.loads(data)1690 print (data['id'])1691 generatedId = data['id']1692 # call the multiple parameter api1693 resp, body = self.api_client.getConversionRates_multipleParameterwithDate('HKD', 'USD',1694 'automationDateParameter',1695 '2088-12-08T18:25:43.511Z')1696 print (resp)1697 print (data)1698 data = json.dumps(body)1699 data = json.loads(data)1700 # Check whether id is not present on not1701 i = 01702 latestCurrencyId = ""1703 for currency in data:1704 print (data[i]['id'])1705 print (data[i]['status'])1706 latestCurrencyId = data[i]['id']1707 latestCurrencyStatus = data[i]['status']1708 if (latestCurrencyId == generatedId) and (latestCurrencyStatus == 'ACTIVE'):1709 passed = True1710 status['CAM-APITest'] = passed1711 else:1712 i = i + 11713 resp, body = self.api_client.deleteConvertionRates(generatedId)1714 print (resp)1715 return passed1716 except:1717 resp, body = self.api_client.deleteConvertionRates(generatedId)1718 print (resp)1719 status['CAM-APITest'] = False1720 return False1721 @assignOrder(521)1722 def CORE2327_update_onlyExchangeRate(self):1723 try:1724 passed = False1725 year = random.randint(2500, 2600)1726 month = random.randint(10, 12)1727 day = random.randint(10, 28)1728 print ("Current year: %d" % year)1729 print ("Current month: %d" % month)1730 print ("Current day: %d" % day)1731 completeDate = str(year) + "-" + str(month) + "-" + str(day) + "T" + "18:25:43.511" + "Z"1732 print (completeDate)1733 body = {1734 "currencyfrom": "EUR",1735 "currencyto": "USD",1736 "source": "default",1737 "startdate": completeDate,1738 "enddate": completeDate,1739 "exchangerate": "64.2",1740 "status": "ACTIVE"1741 };1742 resp, body = self.api_client.postConvertionRates(body)1743 print (resp)1744 # Verify POST1745 get_resp, get_body = self.api_client.getConversionRatesById(body['id'])1746 passOfResponseCode = assertEqual(resp, 201) & assertEqual(body['currencyfrom'], get_body['currencyfrom']) & assertEqual(body['currencyto'], get_body['currencyto']) & assertEqual(body['source'], get_body['source']) & assertEqual(body['startdate'], get_body['startdate']) & assertEqual(body['enddate'], get_body['enddate']) & assertEqual(body['exchangerate'], get_body['exchangerate']) & assertEqual(body['status'], get_body['status'])1747 data = json.dumps(body)1748 data = json.loads(data)1749 print (data['id'])1750 logger.info("API response:" + str(resp))1751 if resp == 409:1752 print ("Record Already Exist")1753 passOfResponseCode = assertEqual(resp, 409)1754 if (passOfResponseCode):1755 passed = True1756 status['CAM-APITest'] = passed1757 return passed1758 else:1759 passOfResponseCode = assertEqual(resp, 201)1760 data = json.dumps(body)1761 data = json.loads(data)1762 print (data['id'])1763 body = {1764 "currencyfrom": "EUR",1765 "currencyto": "USD",1766 "source": "default",1767 "startdate": completeDate,1768 "enddate": completeDate,1769 "exchangerate": "64.5",1770 "status": "ACTIVE"1771 };1772 resp, body = self.api_client.update_convertionRates(body, data['id']);1773 print (resp)1774 logger.info("API response:" + str(resp))1775 # Verify Update1776 get_resp, get_body = self.api_client.getConversionRatesById(body['id'])1777 passOfResponseCode = assertEqual(resp, 200) & assertEqual(body['currencyfrom'], get_body['currencyfrom']) & assertEqual(body['currencyto'], get_body['currencyto']) & assertEqual(body['source'], get_body['source']) & assertEqual(body['startdate'], get_body['startdate']) & assertEqual(body['enddate'], get_body['enddate']) & assertEqual(body['exchangerate'], get_body['exchangerate']) & assertEqual(body['status'], get_body['status'])1778 resp, body = self.api_client.deleteConvertionRates(data['id'])1779 print (resp)1780 if (passOfResponseCode):1781 passed = True1782 status['CAM-APITest'] = passed1783 return passed1784 except:1785 status['CAM-APITest'] = False1786 return False1787 @assignOrder(522)1788 def postValidInstanceCurrency_CORE_5309(self):1789 try :1790 passed = False1791 body = {1792 "Alphabetic Code":["USD","INR"]1793 };1794 resp, body = self.api_client.postInstanceCurrency(body)1795 print (resp)1796 logger.info("API response:" + str(resp))1797 passOfResponseCode = assertEqual(resp, 200)1798 if(passOfResponseCode) :1799 passed = True1800 status['CAM-APITest'] = passed1801 return passed1802 else :1803 status['CAM-APITest'] = False1804 return passed1805 except:1806 status['CAM-APITest'] = False1807 return1808 @assignOrder(523)1809 def postInValidInstanceCurrency_CORE_5309(self):1810 try :1811 passed = False1812 body = {1813 "Alphabetic Code":["USD33"]1814 };1815 resp, body = self.api_client.postInstanceCurrency(body)1816 print (resp)1817 logger.info("API response:" + str(resp))1818 passOfResponseCode = assertEqual(resp, 400)1819 if(passOfResponseCode) :1820 passed = True1821 status['CAM-APITest'] = passed1822 return passed1823 else :1824 status['CAM-APITest'] = False1825 return passed1826 except:1827 status['CAM-APITest'] = False...
api.py
Source:api.py
1from flask import Flask, request, redirect, url_for, flash, jsonify2from flask_cors import CORS, cross_origin3import json4app = Flask(__name__)5cors = CORS(app)6app.config['CORS_HEADERS'] = 'Content-Type'7KEY = ''8TOKEN = ''9BASE_URL = 'https://api.us.cumul.io/0.1.0/'10CUSTOM_INTEGRATION = "< integration_id >"11@app.route('/', methods=['GET'])12def index():13 return "Hello World"14@app.route('/api/v1/cumul/token', methods=['POST'])15def get_cumul_token():16 import pycurl17 from io import BytesIO18 bytes_object = BytesIO()19 curl_object = pycurl.Curl()20 data = {21 "action": "create",22 "version": "0.1.0",23 "key": KEY,24 "token": TOKEN, 25 "properties": {26 "integration_id": CUSTOM_INTEGRATION,27 "type": "sso",28 "expiry": "24 hours",29 "inactivity_interval": "10 minutes",30 "username": "jesus.huazano@rankmi.com",31 "name": "Jesus Huazano",32 "email": "jesus.huazano@rankmi.com",33 "suborganization": "Air Force",34 "role": "viewer",35 }36 }37 curl_object.setopt(curl_object.URL, BASE_URL + 'authorization')38 curl_object.setopt(curl_object.HTTPHEADER, ['Content-Type: application/json','Accept-Charset: UTF-8'])39 curl_object.setopt(curl_object.POSTFIELDS, json.dumps(data).encode('utf-8'))40 curl_object.setopt(curl_object.WRITEDATA, bytes_object)41 curl_object.perform() 42 curl_object.close()43 get_body = json.loads( bytes_object.getvalue().decode('utf8') )44 print(get_body)45 sso_id = get_body['id']46 sso_token = get_body['token']47 sso_user_id = get_body['user_id']48 bytes_object = BytesIO()49 curl_object = pycurl.Curl()50 data = { 51 "action": "get",52 "version": "0.1.0", 53 "key": KEY,54 "token": TOKEN, 55 "find": {56 "attributes": ["id", "name", "contents", "type"],57 "include": [],58 "type": "dashboard"59 }60 }61 curl_object.setopt(curl_object.URL, BASE_URL + 'securable')62 curl_object.setopt(curl_object.HTTPHEADER, ['Content-Type: application/json','Accept-Charset: UTF-8'])63 curl_object.setopt(curl_object.POSTFIELDS, json.dumps(data).encode('utf-8'))64 curl_object.setopt(curl_object.WRITEDATA, bytes_object)65 curl_object.perform() 66 curl_object.close()67 get_dashboards = json.loads( bytes_object.getvalue().decode('utf8') )68 return jsonify({69 "full": get_body,70 "sso_id": sso_id,71 "sso_token": sso_token,72 "sso_user_id": sso_user_id,73 "items": get_dashboards74 })75@app.route('/api/v1/cumul/create/integration', methods=['POST'])76def create_cumul_integration():77 import pycurl78 from io import BytesIO79 bytes_object = BytesIO()80 curl_object = pycurl.Curl()81 post_data = request.get_json()82 data = {83 "action": "create",84 "key": KEY, #post_data['key'],85 "token": TOKEN, #post_data['token'],86 "version": "0.1.0",87 "properties": {88 "name": {89 "en": "Integration EN",90 "fr": "Integration FR"91 }92 }93 }94 curl_object.setopt(curl_object.URL, BASE_URL + 'integration')95 curl_object.setopt(curl_object.HTTPHEADER, ['Content-Type: application/json','Accept-Charset: UTF-8'])96 curl_object.setopt(curl_object.POSTFIELDS, json.dumps(data).encode('utf-8'))97 curl_object.setopt(curl_object.WRITEDATA, bytes_object)98 curl_object.perform() 99 curl_object.close()100 get_body = json.loads( bytes_object.getvalue().decode('utf8') )101 return jsonify(get_body)102@app.route('/api/v1/cumul/associate/integration/dataset', methods=['POST'])103def create_cumul_integration_associate_dataset():104 import pycurl105 from io import BytesIO106 bytes_object = BytesIO()107 curl_object = pycurl.Curl()108 post_data = request.get_json()109 data = {110 "action": "associate",111 "key": KEY,112 "token": TOKEN,113 "version": "0.1.0",114 "id": post_data['integration_id'],115 "resource": {116 "role": "Securables",117 "id": post_data['dataset_id']118 },119 "properties": {120 "flagRead": True121 }122 }123 curl_object.setopt(curl_object.URL, BASE_URL + 'integration')124 curl_object.setopt(curl_object.HTTPHEADER, ['Content-Type: application/json','Accept-Charset: UTF-8'])125 curl_object.setopt(curl_object.POSTFIELDS, json.dumps(data).encode('utf-8'))126 curl_object.setopt(curl_object.WRITEDATA, bytes_object)127 curl_object.perform() 128 curl_object.close()129 get_body = json.loads( bytes_object.getvalue().decode('utf8') )130 return jsonify(get_body)131@app.route('/api/v1/cumul/associate/integration/dashboard', methods=['POST'])132def create_cumul_integration_associate_dashboard():133 import pycurl134 from io import BytesIO135 bytes_object = BytesIO()136 curl_object = pycurl.Curl()137 post_data = request.get_json()138 data = {139 "action": "associate",140 "key": KEY,141 "token": TOKEN,142 "version": "0.1.0",143 "id": post_data['integration_id'],144 "resource": {145 "role": "Securables",146 "id": post_data['dashboard_id']147 },148 "properties": {149 "flagRead": True150 }151 }152 curl_object.setopt(curl_object.URL, BASE_URL + 'integration')153 curl_object.setopt(curl_object.HTTPHEADER, ['Content-Type: application/json','Accept-Charset: UTF-8'])154 curl_object.setopt(curl_object.POSTFIELDS, json.dumps(data).encode('utf-8'))155 curl_object.setopt(curl_object.WRITEDATA, bytes_object)156 curl_object.perform() 157 curl_object.close()158 get_body = json.loads( bytes_object.getvalue().decode('utf8') )159 return jsonify(get_body)160@app.route('/api/v1/cumul/token/multitenancy', methods=['POST'])161def get_cumul_token_multitenancy():162 import pycurl163 from io import BytesIO164 bytes_object = BytesIO()165 curl_object = pycurl.Curl()166 data = {167 "action": "create",168 "version": "0.1.0",169 "key": KEY,170 "token": TOKEN, 171 "properties": {172 "integration_id": CUSTOM_INTEGRATION,173 "type": "sso",174 "expiry": "24 hours",175 "inactivity_interval": "10 minutes",176 "username": "jesus.huazano@rankmi.com",177 "name": "Jesus Huazano",178 "email": "jesus.huazano@rankmi.com",179 "suborganization": "Air Force",180 "role": "viewer",181 "account_overrides": { 182 "2de71311-daed-475e-81c5-9444ac95a15e" : {183 "host": "cumul2.cetlhze6fmhm.us-east-2.rds.amazonaws.com",184 "port": ""< port >"",185 "user": "< usuario >",186 "password": "sw123456",187 "database": "sip",188 "schema": "catalogos",189 "table": "pais"190 },191 "0c3711d6-0dcd-462f-8da2-e9cc38b61841": {192 "host": "cumul1.cetlhze6fmhm.us-east-2.rds.amazonaws.com",193 "port": ""< port >"",194 "user": "< usuario >",195 "password": "sw123456",196 "database": "sip2",197 "schema": "catalogos",198 "table": "estado"199 },200 "32ac3cee-1a6f-46f0-8ef9-4be122a6bd7d":{201 "host": "cumul1.cetlhze6fmhm.us-east-2.rds.amazonaws.com",202 "port": ""< port >"",203 "user": "< usuario >",204 "password": "sw123456",205 "database": "sip2",206 "schema": "catalogos",207 "table": "municipio"208 }209 }210 }211 }212 curl_object.setopt(curl_object.URL, BASE_URL + 'authorization')213 curl_object.setopt(curl_object.HTTPHEADER, ['Content-Type: application/json','Accept-Charset: UTF-8'])214 curl_object.setopt(curl_object.POSTFIELDS, json.dumps(data).encode('utf-8'))215 curl_object.setopt(curl_object.WRITEDATA, bytes_object)216 curl_object.perform() 217 curl_object.close()218 get_body = json.loads( bytes_object.getvalue().decode('utf8') )219 sso_id = get_body['id']220 sso_token = get_body['token']221 sso_user_id = get_body['user_id']222 return jsonify({223 "full": get_body,224 "sso_id": sso_id,225 "sso_token": sso_token,226 "sso_user_id": sso_user_id,227 })228@app.route('/api/v1/cumul/token/multitenancy/user1', methods=['POST'])229def get_cumul_token_multitenancy_user1():230 import pycurl231 from io import BytesIO232 bytes_object = BytesIO()233 curl_object = pycurl.Curl()234 post_data = request.get_json()235 data = {236 "action": "create",237 "version": "0.1.0",238 "key": KEY,239 "token": TOKEN, 240 "properties": {241 "type": "temporary",242 "expiry": "24 hours",243 "inactivity_interval": "40 minutes",244 "securables": ["< dashboards_id >"],245 "metadata": {246 "area": post_data['areas'],247 "positions":[]248 }249 }250 }251 curl_object.setopt(curl_object.URL, BASE_URL + 'authorization')252 curl_object.setopt(curl_object.HTTPHEADER, ['Content-Type: application/json','Accept-Charset: UTF-8'])253 curl_object.setopt(curl_object.POSTFIELDS, json.dumps(data).encode('utf-8'))254 curl_object.setopt(curl_object.WRITEDATA, bytes_object)255 curl_object.perform() 256 curl_object.close()257 get_body = json.loads( bytes_object.getvalue().decode('utf8') )258 print(get_body)259 sso_id = get_body['id']260 sso_token = get_body['token']261 sso_user_id = get_body['user_id']262 return jsonify({263 "full": get_body,264 "dashboard_id": "< dashboards_id >",265 "sso_id": sso_id,266 "sso_token": sso_token,267 "sso_user_id": sso_user_id,268 })269@app.route('/api/v1/cumul/token/multitenancy/user2', methods=['POST'])270def get_cumul_token_multitenancy_user2():271 import pycurl272 from io import BytesIO273 bytes_object = BytesIO()274 curl_object = pycurl.Curl()275 post_data = request.get_json()276 '''277 data = {278 "action": "create",279 "version": "0.1.0",280 "key": KEY,281 "token": TOKEN, 282 "properties": {283 "type": "sso",284 "expiry": "24 hours",285 "inactivity_interval": "10 minutes",286 "username": "jesus.huazano2@rankmi.com",287 "name": "Jesus Huazano 2",288 "email": "jesus.huazano2@rankmi.com",289 "suborganization": "Air Force",290 "integration_id": "< integration_id >",291 "role": "viewer",292 "account_overrides": { 293 "< account_id >" : {294 "host": "< host >",295 "port": "< port >",296 "user": "< usuario >",297 "password": "< password >",298 "database": "< database >_112",299 "schema": "< schema >",300 "table": "< table >",301 "datasets": {302 "< dataset_id >": {303 "sql": "< query >"304 }305 }306 }307 }308 }309 }310 '''311 data = {312 "action": "create",313 "version": "0.1.0",314 "key": KEY,315 "token": TOKEN, 316 "properties": {317 "type": "temporary",318 "expiry": "24 hours",319 "inactivity_interval": "40 minutes",320 "username": "jesus.huazano2@rankmi.com",321 "name": "Jesus Huazano 2",322 "email": "jesus.huazano2@rankmi.com",323 "securables": ["< dashboards_id >"],324 "metadata": {325 "area": post_data['areas'],326 "positions":[]327 },328 "account_overrides": { 329 "< account_id >" : {330 "host": "< host >",331 "port": "< port >",332 "user": "< usuario >",333 "password": "< password >",334 "database": "< database >",335 "schema": "< schema >",336 "table": "< table >",337 "datasets": {338 "< dataset_id >": {339 "sql": "< query >"340 }341 }342 }343 }344 }345 }346 print("·"*300)347 print(data)348 print("·"*300)349 curl_object.setopt(curl_object.URL, BASE_URL + 'authorization')350 curl_object.setopt(curl_object.HTTPHEADER, ['Content-Type: application/json','Accept-Charset: UTF-8'])351 curl_object.setopt(curl_object.POSTFIELDS, json.dumps(data).encode('utf-8'))352 curl_object.setopt(curl_object.WRITEDATA, bytes_object)353 curl_object.perform() 354 curl_object.close()355 get_body = json.loads( bytes_object.getvalue().decode('utf8') )356 sso_id = get_body['id']357 sso_token = get_body['token']358 sso_user_id = get_body['user_id']359 return jsonify({360 "dashboard_id": "< dashboards_id >",361 "full": get_body,362 "sso_id": sso_id,363 "sso_token": sso_token,364 "sso_user_id": sso_user_id,365 })366@app.route('/api/v1/cumul/token/multitenancy/user3', methods=['POST'])367def get_cumul_token_multitenancy_user3():368 import pycurl369 from io import BytesIO370 bytes_object = BytesIO()371 curl_object = pycurl.Curl()372 post_data = request.get_json()373 data = {374 "action": "create",375 "version": "0.1.0",376 "key": KEY,377 "token": TOKEN, 378 "properties": {379 "type": "temporary",380 "expiry": "24 hours",381 "inactivity_interval": "40 minutes",382 "username": "jesus.huazano3@rankmi.com",383 "name": "Jesus Huazano 3",384 "email": "jesus.huazano3@rankmi.com",385 "securables": ["< dashboards_id >"],386 "metadata": {387 "area": [],388 "positions":[]389 },390 "account_overrides": { 391 "< account_id >" : {392 "host": "< host >",393 "port": "< port >",394 "user": "< usuario >",395 "password": "< password >",396 "database": "< database >",397 "schema": "< schema >",398 "table": "< table >",399 "datasets": {400 "< dataset_id >": {401 "sql": "< query >"402 }403 }404 }405 }406 }407 }408 curl_object.setopt(curl_object.URL, BASE_URL + 'authorization')409 curl_object.setopt(curl_object.HTTPHEADER, ['Content-Type: application/json','Accept-Charset: UTF-8'])410 curl_object.setopt(curl_object.POSTFIELDS, json.dumps(data).encode('utf-8'))411 curl_object.setopt(curl_object.WRITEDATA, bytes_object)412 curl_object.perform() 413 curl_object.close()414 get_body = json.loads( bytes_object.getvalue().decode('utf8') )415 print(get_body)416 sso_id = get_body['id']417 sso_token = get_body['token']418 sso_user_id = get_body['user_id']419 return jsonify({420 "dashboard_id": "< dashboards_id >",421 "full": get_body,422 "sso_id": sso_id,423 "sso_token": sso_token,424 "sso_user_id": sso_user_id,425 })426if __name__=='__main__':...
1.py
Source:1.py
...4Arbiter.py: def rotate(self):5Arbiter.py: def declare_weight_inputs(self):6Arbiter.py: def declare_weight_vectors(self):7Arbiter.py: def declare_weight_registers(self):8Arbiter.py: def get_body(self):9Arbiter.py: def update_weight_code(self):10Arbiter.py: def __str__(self):11CAM.py: def get_body(self):12CAM.py: def request_declaration(self):13CAM.py: def cam_locations(self):14CAM.py: def cam_write(self):15CAM.py: def assign_snoop(self):16CAM.py: def snoop_cam(self):17CAM.py: def assign_freeup(self):18CAM.py: def __str__(self):19Encoder.py: def __init__(self):20Encoder.py: def binary2gray(self):21Encoder.py: def gray2binary(self):22Encoder.py: def onehot2binary(self):23Encoder.py: def get_body(self):24Encoder.py: def __str__(self):25Multiplexor.py: def get_body(self):26Multiplexor.py: def declare_ports(self):27Multiplexor.py: def declare_vectors(self):28Multiplexor.py: def assign_data(self):29Multiplexor.py: def __str__(self):30OrderingPoint.py: def module_declaration(self):31OrderingPoint.py: def io_declaration(self):32OrderingPoint.py: def assign_wires(self):33OrderingPoint.py: def get_body(self):34OrderingPoint.py: def __str__(self):35PacketConverter.py: def get_body(self):36PacketConverter.py: def declaration(self):37PacketConverter.py: def add_collated(self):38PacketConverter.py: def assign_data(self):39PacketConverter.py: def __str__(self):40Pipe.py: def __init__(self):41Pipe.py: def pipe(self):42Pipe.py: def skid(self):43Pipe.py: def get_body(self):44Pipe.py: def __str__(self):45smartasic.py: def get_declaration(self):46smartasic.py: def __str__(self):47smartasic.py: def get_port_str(self):48smartasic.py: def get_header(self):49smartasic.py: def update(self):50smartasic.py: def get_body(self):51smartasic.py: def get_fifo_v(self):52smartasic.py: def __str__(self):53Snoopable_FIFO.py: def get_body(self):54Snoopable_FIFO.py: def declare_register(self):55Snoopable_FIFO.py: def assign_loc(self):56Snoopable_FIFO.py: def write_loc(self):57Snoopable_FIFO.py: def assign_read(self):58Snoopable_FIFO.py: def assign_snoop_match(self):...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!