diff options
author | s-hertel <hertels@berea.edu> | 2016-07-12 11:27:37 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-12 11:27:37 -0400 |
commit | 2d00aeb57a3a77b864f51cb201a8897e8e5cd39b (patch) | |
tree | cfcc42822a2001d36294c6cb36c6656c9d680894 | |
parent | ed7623ecdec8585282ce91f1534d02e6a38c22a4 (diff) | |
download | ansible-TestGalaxyCLI-setUpClass-patch-1.tar.gz |
Update test_galaxy.pyTestGalaxyCLI-setUpClass-patch-1
Fixing role_path because shouldn't edit /etc/ansible/roles.
-rw-r--r-- | test/units/cli/test_galaxy.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/test/units/cli/test_galaxy.py b/test/units/cli/test_galaxy.py index a7a44a766f..105f27a714 100644 --- a/test/units/cli/test_galaxy.py +++ b/test/units/cli/test_galaxy.py @@ -41,8 +41,14 @@ class TestGalaxy(unittest.TestCase): '''creating prerequisites for installing a role; setUpClass occurs ONCE whereas setUp occurs with every method tested.''' # class data for easy viewing: role_dir, role_tar, role_name, role_req, role_path - if os.path.exists("./delete_me"): + if os.path.isdir("./delete_me"): shutil.rmtree("./delete_me") + + # creating temporary role directory for safe installation + cls.role_path = "~/delete_me/tmp/roles" + if os.path.isdir(cls.role_path): + shutil.rmtree(cls.role_path) + os.makedirs(cls.role_path) # creating framework for a role gc = GalaxyCLI(args=["init"]) @@ -51,7 +57,6 @@ class TestGalaxy(unittest.TestCase): gc.run() cls.role_dir = "./delete_me" cls.role_name = "delete_me" - cls.role_path = "/etc/ansible/roles" # creating a tar file name for class data cls.role_tar = './delete_me.tar.gz' @@ -85,6 +90,8 @@ class TestGalaxy(unittest.TestCase): os.remove(cls.role_req) if os.path.exists(cls.role_tar): os.remove(cls.role_tar) + if os.path.isdir(cls.role_path): + shutil.rmtree(cls.role_path) def setUp(self): self.default_args = [] |