Best Python code snippet using localstack_python
test_account.py
Source: test_account.py
...4 def test_get_accounts(self):5 accounts = AccountController.get_accounts()6 assert isinstance(accounts, dict)7 assert "accounts" in accounts8 def test_get_default_account_id(self):9 account_id = AccountController.get_default_account_id()10 assert isinstance(account_id, str)11 assert len(account_id) == 2012 def test_get_account_details(self):13 account_id = AccountController.get_default_account_id()14 account_details = AccountController.get_account_details(account_id)15 assert isinstance(account_details, dict)16 assert "account" in account_details17 assert "lastTransactionID" in account_details18 def test_get_account_summary(self):19 account_id = AccountController.get_default_account_id()20 account_summary = AccountController.get_account_summary(account_id)21 assert isinstance(account_summary, dict)22 assert "account" in account_summary23 assert "lastTransactionID" in account_summary24 def test_get_tradeable_instruments(self):25 account_id = AccountController.get_default_account_id()26 tradeable_instruments = AccountController.get_tradeable_instruments(account_id)27 assert isinstance(tradeable_instruments, dict)28 assert "instruments" in tradeable_instruments29 assert "lastTransactionID" in tradeable_instruments30 def test_get_tradeable_instruments_one_instrument(self):31 account_id = AccountController.get_default_account_id()32 tradeable_instruments = AccountController.get_tradeable_instruments(33 account_id, instruments=["USB05Y_USD"]34 )35 assert isinstance(tradeable_instruments, dict)36 assert "instruments" in tradeable_instruments37 assert len(tradeable_instruments["instruments"]) == 138 assert "lastTransactionID" in tradeable_instruments39 def test_get_tradeable_instruments_invalid(self):40 account_id = AccountController.get_default_account_id()41 with pytest.raises(Exception):42 tradeable_instruments = AccountController.get_tradeable_instruments(43 account_id, names_only=True, instruments=["USB05Y_USD"]44 )45 def test_get_tradeable_instruments_names_only(self):46 account_id = AccountController.get_default_account_id()47 tradeable_instruments = AccountController.get_tradeable_instruments(48 account_id, names_only=True49 )...
accounts.py
Source: accounts.py
...8REQUEST_CTX_TLS = threading.local()9def get_aws_account_id() -> str:10 """Return the AWS account ID for the current context."""11 return account_id_resolver()12def get_default_account_id() -> str:13 return _TEST_AWS_ACCOUNT_ID14account_id_resolver = get_default_account_id15def get_account_id_from_access_key_id(access_key_id: str) -> str:16 """Return the Account ID associated the Access Key ID."""17 # This utility ignores IAM mappings.18 # For now, we assume the client sends Account ID in Access Key ID field.19 if re.match(r"\d{12}", access_key_id):20 return access_key_id21 else:22 return get_default_account_id()23def get_ctx_aws_access_key_id() -> Optional[str]:24 """Return the AWS access key ID for current context."""25 return getattr(REQUEST_CTX_TLS, "access_key_id", None)26def set_ctx_aws_access_key_id(access_key_id: str):27 REQUEST_CTX_TLS.access_key_id = access_key_id28@hooks.on_infra_start()29def patch_get_account_id():30 """Patch Moto's account ID resolver with our own."""31 import moto.core32 moto.core.models.account_id_resolver = get_aws_account_id33 # Note: Moto templates making use of this constant will not get access to34 # account ID from the current context...
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!!