Best Python code snippet using localstack_python
test_general.py
Source: test_general.py
...331 )332 def test_generate_certificate_no_name(self):333 Config.objects.set_config("maas_name", "mymaas")334 handler = GeneralHandler(factory.make_User(), {}, None)335 result = handler.generate_client_certificate({})336 self.assertEqual(result["CN"], "mymaas")337 self.assertTrue(338 result["certificate"].startswith("-----BEGIN CERTIFICATE-----"),339 result["certificate"],340 )341 self.assertTrue(342 result["private_key"].startswith("-----BEGIN PRIVATE KEY-----"),343 result["private_key"],344 )345 def test_generate_certificate_with_name(self):346 Config.objects.set_config("maas_name", "mymaas")347 handler = GeneralHandler(factory.make_User(), {}, None)348 result = handler.generate_client_certificate({"object_name": "mypod"})349 self.assertEqual(result["CN"], "mypod@mymaas")350 self.assertTrue(351 result["certificate"].startswith("-----BEGIN CERTIFICATE-----"),352 result["certificate"],353 )354 self.assertTrue(355 result["private_key"].startswith("-----BEGIN PRIVATE KEY-----"),356 result["private_key"],357 )358 def test_generate_certificate_metadata(self):359 cert = generate_certificate("maas")360 handler = GeneralHandler(factory.make_User(), {}, None)361 self.patch(general, "generate_certificate").return_value = cert362 result = handler.generate_client_certificate({})363 self.assertEqual(result["fingerprint"], cert.cert_hash())364 self.assertEqual(365 result["expiration"], cert.expiration().strftime(DATETIME_FORMAT)...
auth.py
Source: auth.py
...88 object_class = ['inetOrgPerson', 'organizationalPerson', 'person', 'top']89 ldap_user["objectClass"] = object_class90 ldap_attr = create_user(user, ldap_user)91 try:92 generate_client_certificate(emailAddress=ldap_user["mail"], commonName=ldap_user['cn'], key=user["pubkey"])93 except Exception as e:94 print("Failed to create certificate from public key: " + str(e))95 generate_client_certificate(emailAddress=ldap_user["mail"], commonName=ldap_user['cn'])96 ldap_user["userCertificate"] = get_client_certificate("client_certificate/cert.pem")97 # Bind connection to LDAP server98 ldap_conn = root_connect()99 user_dn = f'cn={ldap_attr["cn"]},ou=users,ou=system'100 try:101 # object class for a user is inetOrgPerson102 ldap_conn.add(dn=user_dn,103 attributes=ldap_attr)104 print(ldap_conn.result)105 except LDAPException as e:106 response = e107 print(e)108 return ldap_conn.result109def sign_in(username, password):...
setup.py
Source: setup.py
1#!/usr/bin/env python32# Author: Trevor Perrin3# See the LICENSE file for legal information regarding use of this file.4from distutils.core import setup5import os6here = os.path.abspath(os.path.dirname(__file__))7with open(os.path.join(here, "README")) as f:8 README = f.read()9setup(name="tlslite-ng",10 version="0.8.0-alpha26",11 author="Hubert Kario",12 author_email="hkario@redhat.com",13 url="https://github.com/tomato42/tlslite-ng",14 description="Pure python implementation of SSL and TLS.",15 long_description=README,16 license="LGPLv2",17 scripts=["scripts/tls.py", "scripts/tlsdb.py",18 "scripts/fido2_server.py",19 "scripts/generate_client_certificate.sh"],20 packages=["tlslite", "tlslite.utils", "tlslite.integration"],21 package_data={22 'package1': ['LICENSE', 'README.md']},23 install_requires=['ecdsa'],24 obsoletes=["tlslite"],25 classifiers=[26 'Development Status :: 4 - Beta',27 'Intended Audience :: Developers',28 'License :: OSI Approved :: GNU Lesser General Public License v2 (LGPLv2)',29 'Operating System :: OS Independent',30 'Programming Language :: Python',31 'Programming Language :: Python :: 2',32 'Programming Language :: Python :: 2.6',33 'Programming Language :: Python :: 2.7',34 'Programming Language :: Python :: 3',35 'Programming Language :: Python :: 3.2',36 'Programming Language :: Python :: 3.3',37 'Programming Language :: Python :: 3.4',38 'Programming Language :: Python :: 3.5',39 'Programming Language :: Python :: 3.6',40 'Programming Language :: Python :: 3.7',41 'Topic :: Security :: Cryptography',42 'Topic :: Software Development :: Libraries :: Python Modules',43 'Topic :: System :: Networking'44 ],45 keywords="ssl, tls, pure-python"...
Check out the latest blogs from LambdaTest on this topic:
The fact is not alien to us anymore that cross browser testing is imperative to enhance your application’s user experience. Enhanced knowledge of popular and highly acclaimed testing frameworks goes a long way in developing a new app. It holds more significance if you are a full-stack developer or expert programmer.
QA testers have a unique role and responsibility to serve the customer. Serving the customer in software testing means protecting customers from application defects, failures, and perceived failures from missing or misunderstood requirements. Testing for known requirements based on documentation or discussion is the core of the testing profession. One unique way QA testers can both differentiate themselves and be innovative occurs when senseshaping is used to improve the application user experience.
Having a good web design can empower business and make your brand stand out. According to a survey by Top Design Firms, 50% of users believe that website design is crucial to an organization’s overall brand. Therefore, businesses should prioritize website design to meet customer expectations and build their brand identity. Your website is the face of your business, so it’s important that it’s updated regularly as per the current web design trends.
Enterprise resource planning (ERP) is a form of business process management software—typically a suite of integrated applications—that assists a company in managing its operations, interpreting data, and automating various back-office processes. The introduction of a new ERP system is analogous to the introduction of a new product into the market. If the product is not handled appropriately, it will fail, resulting in significant losses for the business. Most significantly, the employees’ time, effort, and morale would suffer as a result of the procedure.
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!!