This repository has been archived by the owner on Jul 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 52
/
test_s3.py
65 lines (59 loc) · 1.93 KB
/
test_s3.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import unittest
from stacker.context import Context, Config
from stacker.variables import Variable
from stacker_blueprints.s3 import Buckets
from stacker.blueprints.testutil import BlueprintTestCase
class TestBlueprint(BlueprintTestCase):
def setUp(self):
self.variables = [
Variable('Buckets', {
'Simple': {},
'Cycle': {
'LifecycleConfiguration': {
'Rules': [{
'Status': 'Enabled',
'ExpirationInDays': 40,
}],
},
}
}),
Variable('ReadRoles', [
'Role1',
'Role2',
]),
Variable('ReadWriteRoles', [
'Role3',
'Role4',
]),
]
def test_s3(self):
ctx = Context(config=Config({'namespace': 'test'}))
blueprint = Buckets('buckets', ctx)
blueprint.resolve_variables(self.variables)
blueprint.create_template()
self.assertRenderedBlueprint(blueprint)
def test_s3_static_website(self):
"""Test a static website blog bucket."""
ctx = Context(config=Config({'namespace': 'test'}))
blueprint = Buckets('s3_static_website', ctx)
v = self.variables = [
Variable('Buckets', {
'Blog': {
'AccessControl': 'PublicRead',
'WebsiteConfiguration' : {
'IndexDocument': 'index.html'
}
},
}),
Variable('ReadRoles', [
'Role1',
'Role2',
]),
Variable('ReadWriteRoles', [
'Role3',
'Role4',
]),
]
blueprint.resolve_variables(v)
blueprint.create_template()
self.assertRenderedBlueprint(blueprint)