Best Python code snippet using localstack_python
test_dynamodb.py
Source:test_dynamodb.py
...291 ShardIteratorType='AT_SEQUENCE_NUMBER',292 SequenceNumber=result['StreamDescription']['Shards'][0].293 get('SequenceNumberRange').get('StartingSequenceNumber'))294 self.assertIn('ShardIterator', response)295 def test_global_tables(self):296 aws_stack.create_dynamodb_table(TEST_DDB_TABLE_NAME, partition_key=PARTITION_KEY)297 dynamodb = aws_stack.connect_to_service('dynamodb')298 # create global table299 regions = [{'RegionName': 'us-east-1'}, {'RegionName': 'us-west-1'}, {'RegionName': 'eu-central-1'}]300 response = dynamodb.create_global_table(GlobalTableName=TEST_DDB_TABLE_NAME,301 ReplicationGroup=regions)['GlobalTableDescription']302 self.assertIn('ReplicationGroup', response)303 self.assertEqual(len(regions), len(response['ReplicationGroup']))304 # describe global table305 response = dynamodb.describe_global_table(GlobalTableName=TEST_DDB_TABLE_NAME)['GlobalTableDescription']306 self.assertIn('ReplicationGroup', response)307 self.assertEqual(len(regions), len(response['ReplicationGroup']))308 # update global table309 updates = [...
test_shared_tables.py
Source:test_shared_tables.py
...173 df = Dataflow.create_dataflow_from_table(client, fq_table_obj)174 df._query_list[0]['args']['source'] = fq_table_obj.fqn_name # make source FQN175 cross_session.execute_dataflow(df, table_name="bar", is_async=False, optimized=False)176 fq_table_obj.drop(delete_completely=True)177def test_global_tables(client, session, cross_session, telecom_table):178 prev_global_tab_count = len(client.list_global_tables())179 source_df = Dataflow.create_dataflow_from_table(client, telecom_table)180 table_name = "new_global_tab"181 # Create a table182 session.execute_dataflow(183 source_df, table_name=table_name, is_async=False, optimized=True)184 table_obj = session.get_table(table_name)185 with pytest.raises(ValueError) as ex:186 client.get_global_table(table_name)187 assert "No such table: '{}'".format(table_name) in str(ex)188 rec_count_1 = table_obj.record_count()189 table_obj.publish()190 tab = client.get_global_table(table_name)191 assert tab.fqn_name == table_obj.fqn_name...
dynamodb_test.py
Source:dynamodb_test.py
...30 assert kwargs["action"] == "delete-table"31 assert kwargs["TableName"] == table.name32 client = cast(AwsClient, SimpleNamespace(call=validate_delete_args))33 table.delete_resource(client)34def test_global_tables() -> None:35 first, builder = round_trip_for(AwsDynamoDbGlobalTable)36 assert len(builder.resources_of(AwsDynamoDbGlobalTable)) == 137def test_tagging_global_tables() -> None:38 table, _ = round_trip_for(AwsDynamoDbGlobalTable)39 def validate_update_args(**kwargs: Any) -> Any:40 if kwargs["action"] == "list-tags-of-resource":41 assert kwargs["ResourceArn"] == table.arn42 return [{"Key": "foo", "Value": "bar"}]43 if kwargs["action"] == "tag-resource":44 assert kwargs["ResourceArn"] == table.arn45 assert kwargs["Tags"] == [{"Key": "foo", "Value": "bar"}]46 def validate_delete_args(**kwargs: Any) -> Any:47 if kwargs["action"] == "untag-resource":48 assert kwargs["ResourceArn"] == table.arn...
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!!