How to use print_result method in autotest

Best Python code snippet using autotest_python

verify.in

Source:verify.in Github

copy

Full Screen

...58 pass59def printfun(text):60 # suppress newline61 sys.stdout.write("%-50s"%text)62def print_result(rcode, rtext):63 global colour64 global retcode65 OK = '\033[92m'66 WARN = '\033[93m'67 FAIL = '\033[91m'68 ENDC = '\033[0m'69 if rcode == "FAIL":70 retcode += 171 if not rtext:72 rtext = "FAILED"73 if colour:74 print("\t[%s%s%s]"%(FAIL,rtext,ENDC))75 else:76 print("\t[%s]"%rtext)77 elif rcode == "WARN":78 if not rtext:79 rtext = "WARNING"80 if colour:81 print("\t[%s%s%s]"%(WARN,rtext,ENDC))82 else:83 print("\t[%s]"%rtext)84 elif rcode == "OK":85 if not rtext:86 rtext = "OK"87 if colour:88 print("\t[%s%s%s]"%(OK,rtext,ENDC))89 else:90 print("\t[%s]"%rtext)91 else:92 print("INTERNAL ERROR - unknown rcode:%s"%rcode)93def plutocheck():94 global retcode95 printfun("Checking that pluto is running")96 p = subprocess.Popen(["pidof", "pluto"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)97 output, err = p.communicate()98 if not output:99 retcode += 1100 print_result("FAIL","FAILED")101 return102 else:103 print_result("OK","OK")104 # only if pluto is running, do the listen tests and ipsec secrets test105 udp500check()106 udp4500check()107 ipsecsecretcheck()108# This is pretty broken, as you can enable forwarding specificaly via iptables as well109# It also won't find/exclude all kinds of interfaces. Also, lots of people have one110# ethernet and one wifi interface, but don't want to bridge these.111# So, mostly left here for historic reasons - candidate to be changed/removed112def forwardcheck():113 global retcode114 try:115 output = open("/proc/net/dev","r").read().strip()116 except:117 printfun("Checking for multiple interfaces")118 retcode += 1119 print_result("FAIL","UNEXPECTED KERNEL DEV LIST")120 count = 0121 for line in output.split("\n"):122 if ":" in line:123 if not "lo:" in line and not "ipsec" in line and not "mast" in line and not "virbr:" in line:124 # let's count this as a real physical interface125 count += 1126 if count > 1:127 printfun("Two or more interfaces found, checking IP forwarding")128 try:129 output = open("/proc/sys/net/ipv4/ip_forward","r").read().strip()130 except:131 print_result("FAIL","MISSING ip_forward proc file")132 retcode += 1133 return134 if output == "1":135 print_result("OK","OK")136 else:137 print_result("FAIL","FAILED")138 retcode += 1139def rpfiltercheck():140 global retcode141 fail = 0142 printfun("Checking rp_filter")143 for dirname in glob.glob("/proc/sys/net/ipv4/conf/*"):144 val = open("%s/rp_filter"%dirname,"r").read().strip()145 if val == "1":146 if fail == 0:147 print_result("FAIL","ENABLED")148 fail = 1149 printfun(" %s/rp_filter"%dirname)150 print_result("FAIL","ENABLED")151 retcode += 1152 if fail == 0:153 print_result("OK","OK")154 else:155 print(" rp_filter is not fully aware of IPsec and should be disabled")156def cmdchecks():157 global retcode158 printfun("Checking 'ip' command")159 if not os.path.isfile("/sbin/ip") and not os.path.isfile("/usr/sbin/ip") \160 and not os.path.isfile("/bin/ip"):161 print_result("FAIL","FAILED")162 retcode += 1163 p = subprocess.Popen(["ip", "xfrm"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)164 output, err = p.communicate()165 err = err.decode(prefencoding)166 if not "XFRM" in err:167 print_result("FAIL","IP XFRM BROKEN")168 retcode += 1169 else:170 print_result("OK","OK")171 printfun("Checking 'iptables' command")172 if not os.path.isfile("/sbin/iptables") and not os.path.isfile("/usr/sbin/iptables"):173 print_result("WARN","MISSING")174 else:175 print_result("OK","OK")176 printfun("Checking 'prelink' command does not interfere with FIPS")177 if os.path.isfile("/sbin/prelink") or os.path.isfile("/usr/sbin/prelink"):178 if os.path.isfile("/etc/prelink.cache"):179 print_result("WARN","PRESENT")180 else:181 print_result("FAIL","IN USE")182 retcode += 1183 else:184 print_result("OK","OK")185def udp500check():186 global retcode187 printfun(" Pluto listening for IKE on udp 500")188 try:189 p = subprocess.Popen(["ss", "-n", "-a", "-u", "sport = :500"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)190 output, err = p.communicate()191 output = output.decode(prefencoding)192 if ":500" in output:193 print_result("OK","OK")194 else:195 print_result("FAIL","FAILED")196 retcode += 1197 except:198 print_result("FAIL","FAILED")199 retcode += 1200def udp4500check():201 global retcode202 global sscmd203 printfun(" Pluto listening for IKE/NAT-T on udp 4500")204 if not sscmd:205 print_result("WARN","UNKNOWN")206 print("(install the 'ss' command to activate this test)")207 return208 try:209 p = subprocess.Popen([sscmd, "-n", "-a", "-u", "sport = :4500"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)210 output, err = p.communicate()211 output = output.decode(prefencoding)212 if ":4500" in output:213 print_result("OK","OK")214 else:215 print_result("WARN","DISABLED")216 except:217 print_result("FAIL","DISABLED")218 retcode += 1219def installstartcheck():220 global retcode221 print("Verifying installed system and configuration files\n")222 printfun("Version check and ipsec on-path")223 try:224 p = subprocess.Popen(["ipsec", "--version"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)225 output, err = p.communicate()226 output = output.decode(prefencoding)227 if "swan" in output:228 print_result("OK","OK")229 print(output.replace("Linux","").strip())230 else:231 print_result("FAIL","FAILED")232 except:233 print_result("FAIL","FAILED")234 printfun("Checking for IPsec support in kernel")235 if not os.path.isfile("/proc/net/ipsec_eroute") and not os.path.isfile("/proc/net/pfkey"):236 print_result("FAIL","FAILED")237 if "no kernel code presently loaded" in output:238 print("\n The ipsec service should be started before running 'ipsec verify'\n")239 return240 else:241 print_result("OK","OK")242 # we know we have some stack, so continue243 if os.path.isfile("/proc/net/ipsec_eroute"):244 installcheckklips()245 else:246 installchecknetkey()247def installcheckklips():248 global retcode249 # NAT-T patch check250 printfun(" KLIPS: checking for NAT Traversal support")251 try:252 natt = open("/sys/module/ipsec/parameters/natt_available","r").read().strip()253 if natt == "1":254 print_result("WARN","OLD STYLE")255 elif natt == "2":256 print_result("OK","OK")257 else:258 print_result("FAIL","UNKNOWN CODE")259 except:260 print_result("WARN","OLD/MISSING")261 # OCF patch check262 printfun(" KLIPS: checking for OCF crypto offload support ")263 try:264 ocf = open("/sys/module/ipsec/parameters/ocf_available","r").read().strip()265 if ocf == "1":266 print_result("OK","OK")267 elif ocf == "0":268 print_result("WARN","N/A")269 else:270 print_result("FAIL","UNKNOWN CODE")271 except:272 print_result("WARN","N/A")273 # SAref patch check274 saref = ""275 printfun(" KLIPS: IPsec SAref kernel support")276 try:277 saref = open("/proc/net/ipsec/saref","r").read().strip()278 if "refinfo patch applied" in saref:279 print_result("OK","OK")280 else:281 print_result("WARN","N/A")282 except:283 print_result("WARN","N/A")284 # SAref bind patch check285 printfun(" KLIPS: IPsec SAref Bind kernel support")286 if "bindref patch applied" in saref:287 print_result("OK","OK")288 else:289 print_result("WARN","N/A")290def installchecknetkey():291 global retcode292 print(" NETKEY: Testing XFRM related proc values")293 for option in ( "send_redirects", "accept_redirects"):294 printfun(" ICMP default/%s"%option)295 try:296 redir = open("/proc/sys/net/ipv4/conf/default/%s"%option,"r").read().strip()297 except:298 print_result("FAIL","VERY BROKEN KERNEL")299 return300 if redir == "0":301 print_result("OK","OK")302 else:303 print_result("FAIL","NOT DISABLED")304 print("\n Disable /proc/sys/net/ipv4/conf/*/%s or NETKEY will act on or cause sending of bogus ICMP redirects!\n"%option)305 printfun(" XFRM larval drop")306 try:307 larval = open("/proc/sys/net/core/xfrm_larval_drop","r").read().strip()308 except:309 print_result("FAIL","OLD OR BROKEN KERNEL")310 return311 if larval == "1":312 print_result("OK","OK")313 else:314 print_result("FAIL","NOT ENABLED")315def ipsecsecretcheck():316 global retcode317 # we need to be root, because the only way to check is to reload them318 printfun(" Pluto ipsec.secret syntax")319 uid = os.getuid()320 if uid != 0:321 print_result("WARN","UNKNOWN")322 print(" (run ipsec verify as root to test ipsec.secrets)")323 return324 p = subprocess.Popen(["ipsec","secrets"], universal_newlines=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE)325 output, err = p.communicate()326 output = output.decode(prefencoding)327 if "ERROR" in output:328 print_result("FAIL","PARSE ERROR")329 for line in output.split("\n"):330 line = line.strip()331 if line and "ERROR" in line:332 print(" %s"%line)333 elif "WARNING" in output:334 print_result("WARN","OBSOLETE")335 for line in output.split("\n"):336 line = line.strip()337 if line and "WARNING" in line:338 print(" %s"%line)339 else:340 print_result("OK","OK")341def ipsecconfcheck():342 global retcode343 printfun("Pluto ipsec.conf syntax")344 p = subprocess.Popen(["ipsec","addconn","--checkconfig"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)345 output, err = p.communicate()346 err = err.decode(prefencoding)347 if "syntax error" in err:348 print_result("FAIL","PARSE ERROR")349 print(err)350 else:351 print_result("OK","OK")352def configsetupcheck():353 global retcode354 p = subprocess.Popen(["ipsec","addconn","--configsetup"], universal_newlines=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE)355 configsetup, err = p.communicate()356 # grab obsolete settings357 printfun("Checking for obsolete ipsec.conf options")358 if not err:359 print_result("OK","OK")360 else:361 print_result("WARN","OBSOLETE KEYWORD")362 err = err.replace("Warning"," Warning")363 print(err[:-1])364def main():365 global retcode366 global sscmd367 if os.path.isfile("/usr/sbin/ss"):368 sscmd = "/usr/sbin/ss"369 elif os.path.isfile("/bin/ss"):370 sscmd = "/bin/ss"371 elif os.path.isfile("/sbin/ss"):372 sscmd = "/sbin/ss"373 installstartcheck()374 ipsecconfcheck()375 forwardcheck()...

