]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
Add a real creds file for the cfn-hup config tests
authorAngus Salkeld <asalkeld@redhat.com>
Thu, 26 Apr 2012 11:46:02 +0000 (21:46 +1000)
committerAngus Salkeld <asalkeld@redhat.com>
Thu, 26 Apr 2012 11:46:02 +0000 (21:46 +1000)
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
heat/tests/test_cfn.py

index 1f5c62e8855f192eed7f1d50f2d3ef9cc23ad4ef..8f6d5237223eb2937ee0d686c3f2b340f28ca949 100644 (file)
@@ -40,45 +40,56 @@ def test_boolean():
     assert(not to_boolean(56))
 
 
+def setUp_credential_file():
+    f = open('/tmp/incredible', 'w')
+    f.write('junk, just junk')
+    f.close()
+
+def tearDown_credential_file():
+    shutil.rmtree('/tmp/incredible', ignore_errors=True)
+
+@with_setup(setUp_credential_file, tearDown_credential_file)
 @attr(tag=['unit', 'cfn-hup'])
 @attr(speed='fast')
 def test_hup_conf1():
     good= """
 [main]
 stack=stack-test
-credential-file=/path/to/creds_file
+credential-file=/tmp/incredible
 region=unit-test-a
 interval=3
 """
     c = HupConfig([io.BytesIO(good)])
     assert(c.stack == 'stack-test')
-    assert(c.credential_file == '/path/to/creds_file')
+    assert(c.credential_file == '/tmp/incredible')
     assert(c.region == 'unit-test-a')
     assert(c.interval == 3)
 
 
+@with_setup(setUp_credential_file, tearDown_credential_file)
 @attr(tag=['unit', 'cfn-hup'])
 @attr(speed='fast')
 def test_hup_default():
     good= """
 [main]
 stack=stack-testr
-credential-file=/path/to/creds_file
+credential-file=/tmp/incredible
 """
     c = HupConfig([io.BytesIO(good)])
     assert(c.stack == 'stack-testr')
-    assert(c.credential_file == '/path/to/creds_file')
+    assert(c.credential_file == '/tmp/incredible')
     assert(c.region == 'nova')
     assert(c.interval == 10)
 
 
+@with_setup(setUp_credential_file, tearDown_credential_file)
 @attr(tag=['unit', 'cfn-hup'])
 @attr(speed='fast')
 def test_hup_hook():
     good= """
 [main]
 stack=stackname_is_fred
-credential-file=/path/to/creds_file
+credential-file=/tmp/incredible
 
 [bla]
 triggers=post.update
@@ -88,7 +99,7 @@ runas=root
 """
     c = HupConfig([io.BytesIO(good)])
     assert(c.stack == 'stackname_is_fred')
-    assert(c.credential_file == '/path/to/creds_file')
+    assert(c.credential_file == '/tmp/incredible')
     assert(c.region == 'nova')
     assert(c.interval == 10)