Best Python code snippet using localstack_python
aws_sms_info.py
Source: aws_sms_info.py
...82 if client.can_paginate('list_sms_sandbox_phone_numbers'):83 paginator = client.get_paginator('list_sms_sandbox_phone_numbers')84 return paginator.paginate(), True85 else:86 return client.list_sms_sandbox_phone_numbers(), False87 else:88 return None, False89 except (BotoCoreError, ClientError) as e:90 module.fail_json_aws(e, msg='Failed to fetch Amazon SNS SMS details')91def main():92 argument_spec = dict(93 get_sms_sandbox_account_status=dict(required=False, type=bool),94 list_phone_numbers_opted_out=dict(required=False, type=bool),95 list_sms_sandbox_phone_numbers=dict(required=False, type=bool),96 )97 module = AnsibleAWSModule(98 argument_spec=argument_spec,99 mutually_exclusive=[100 (...
sns_fixtures.py
Source: sns_fixtures.py
1import boto32import pytest3from moto import mock_sns4from tests.utils import random_str5@pytest.fixture6def gen_sns_client(aws_setup):7 with mock_sns():8 yield boto3.client("sns")9@pytest.fixture10def gen_sns_resource(aws_setup):11 with mock_sns():12 yield boto3.resource("sns")13# ============================14# PAGINATOR15# ============================16@pytest.fixture17def gen_list_endpoints_by_platform_application_paginator(gen_sns_client):18 return gen_sns_client.get_paginator("list_endpoints_by_platform_application")19@pytest.fixture20def gen_list_platform_applications_paginator(gen_sns_client):21 return gen_sns_client.get_paginator("list_platform_applications")22@pytest.fixture23def gen_list_subscriptions_paginator(gen_sns_client):24 return gen_sns_client.get_paginator("list_subscriptions")25@pytest.fixture26def gen_list_subscriptions_by_topic_paginator(gen_sns_client):27 return gen_sns_client.get_paginator("list_subscriptions_by_topic")28@pytest.fixture29def gen_list_topics_paginator(gen_sns_client):30 return gen_sns_client.get_paginator("list_topics")31@pytest.fixture32def gen_list_phone_numbers_opted_out_paginator(gen_sns_client):33 return gen_sns_client.get_paginator("list_phone_numbers_opted_out")34@pytest.fixture35def gen_list_origination_numbers_paginator(gen_sns_client):36 return gen_sns_client.get_paginator("list_origination_numbers")37@pytest.fixture38def gen_list_sms_sandbox_phone_numbers_paginator(gen_sns_client):39 return gen_sns_client.get_paginator("list_sms_sandbox_phone_numbers")40# ============================41# RESOURCES42# ============================43@pytest.fixture44def gen_platform_application(gen_sns_resource):45 return gen_sns_resource.PlatformApplication(random_str())46@pytest.fixture47def gen_platform_endpoint(gen_sns_resource):48 return gen_sns_resource.PlatformEndpoint(random_str())49@pytest.fixture50def gen_subscription(gen_sns_resource):51 return gen_sns_resource.Subscription(random_str())52@pytest.fixture53def gen_topic(gen_sns_resource):54 return gen_sns_resource.Topic(random_str())55# ============================56# COLLECTIONS57# ============================58@pytest.fixture59def gen_service_resource_platform_applications_collection(gen_sns_resource):60 return gen_sns_resource.platform_applications.all()61@pytest.fixture62def gen_service_resource_subscriptions_collection(gen_sns_resource):63 return gen_sns_resource.subscriptions.all()64@pytest.fixture65def gen_service_resource_topics_collection(gen_sns_resource):66 return gen_sns_resource.topics.all()67@pytest.fixture68def gen_platform_application_endpoints_collection(gen_platform_application):69 return gen_platform_application.endpoints.all()70@pytest.fixture71def gen_topic_subscriptions_collection(gen_topic):...
sms.py
Source: sms.py
...7 summary="Send SMS with cart list"8)9async def send_sms(sms: schemas.SMS):10 sns = boto3.client('sns', region_name='us-east-1')11 response = sns.list_sms_sandbox_phone_numbers(MaxResults=30)12 print(response)13 user_phone = next(14 (phone for phone in response['PhoneNumbers'] if phone["PhoneNumber"] == sms.number), None)15 if user_phone == None or user_phone['Status'] == 'Pending':16 sns.create_sms_sandbox_phone_number(17 PhoneNumber=sms.number,18 LanguageCode='es-ES'19 )20 response = 'Not Verified'21 else:22 sns.publish(PhoneNumber=sms.number, Message=sms.message)23 response = 'Verified'...
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!!