Full Screen

Full Screen

expression_test.py

Source:expression_test.py Github

copy

Full Screen

...5 testOf, testOfSkipped,6 print_result, print_result_as_stmt, run_tests, debug, grammar )7@testOf(grammar.constant_function_call)8def test112(self):9 print_result(self.try_parse_pass("foo(0,1,2)"))10 print_result(self.try_parse_fail("foo(0,)"))11 print_result(self.try_parse_pass("foo(bar(0))"))12 print_result(self.try_parse_pass("foo(-10)"))13 print_result(self.try_parse_pass("foo( -bar(0) )"))14 print_result(self.try_parse_fail("foo( X+1 )"))15 print_result(self.try_parse_fail("A.b.c( 0)"))16@testOf(grammar.function_call)17def test113(self):18 print_result(self.try_parse_pass("foo()"))19 print_result(self.try_parse_pass("foo(0)"))20 print_result(self.try_parse_pass("foo(0,1,2)"))21 print_result(self.try_parse_pass("foo(bar(0))"))22 print_result(self.try_parse_pass("foo(-10)"))23 print_result(self.try_parse_pass("foo( -bar(0) )"))24 print_result(self.try_parse_pass("foo( X+1 )"))25 print_result(self.try_parse_pass("A.b.c( 0, 1, 2)"))26 print_result(self.try_parse_pass("A.b.c( X+1, -Z+1 )"))27 print_result(self.try_parse_pass("A.b.c( foo(0) )"))28@testOf(grammar.system_function_call)29def test114(self):30 print_result(self.try_parse_pass("$foo(0,1,2)"))31 print_result(self.try_parse_pass("$foo(bar(0))"))32 print_result(self.try_parse_pass("$foo(-10)"))33 print_result(self.try_parse_pass("$foo( -bar(0) )"))34 print_result(self.try_parse_pass("$foo( X+1 )"))35 print_result(self.try_parse_fail("$A.b.c( X+1, -Z+1 )"))36@testOf(grammar.conditional_expression)37def test116(self):38 print_result(self.try_parse_pass(" 0 ? 1 : 2"))39 print_result(self.try_parse_pass(" A ? 1 : 2"))40 print_result(self.try_parse_pass(" A+1 ? (X<0) : (Y==1)"))41 print_result(self.try_parse_pass(" A+1 ? X<0 : Y==1"))42 print_result(self.try_parse_pass(" 0?1:2 ? X<0 : Y==1"))43 print_result(self.try_parse_pass(" 0 ? 1 ? 2 : 3 : 4"))44 print_result(self.try_parse_pass(" 0 ? (1 ? 2 : 3) : 4"))45 print_result(self.try_parse_pass(" 0 ? (a() ? 2 : 3) : 4"))46 print_result(self.try_parse_pass(" 0 ? 1 : (a() ? 2 : 3)"))47 print_result(self.try_parse_pass(" 0 ? 1 : (a() ? b() : 3)"))48 print_result(self.try_parse_pass(" 0 ? (a() ? a() : 3) : 4"))49 print_result(self.try_parse_pass(" 1 ? ( a() ? a() : a() ) : 3"))50@testOf(grammar.constant_base_expression)51def test117(self):52 print_result(self.try_parse_pass("1"))53 print_result(self.try_parse_pass("1+2"))54 print_result(self.try_parse_fail("X+2"))55 print_result(self.try_parse_pass("0?1:2"))56@testOf(grammar.constant_expression)57def test118(self):58 print_result(self.try_parse_fail("A"))59 print_result(self.try_parse_pass("1"))60 print_result(self.try_parse_pass("(1)"))61 print_result(self.try_parse_pass("func(1)"))62 print_result(self.try_parse_pass("func()"))63 print_result(self.try_parse_pass("1 + 2"))64 print_result(self.try_parse_pass("1 + (2 * 3)"))65 print_result(self.try_parse_pass("(1 + 2) * 3"))66 print_result(self.try_parse_pass("0 ? 1 : 2"))67 print_result(self.try_parse_pass("IsOK() ? 1 : 2"))68 print_result(self.try_parse_pass("-0 ? 1 : 2"))69 #debug(grammar.constant_expression)70 print_result(self.try_parse_pass(" 1 ? ( a() ? a() : a() ): 3"))71 print_result(self.try_parse_pass(" 1 ? a() ? a() : a() : 3"))72 print_result(self.try_parse_pass("1 + 2 * 3"))73@testOf(grammar.constant_mintypmax_expression)74def test119(self):75 print_result(self.try_parse_fail("A"))76 print_result(self.try_parse_pass("1"))77 print_result(self.try_parse_pass("(1)"))78 print_result(self.try_parse_pass("func(1)"))79 print_result(self.try_parse_pass("func()"))80 print_result(self.try_parse_pass("1 + 2"))81 print_result(self.try_parse_pass("1 + 2 * 3"))82 print_result(self.try_parse_pass("1 + (2 * 3)"))83 print_result(self.try_parse_pass("(1 + 2) * 3"))84 print_result(self.try_parse_pass("0 ? 1 : 2"))85 print_result(self.try_parse_pass("IsOK() ? 1 : 2"))86 print_result(self.try_parse_pass("-0 ? 1 : 2"))87@testOf(grammar.constant_range_expression)88def test120(self):89 print_result(self.try_parse_pass("1:0"))90 print_result(self.try_parse_pass("1:0+10"))91 print_result(self.try_parse_fail("1:X"))92 print_result(self.try_parse_pass("func(0):{1,2}"))93@testOf(grammar.dimension_constant_expression)94def test121(self):95 print_result(self.try_parse_fail("A"))96 print_result(self.try_parse_pass("1"))97 print_result(self.try_parse_pass("(1)"))98 print_result(self.try_parse_pass("func(1)"))99 print_result(self.try_parse_pass("func()"))100 print_result(self.try_parse_pass("1 + 2"))101 print_result(self.try_parse_pass("1 + 2 * 3"))102 print_result(self.try_parse_pass("1 + (2 * 3)"))103 print_result(self.try_parse_pass("(1 + 2) * 3"))104 print_result(self.try_parse_pass("0 ? 1 : 2"))105 print_result(self.try_parse_pass("IsOK() ? 1 : 2"))106 print_result(self.try_parse_pass("-0 ? 1 : 2"))107 print_result(self.try_parse_pass(" 1 ? ( a() ? a() : a() ): 3"))108 print_result(self.try_parse_pass(" 1 ? a() ? a() : a() : 3"))109@testOf(grammar.expression)110def test122(self):111 #debug(grammar.expression)112 print_result(self.try_parse_pass("0"))113 print_result(self.try_parse_pass("A+10"))114 print_result(self.try_parse_pass("-X"))115 print_result(self.try_parse_pass("1+2+3"))116 print_result(self.try_parse_pass("-X+1"))117 print_result(self.try_parse_pass("-X+1/A"))118 print_result(self.try_parse_pass("1+2*3"))119 print_result(self.try_parse_pass("1-2*3+4/5"))120 print_result(self.try_parse_pass("1-(2*3+4)/5"))121 print_result(self.try_parse_pass("-X+1*A"))122 print_result(self.try_parse_pass("1?2:3"))123 print_result(self.try_parse_pass("-1?2:3"))124 print_result(self.try_parse_pass("A ? B : C"))125 print_result(self.try_parse_pass("A ? B : C ? D : E"))126 print_result(self.try_parse_pass("A ? B ? C : D : E"))127 print_result(self.try_parse_pass("A ? (B ? C : D) : E"))128 print_result(self.try_parse_pass("0 ? 1 : 2 ? 1 : 2"))129 print_result(self.try_parse_pass("0 ? 0 ? 1 : 2 : 2"))130 print_result(self.try_parse_pass("(0 ? 1 : 2) ? 3 : 4"))131 print_result(self.try_parse_pass("func(1)"))132 print_result(self.try_parse_pass("a + (b * c)"))133 print_result(self.try_parse_pass("(a + b) * c"))134 print_result(self.try_parse_pass("-1 + (b * c)"))135 print_result(self.try_parse_pass("-1 + (-b * ^c)"))136 print_result(self.try_parse_pass(" 1 ? ( a() ? a() : a() ): 3"))137 print_result(self.try_parse_pass(" 1 ? a() ? a() : a() : 3"))138 print_result(self.try_parse_pass("1 + 2 * 3"))139 print_result(self.try_parse_pass("1 + 2 * 3 / 4 ** 5"))140 print_result(self.try_parse_pass("1 + 2 ? 3 : 4 * 5"))141 print_result(self.try_parse_pass("1 + (2 ? 3 : 4) * 5"))142@testOf(grammar.event_expression)143def test87(self):144 # debug(grammar.event_expression)145 # debug(grammar.expression)146 # print_result_as_stmt(self.try_parse_pass("~en"))147 # print_result_as_stmt(self.try_parse_pass("posedge A or negedge CLK"))148 # print_result_as_stmt(self.try_parse_pass("posedge A , negedge CLK"))149 # print_result_as_stmt(self.try_parse_pass("~en or posedge A or negedge CLK"))150 print_result_as_stmt(self.try_parse_pass("~en or posedge A , negedge CLK"))151 print_result_as_stmt(self.try_parse_pass("~en or posedge A or negedge CLK"))152 print_result_as_stmt(self.try_parse_pass("(~en or posedge A )or negedge CLK"))153 print_result_as_stmt(self.try_parse_pass("~en or (posedge A or negedge CLK)")) # must be pass! not implemented recursive Binary Exp print154 print_result_as_stmt(self.try_parse_pass("~en ,posedge A or negedge CLK"))155@testOf(grammar.lsb_constant_expression)156def test123(self):157 print_result(self.try_parse_fail("1:0"))158 print_result(self.try_parse_pass("20"))159 print_result(self.try_parse_fail("X"))160@testOf(grammar.mintypmax_expression)161def test124(self):162 print_result(self.try_parse_pass("0"))163 print_result(self.try_parse_pass("A+10"))164 print_result(self.try_parse_pass("-X"))165 print_result(self.try_parse_pass("1+2+3"))166 print_result(self.try_parse_pass("-X+1"))167 print_result(self.try_parse_pass("-X+1+A"))168 print_result(self.try_parse_pass("-X+1*A"))169 print_result(self.try_parse_pass("1?2:3"))170 print_result(self.try_parse_pass("-1?2:3"))171 print_result(self.try_parse_pass("A ? B : C"))172 print_result(self.try_parse_pass("A ? B : A ? B : C"))173 print_result(self.try_parse_pass("0 ? 1 : 2 ? 1 : 2"))174 print_result(self.try_parse_pass("0 ? 0 ? 1 : 2 : 2"))175 print_result(self.try_parse_pass("(0 ? 1 : 2) ? 3 : 4"))176 print_result(self.try_parse_pass("func(1)"))177@testOfSkipped(grammar.module_path_conditional_expression)178def test125(self):179 pass180@testOfSkipped(grammar.module_path_expression)181def test126(self):182 pass183@testOfSkipped(grammar.module_path_mintypmax_expression)184def test127(self):185 pass186@testOf(grammar.msb_constant_expression)187def test128(self):188 print_result(self.try_parse_fail("1:0"))189 print_result(self.try_parse_pass("20"))190@testOf(grammar.range_expression)191def test129(self):192 print_result(self.try_parse_pass("1+2+3"))193 print_result(self.try_parse_pass("1:0"))194 print_result(self.try_parse_fail("1+:0"))195@testOfSkipped(grammar.width_constant_expression)196def test130(self):197 pass198if __name__=='__main__':199 run_tests()200 #run_tests(["test112"])201 #run_tests(["test114", "test113"])202 #run_tests(["test118"])203 #run_tests(["test122"])...

