-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_lambda.py
46 lines (36 loc) · 1.54 KB
/
test_lambda.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import main_utils
import unittest
unittest.TestLoader.sortTestMethodsUsing = None
class Test(unittest.TestCase):
def test_a_setup_class(self):
print('\r\nCreating the lambda function...')
main_utils.create_lambda('lambda')
def test_b_invoke_function_and_response(self):
print('\r\nInvoking the lambda function...')
payload = main_utils.invoke_function('lambda')
self.assertEqual(payload['message'], 'Hello User!')
def test_c_teardown_class(self):
print('\r\nDeleting the lambda function...')
main_utils.delete_lambda('lambda')
def test_d_secret_setup_class(self):
print('\r\nCreating the secret...')
main_utils.create_secret('senha', '123')
def test_e_get_secret_setup_class(self):
print('\r\ngetting the secret...')
value = main_utils.get_value('senha')
self.assertEqual(value['SecretString'], '123')
def test_f_delete_secret_setup_class(self):
print('\r\nDeleting the secret...')
main_utils.delete_secret('senha')
def test_g_create_bucket(self):
print('\r\nCreating a bucket ...')
main_utils.create_bucket('bucket-1')
buckets = main_utils.list_buckets()
total_buckets = len(buckets['Buckets'])
self.assertEqual(total_buckets, 1)
def test_h_delete_bucket(self):
print('\r\nDeleting a bucket ...')
main_utils.delete_bucket_with_objects('bucket-1')
buckets = main_utils.list_buckets()
total_buckets = len(buckets['Buckets'])
self.assertEqual(total_buckets, 0)