From 7151e579849263a73869c94d3ccd7f79a631d717 Mon Sep 17 00:00:00 2001 From: Angus Salkeld Date: Thu, 26 Apr 2012 21:46:02 +1000 Subject: [PATCH] Add a real creds file for the cfn-hup config tests Signed-off-by: Angus Salkeld --- heat/tests/test_cfn.py | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/heat/tests/test_cfn.py b/heat/tests/test_cfn.py index 1f5c62e8..8f6d5237 100644 --- a/heat/tests/test_cfn.py +++ b/heat/tests/test_cfn.py @@ -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) -- 2.45.2