Add tests

This commit is contained in:
Declan Shanaghy 2016-08-15 11:28:07 -07:00
parent 1441087e5c
commit 659efe1c21
2 changed files with 13 additions and 1 deletions

1
.gitignore vendored
View File

@ -11,3 +11,4 @@ build/
.idea/ .idea/
*.swp *.swp
.DS_Store .DS_Store
python_env

View File

@ -7,6 +7,7 @@ import sure # noqa
from moto.cloudformation.models import FakeStack from moto.cloudformation.models import FakeStack
from moto.cloudformation.parsing import resource_class_from_type, parse_condition from moto.cloudformation.parsing import resource_class_from_type, parse_condition
from moto.sqs.models import Queue from moto.sqs.models import Queue
from moto.s3.models import FakeBucket
from boto.cloudformation.stack import Output from boto.cloudformation.stack import Output
from boto.exception import BotoServerError from boto.exception import BotoServerError
@ -23,6 +24,10 @@ dummy_template = {
"VisibilityTimeout": 60, "VisibilityTimeout": 60,
} }
}, },
"S3Bucket": {
"Type": "AWS::S3::Bucket",
"DeletionPolicy": "Retain"
},
}, },
} }
@ -85,12 +90,18 @@ def test_parse_stack_resources():
parameters={}, parameters={},
region_name='us-west-1') region_name='us-west-1')
stack.resource_map.should.have.length_of(1) stack.resource_map.should.have.length_of(2)
list(stack.resource_map.keys())[0].should.equal('Queue') list(stack.resource_map.keys())[0].should.equal('Queue')
list(stack.resource_map.keys())[1].should.equal('S3Bucket')
queue = list(stack.resource_map.values())[0] queue = list(stack.resource_map.values())[0]
queue.should.be.a(Queue) queue.should.be.a(Queue)
queue.name.should.equal("my-queue") queue.name.should.equal("my-queue")
bucket = list(stack.resource_map.values())[1]
bucket.should.be.a(FakeBucket)
bucket.physical_resource_id.should.equal(bucket.name)
@patch("moto.cloudformation.parsing.logger") @patch("moto.cloudformation.parsing.logger")
def test_missing_resource_logs(logger): def test_missing_resource_logs(logger):