How to use d_verb method in fMBT

Best Python code snippet using fMBT_python

requester.py

Source:requester.py Github

copy

Full Screen

1from urllib.request import Request, urlopen2from json import dumps3import OpenSSL4import base645class Requester:6 base_context = {'headers': {7 }8 }9 json_header = ('Content-Type', 'application/json')10 baseUrl = "https://api.stg.qwallet.md"11 def make_signature(self, data):12 signature = OpenSSL.crypto.sign(self.privatekey, data, 'sha256')13 signature = base64.b64encode(signature)14 return signature15 def debug_out(self, req, body):16 if self.debug_verbosity > 0:17 print("sending request to " + req.full_url)18 if self.debug_verbosity > 1:19 print('body: ' + body.decode('utf-8'))20 if self.debug_verbosity > 2:21 print("headers: " + str(req.headers))22 def __init__(self,public_key, private_key, checksignature="", paysignature="", statussignature="", cancelsignature='', context=None, d_verb = 0):23 f = open(public_key)24 self.publickey = OpenSSL.crypto.load_publickey(OpenSSL.crypto.FILETYPE_PEM, f.read())25 f.close()26 f = open(private_key)27 self.privatekey = OpenSSL.crypto.load_privatekey(OpenSSL.crypto.FILETYPE_PEM, f.read())28 f.close()29 self.checkUrl = self.baseUrl + checksignature30 self.payUrl = self.baseUrl + paysignature31 self.statusUrl = self.baseUrl + statussignature32 self.cancelUrl = self.baseUrl + cancelsignature33 if context is not None:34 self.context = self.base_context.copy()35 self.context.update(context)36 else:37 self.context = {}38 print (self.context)39 self.debug_verbosity = d_verb40 def check(self, walletid, amount, ccy = "498"):41 data = {42 "walletId" : walletid,43 "amount" : amount,44 "ccy" : ccy45 }46 b_data = dumps(data).encode('utf-8')47 current_req = Request(self.checkUrl, headers=self.context['headers'])48 current_req.add_header(*self.json_header)49 current_req.add_header('X-SIGNATURE', self.make_signature(b_data))50 self.debug_out(current_req, b_data)51 result = urlopen(current_req, b_data)52 return result.read()53 def pay(self, idlist, receipt, items):54 req_body = idlist.copy()55 req_body["check"] = receipt.copy()56 req_body["check"]["items"] = items57 b_data = dumps(req_body).encode('utf-8')58 current_req = Request(self.payUrl, headers=self.context['headers'])59 current_req.add_header(*self.json_header)60 current_req.add_header('X-SIGNATURE', self.make_signature(b_data))61 self.debug_out(current_req, b_data)62 result = urlopen(current_req, b_data)63 return result.read()64 def status(self, operationid):65 current_req = Request(self.statusUrl + operationid, headers=self.context['headers'])66 current_req.add_header('X-SIGNATURE', self.make_signature(operationid.encode('utf-8')))67 print('requesting: ' + current_req.full_url + "\nheaders: " + str(current_req.headers))68 def cancel(self, operationid):69 current_req = Request(self.cancelUrl, headers = self.context['headers'])70 data = dumps({ 'operationId' : operationid})71 b_data = data.encode('utf-8')72 current_req.add_header('X-SIGNATURE', self.make_signature(b_data))73 self.debug_out(current_req, b_data)74 result = urlopen(current_req, b_data)...

Full Screen

Full Screen

test7.py

Source:test7.py Github

copy

Full Screen

...24def d_noun(t, this):25 "noun : 'cat'"26 del this27 return t[0]28def d_verb(t, this):29 "verb : 'flies'"30 del this31 return t[0]...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run fMBT automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful