Best Python code snippet using localstack_python
test_runtime_configuration.py
Source:test_runtime_configuration.py
...115 )116 }117 @mock.patch.dict(os.environ, CERTIFICATE_ENV)118 def test_selfsigned_certificate_less_mx720(self):119 result = security.get_client_certificates(MXVersion(7.16))120 assert "WebServiceClientCertificates" in result121 @mock.patch.dict(os.environ, CERTIFICATE_ENV)122 def test_selfsigned_certificate_greq_mx720(self):123 result = security.get_client_certificates(MXVersion(7.23))...
https.py
Source:https.py
...9 pki_path = path.join(current_path, 'pki')10 cert_path = path.join(pki_path, domain + '.crt')11 key_path = path.join(pki_path, domain + '.key')12 return cert_path, key_path13async def get_client_certificates(14 domain: str,15 client_cert_config: IdpClientCertConfig16) -> Tuple[str, str]:17 """18 check, if the certificate for the given url is already downloaded19 download the certificate if not already downloaded20 return certificate_path and key_path21 """22 # check if the certificate is already downloaded23 cert_path, key_path = await get_cert_paths(domain)24 if await file_exists(cert_path) and await file_exists(key_path):25 return cert_path, key_path26 cert_data_b64 = client_cert_config.cert27 key_data_b64 = client_cert_config.key28 await decode_write_b64(cert_path, cert_data_b64)29 await decode_write_b64(key_path, key_data_b64)30 return cert_path, key_path31async def get_ca_server_certificates():32 current_path = path.dirname(path.realpath(__file__))33 pki_path = path.join(current_path, 'pki')34 ca_path = path.join(pki_path, 'ca.pem')35 if await file_exists(ca_path):36 return ca_path37 return None38def is_https(url: str):39 parsed_url = parse.urlparse(url)40 return parsed_url.scheme == 'https' or not parsed_url.scheme == 'http'41async def get_https_certificates(url: str, config: IdpDomainConfig):42 if url and is_https(url):43 return await get_client_certificates(44 config.domain, config.client_cert_config)45 return None46async def get_ca_certificates(url: str):47 if url and is_https(url):48 return await get_ca_server_certificates()...
certs.py
Source:certs.py
1import boto32from potteringabout.awsutils.base import Base3from datetime import datetime4class Certs(Base):5 clients = ["acm", "apigateway"]6 resources = []7 def list_certificates(self):8 cert_summaries = self.iterate(9 cr=self.client("acm"),10 func_name="list_certificates",11 attr="CertificateSummaryList"12 )13 certs = []14 for cert_summary in cert_summaries:15 cert = self.client("acm").describe_certificate(16 CertificateArn=cert_summary["CertificateArn"]17 )["Certificate"]18 certs.append(cert)19 return certs20 def list_client_certificates(self):21 return self.iterate(22 cr=self.client("apigateway"),23 func_name="get_client_certificates", 24 attr="items", 25 nextToken="position"26 )...
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!!