File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # LOCALSTACK-UTILS
2+ Python utility to integrate Localstack with Unit tests.
3+
4+ ### Prerequisites
5+ - Docker
6+ - Localstack
7+
8+
9+ ### Instalation (soon...)
10+
11+ ### Usage example
12+
13+ ``` python
14+ import time
15+ import boto3
16+ import unittest
17+ from localstack_utils import startup_localstack, stop_localstack
18+
19+ class kinesis_test (unittest .TestCase ):
20+ def setUp (self ):
21+ startup_localstack()
22+ session = boto3.session.Session()
23+
24+ def tearDown (self ):
25+ stop_localstack()
26+ return super ().tearDown()
27+
28+ def test_create_stream (self ):
29+ kinesis = boto3.client(
30+ service_name = ' kinesis' ,
31+ aws_access_key_id = ' test' ,
32+ aws_secret_access_key = ' test' ,
33+ endpoint_url = ' http://localhost:4566' )
34+
35+ kinesis.create_stream(StreamName = ' test' , ShardCount = 1 )
36+ time.sleep(5 )
37+
38+ response = kinesis.list_streams()
39+ self .assertGreater(len (response.get(' StreamNames' , [])),0 )
40+ ```
You can’t perform that action at this time.
0 commit comments