How to use list_tables method in localstack

Best Python code snippet using localstack_python

test_analyzer.py

Source:test_analyzer.py Github

copy

Full Screen

...93 assert known_types_for_function("""\94 import boto395 def foo():96 d = boto3.client('dynamodb')97 e = d.list_tables()98 foo()99 """, name='foo') == {100 'd': Boto3ClientType('dynamodb'),101 'e': Boto3ClientMethodCallType('dynamodb', 'list_tables')102 }103def test_can_understand_return_types():104 assert known_types_for_module("""\105 import boto3106 def create_client():107 d = boto3.client('dynamodb')108 return d109 e = create_client()110 """) == {111 'boto3': Boto3ModuleType(),112 'create_client': FunctionType(Boto3ClientType('dynamodb')),113 'e': Boto3ClientType('dynamodb'),114 }115def test_type_equality():116 assert Boto3ModuleType() == Boto3ModuleType()117 assert Boto3CreateClientType() == Boto3CreateClientType()118 assert Boto3ModuleType() != Boto3CreateClientType()119 assert Boto3ClientType('s3') == Boto3ClientType('s3')120 assert Boto3ClientType('s3') != Boto3ClientType('ec2')121 assert Boto3ClientType('s3') == Boto3ClientType('s3')122 assert (Boto3ClientMethodType('s3', 'list_objects') ==123 Boto3ClientMethodType('s3', 'list_objects'))124 assert (Boto3ClientMethodType('ec2', 'describe_instances') !=125 Boto3ClientMethodType('s3', 'list_object'))126 assert (Boto3ClientMethodType('ec2', 'describe_instances') !=127 Boto3CreateClientType())128def test_single_call():129 assert aws_calls("""\130 import boto3131 d = boto3.client('dynamodb')132 d.list_tables()133 """) == {'dynamodb': set(['list_tables'])}134def test_multiple_calls():135 assert aws_calls("""\136 import boto3137 d = boto3.client('dynamodb')138 d.list_tables()139 d.create_table(TableName='foobar')140 """) == {'dynamodb': set(['list_tables', 'create_table'])}141def test_multiple_services():142 assert aws_calls("""\143 import boto3144 d = boto3.client('dynamodb')145 asdf = boto3.client('s3')146 d.list_tables()147 asdf.get_object(Bucket='foo', Key='bar')148 d.create_table(TableName='foobar')149 """) == {'dynamodb': set(['list_tables', 'create_table']),150 's3': set(['get_object']),151 }152def test_basic_aliasing():153 assert aws_calls("""\154 import boto3155 d = boto3.client('dynamodb')156 alias = d157 alias.list_tables()158 """) == {'dynamodb': set(['list_tables'])}159def test_multiple_aliasing():160 assert aws_calls("""\161 import boto3162 d = boto3.client('dynamodb')163 alias = d164 alias2 = alias165 alias3 = alias2166 alias3.list_tables()167 """) == {'dynamodb': set(['list_tables'])}168def test_multiple_aliasing_non_chained():169 assert aws_calls("""\170 import boto3171 d = boto3.client('dynamodb')172 alias = d173 alias2 = alias174 alias3 = alias175 alias3.list_tables()176 """) == {'dynamodb': set(['list_tables'])}177def test_no_calls_found():178 assert aws_calls("""\179 import boto3180 """) == {}181def test_original_name_replaced():182 assert aws_calls("""\183 import boto3184 import some_other_thing185 d = boto3.client('dynamodb')186 d.list_tables()187 d = some_other_thing188 d.create_table()189 """) == {'dynamodb': set(['list_tables'])}190def test_multiple_targets():191 assert aws_calls("""\192 import boto3193 a = b = boto3.client('dynamodb')194 b.list_tables()195 a.create_table()196 """) == {'dynamodb': set(['create_table', 'list_tables'])}197def test_in_function():198 assert aws_calls("""\199 import boto3200 def foo():201 d = boto3.client('dynamodb')202 d.list_tables()203 foo()204 """) == {'dynamodb': set(['list_tables'])}205def test_ignores_built_in_scope():206 assert aws_calls("""\207 import boto3208 a = boto3.client('dynamodb')209 def foo():210 if a is not None:211 try:212 a.list_tables()213 except Exception as e:214 a.create_table()215 foo()216 """) == {'dynamodb': set(['create_table', 'list_tables'])}217def test_understands_scopes():218 assert aws_calls("""\219 import boto3, mock220 d = mock.Mock()221 def foo():222 d = boto3.client('dynamodb')223 d.list_tables()224 """) == {}225def test_function_return_types():226 assert aws_calls("""\227 import boto3228 def create_client():229 return boto3.client('dynamodb')230 create_client().list_tables()231 """) == {'dynamodb': set(['list_tables'])}232def test_propagates_return_types():233 assert aws_calls("""\234 import boto3235 def create_client1():236 return create_client2()237 def create_client2():238 return create_client3()239 def create_client3():240 return boto3.client('dynamodb')241 create_client1().list_tables()242 """) == {'dynamodb': set(['list_tables'])}243def test_decorator_list_is_ignored():244 assert known_types_for_function("""\245 import boto3246 import decorators247 @decorators.retry(10)248 def foo():249 d = boto3.client('dynamodb')250 e = d.list_tables()251 foo()252 """, name='foo') == {253 'd': Boto3ClientType('dynamodb'),254 'e': Boto3ClientMethodCallType('dynamodb', 'list_tables')255 }256def test_can_map_function_params():257 assert aws_calls("""\258 import boto3259 d = boto3.client('dynamodb')260 def make_call(client):261 a = 1262 return client.list_tables()263 make_call(d)264 """) == {'dynamodb': set(['list_tables'])}265def test_can_understand_shadowed_vars_from_func_arg():266 assert aws_calls("""\267 import boto3268 d = boto3.client('dynamodb')269 def make_call(d):270 return d.list_tables()271 make_call('foo')272 """) == {}273def test_can_understand_shadowed_vars_from_local_scope():274 assert aws_calls("""\275 import boto3, mock276 d = boto3.client('dynamodb')277 def make_call(e):278 d = mock.Mock()279 return d.list_tables()280 make_call(d)281 """) == {}282def test_can_map_function_with_multiple_args():283 assert aws_calls("""\284 import boto3, mock285 m = mock.Mock()286 d = boto3.client('dynamodb')287 def make_call(other, client):288 a = 1289 other.create_table()290 return client.list_tables()291 make_call(m, d)292 """) == {'dynamodb': set(['list_tables'])}293def test_multiple_function_calls():294 assert aws_calls("""\295 import boto3, mock296 m = mock.Mock()297 d = boto3.client('dynamodb')298 def make_call(other, client):299 a = 1300 other.create_table()301 return other_call(a, 2, 3, client)302 def other_call(a, b, c, client):303 return client.list_tables()304 make_call(m, d)305 """) == {'dynamodb': set(['list_tables'])}306def test_can_lookup_var_names_to_functions():307 assert aws_calls("""\308 import boto3309 service_name = 'dynamodb'310 d = boto3.client(service_name)311 d.list_tables()312 """) == {'dynamodb': set(['list_tables'])}313def test_map_string_literals_across_scopes():314 assert aws_calls("""\315 import boto3316 service_name = 'dynamodb'317 def foo():318 service_name = 's3'319 d = boto3.client(service_name)320 d.list_buckets()321 d = boto3.client(service_name)322 d.list_tables()323 foo()324 """) == {'s3': set(['list_buckets']), 'dynamodb': set(['list_tables'])}325def test_can_handle_lambda_keyword():326 assert aws_calls("""\327 def foo(a):328 return sorted(bar.values(),329 key=lambda x: x.baz[a - 1],330 reverse=True)331 bar = {}332 foo(12)333 """) == {}334#def test_tuple_assignment():335# assert aws_calls("""\336# import boto3337# import some_other_thing338# a, d = (1, boto3.client('dynamodb'))339# d.list_tables()340# d.create_table()341# """) == {'dynamodb': set(['list_tables'])}342#343#344#def test_multiple_client_assignment():345# assert aws_calls("""\346# import boto3347# import some_other_thing348# s3, db = (boto3.client('s3'), boto3.client('dynamodb'))349# db.list_tables()350# s3.get_object(Bucket='a', Key='b')351# """) == {'dynamodb': set(['list_tables'])352# 's3': set(['get_object'])}353#354#355#def test_understands_instance_methods():356# assert aws_calls("""\357# import boto3, mock358# class Foo(object):359# def make_call(self, client):360# return client.list_tables()361#362# d = boto3.client('dynamodb')363# instance = Foo()364# instance.make_call(d)365# """) == {'dynamodb': set(['list_tables'])}366#367#368#def test_understands_function_and_methods():369# assert aws_calls("""\370# import boto3, mock371# class Foo(object):372# def make_call(self, client):373# return foo_call(1, client)374#375# def foo_call(a, client):376# return client.list_tables()377#378# d = boto3.client('dynamodb')379# instance = Foo()380# instance.make_call(d)381# """) == {'dynamodb': set(['list_tables'])}382#383#384#def test_can_track_across_classes():385# assert aws_calls("""\386# import boto3387# ddb = boto3.client('dynamodb')388# class Helper(object):389# def __init__(self, client):390# self.client = client391# def foo(self):392# return self.client.list_tables()393# h = Helper(ddb)394# h.foo()...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful