How to use _generate_details_block_html method in localstack

Best Python code snippet using localstack_python

metric_aggregator.py

Source:metric_aggregator.py Github

copy

Full Screen

...16template_not_implemented_html = '<input type="checkbox" disabled="disabled">'17SNAPSHOT = "📸"18SNAPSHOT_SKIP_VERIFY = "🚫"19AWS_VALIDATED = "✨"20def _generate_details_block_html(details_title, details):21 output = f"<li> <details><summary>{details_title}</summary>\n\n"22 for e, count in details.items():23 if count > 0:24 output += f" {template_implemented_html}{e}</input><br/>\n"25 else:26 output += f" {template_not_implemented_html}{e}</input><br/>\n"27 output += " </details></li>\n"28 return output29def create_simple_html_report(file_name, metrics):30 output = "<html><h1> Metric Collection Report of Integration Tests </h1>\n\n"31 output += "<div><b>Disclaimer</b>: naive calculation of test coverage - if operation is called at least once, it is considered as 'covered'.<br/>\n"32 output += "&#x2728;: aws_validated or using the snapshot fixture<br/>\n"33 output += "&#x1F4F8;: using the snapshot fixture without any skip_snapshot_verify<br/>\n"34 output += "&#x1F6AB;: using the snapshot fixture but uses skip_snapshot_verify<br/></div>\n"35 for service in sorted(metrics.keys()):36 output += f"<h1> {service} </h1>\n<div>\n"37 details = metrics[service]38 if not details["service_attributes"]["pro"]:39 output += "community<br/>\n"40 elif not details["service_attributes"]["community"]:41 output += "pro only<br/>\n"42 else:43 output += "community, and pro features<br/>\n"44 del metrics[service]["service_attributes"]45 output += "</div>\n"46 operation_counter = len(details)47 operation_tested = 048 tmp = ""49 template_aws_validated = '<span title="AWS validated">&#x2728;</span>'50 template_snapshot_verified = '<span title="Snapshot verified">&#x1F4F8;</span>'51 template_snapshot_skipped = '<span title="Snapshot skipped">&#x1F6AB;</span>'52 for operation in sorted(details.keys()):53 op_details = details[operation]54 if op_details.get("invoked", 0) > 0:55 operation_tested += 156 aws_validated = f"{template_aws_validated if op_details.get('aws_validated') or op_details.get('snapshot') else ''}"57 snapshot = f"{template_snapshot_verified if aws_validated and not op_details.get('snapshot_skipped_paths') else template_snapshot_skipped if aws_validated else ''}"58 tmp += f"<p>{template_implemented_html}{operation} {aws_validated} {snapshot}</input>\n"59 else:60 tmp += f"<p>{template_not_implemented_html}{operation}</input>\n"61 tmp += "<ul>"62 if op_details.get("parameters"):63 parameters = op_details.get("parameters")64 if parameters:65 tmp += _generate_details_block_html("parameters hit", parameters)66 if op_details.get("errors"):67 tmp += _generate_details_block_html("errors hit", op_details["errors"])68 tmp += "</ul>"69 tmp += "</p>"70 output += f"<p><details><summary>{operation_tested/operation_counter*100:.2f}% test coverage</summary>\n\n{tmp}\n</details></p>\n"71 with open(file_name, "a") as fd:72 fd.write(f"{output}\n")73 output = ""74def _generate_details_block(details_title: str, details: dict) -> str:75 output = f" <details><summary>{details_title}</summary>\n\n"76 for e, count in details.items():77 if count > 0:78 output += f" {template_implemented_item}{e}\n"79 else:80 output += f" {template_not_implemented_item}{e}\n"81 output += " </details>\n"...

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