Skip to content

Commit

Permalink
updating tests to allow for issue 496 resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
Garison Draper authored and Garison Draper committed Oct 23, 2017
1 parent 1660c94 commit 2780cc0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 2 additions & 0 deletions stacker/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ def tags(self):
if tags is not None:
if "stacker_namespace" in tags:
return tags
if tags == {}:
return {}
tags["stacker_namespace"] = self.namespace
return tags
if self.namespace:
Expand Down
12 changes: 8 additions & 4 deletions stacker/tests/test_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ def test_stack_tags_default(self):
stack_id=1
)
stack = Stack(definition=definition, context=self.context)
self.assertEquals(stack.tags, {"environment": "prod"})
self.assertEquals(stack.tags, {"environment": "prod",
"stacker_namespace": u"namespace"})

def test_stack_tags_override(self):
self.config.tags = {"environment": "prod"}
Expand All @@ -90,17 +91,20 @@ def test_stack_tags_override(self):
tags={"environment": "stage"}
)
stack = Stack(definition=definition, context=self.context)
self.assertEquals(stack.tags, {"environment": "stage"})
self.assertEquals(stack.tags, {"environment": "stage",
'stacker_namespace': u'namespace'})

def test_stack_tags_extra(self):
self.config.tags = {"environment": "prod"}
self.config.tags = {"environment": "prod",
"stacker_namespace": u"namespace"}
definition = generate_definition(
base_name="vpc",
stack_id=1,
tags={"app": "graph"}
)
stack = Stack(definition=definition, context=self.context)
self.assertEquals(stack.tags, {"environment": "prod", "app": "graph"})
self.assertEquals(stack.tags, {"environment": "prod", "app": "graph",
"stacker_namespace": u"namespace"})


if __name__ == '__main__':
Expand Down

0 comments on commit 2780cc0

Please sign in to comment.