Skip to content

Commit 2780cc0

Browse files
Garison DraperGarison Draper
authored andcommitted
updating tests to allow for issue 496 resolution
1 parent 1660c94 commit 2780cc0

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

stacker/context.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ def tags(self):
9999
if tags is not None:
100100
if "stacker_namespace" in tags:
101101
return tags
102+
if tags == {}:
103+
return {}
102104
tags["stacker_namespace"] = self.namespace
103105
return tags
104106
if self.namespace:

stacker/tests/test_stack.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ def test_stack_tags_default(self):
8080
stack_id=1
8181
)
8282
stack = Stack(definition=definition, context=self.context)
83-
self.assertEquals(stack.tags, {"environment": "prod"})
83+
self.assertEquals(stack.tags, {"environment": "prod",
84+
"stacker_namespace": u"namespace"})
8485

8586
def test_stack_tags_override(self):
8687
self.config.tags = {"environment": "prod"}
@@ -90,17 +91,20 @@ def test_stack_tags_override(self):
9091
tags={"environment": "stage"}
9192
)
9293
stack = Stack(definition=definition, context=self.context)
93-
self.assertEquals(stack.tags, {"environment": "stage"})
94+
self.assertEquals(stack.tags, {"environment": "stage",
95+
'stacker_namespace': u'namespace'})
9496

9597
def test_stack_tags_extra(self):
96-
self.config.tags = {"environment": "prod"}
98+
self.config.tags = {"environment": "prod",
99+
"stacker_namespace": u"namespace"}
97100
definition = generate_definition(
98101
base_name="vpc",
99102
stack_id=1,
100103
tags={"app": "graph"}
101104
)
102105
stack = Stack(definition=definition, context=self.context)
103-
self.assertEquals(stack.tags, {"environment": "prod", "app": "graph"})
106+
self.assertEquals(stack.tags, {"environment": "prod", "app": "graph",
107+
"stacker_namespace": u"namespace"})
104108

105109

106110
if __name__ == '__main__':

0 commit comments

Comments
 (0)