Full Screen

Full Screen

test_web_handler.py

Source:test_web_handler.py Github

copy

Full Screen

1import requests2site = "http://127.0.0.1:8888"3def print_result(response):4 print("[%s] %s\t%s" % (response.status_code, len(response.text), response.url))5 print("text:", response.text)6 print()7def test_root():8 response = requests.get(site)9 print_result(response)10def test_js():11 response = requests.get("%s/js/1.js" % site)12 print_result(response)13def test_css():14 response = requests.get("%s/css/1.css" % site)15 print_result(response)16def test_img():17 response = requests.get("%s/img/1.gif" % site)18 print_result(response)19def test_template():20 response = requests.get("%s/error" % site)21 print_result(response)22def test_get_403():23 response = requests.get("%s/js//mine/github/coding/all_about_tornado/project_demo/static/js/1.js" % site)24 print_result(response)25def test_get_403_2():26 response = requests.get("%s/js/../../../../../../../mine/github/coding/all_about_tornado/project_demo/static/js/1.js" % site)27 print_result(response)28def test_get_403_3():29 response = requests.get("%s/js/../../static/js/1.js" % site)30 print_result(response)31def test_get_403_4():32 response = requests.get("%s/js/../app.py" % site)33 print_result(response)34def test_post_404():35 response = requests.post("%s/api/404?ofsf" % site)36 print_result(response)37def test_post_200_bad_heaeder():38 response = requests.post("%s/api/200" % site)39 print_result(response)40def test_post_200_invalid_json():41 response = requests.post(42 "%s/api/200" % site,43 headers={44 "Content-Type": "application/json; charset=UTF-8",45 },46 data="some nothing text"47 )48 print_result(response)49def test_post_200_ok():50 import json51 response = requests.post(52 "%s/api/200" % site,53 headers={54 "Content-Type": "application/json; charset=UTF-8",55 },56 data=json.dumps({"greeting": "by test"})57 )58 print_result(response)59def test_post_get_sequence_name():60 import json61 response = requests.post(62 "%s/api/get_sequence_name" % site,63 headers={64 "Content-Type": "application/json; charset=UTF-8",65 },66 data=json.dumps({"greeting": "by test"})67 )68 print_result(response)69def test_post_500_ok():70 import json71 response = requests.post(72 "%s/api/500" % site,73 headers={74 "Content-Type": "application/json; charset=UTF-8",75 },76 data=json.dumps({"greeting": "by test"})77 )78 print_result(response)79if __name__ == "__main__":80 test_root()81 test_js()82 test_css()83 test_img()84 test_template()85 test_get_403()86 test_get_403_2()87 test_get_403_3()88 test_get_403_4()89 test_post_404()90 test_post_200_bad_heaeder()91 test_post_200_invalid_json()92 test_post_200_ok()...

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 autotest 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