def test_make_folders_exist(self): """Verify existence of expected folders """ thisdir = os.curdir #s2s.make_folders(self.isolist, self.coollist) expected = [os.path.join(thisdir, "a_1_d"), os.path.join(thisdir, "a_2_w"), os.path.join(thisdir, "a_shutdown"), os.path.join(thisdir, "b_1_d"), os.path.join(thisdir, "b_2_w"), os.path.join(thisdir, "b_shutdown")] s2s.make_folders(self.isolist, self.coollist, thisdir) for path in expected: self.assertTrue(os.path.isdir(path)) pass
def setUp(self): # Redirect os.curdir to a temp folder self.curdir = os.curdir self.tempdir = mkdtemp() os.curdir = self.tempdir # Make the directories for the various cases self.isolist = ["a", "b"] self.coollist = ["1 d", "2 w", "shutdown"] self.path_list = s2s.make_folders(self.isolist, self.coollist, self.tempdir)
def test_make_folders_return(self): """Verify list of folders to be generated """ thisdir = os.curdir expected = [ [os.path.join(thisdir, "a_1_d"), "a", "1 d"], [os.path.join(thisdir, "a_2_w"), "a", "2 w"], [os.path.join(thisdir, "a_shutdown"), "a", "shutdown"], [os.path.join(thisdir, "b_1_d"), "b", "1 d"], [os.path.join(thisdir, "b_2_w"), "b", "2 w"], [os.path.join(thisdir, "b_shutdown"), "b", "shutdown"] ] result = s2s.make_folders(self.isolist, self.coollist) expected.sort() result.sort() self.assertEqual(expected, result)
def test_make_folders_return(self): """Verify list of folders to be generated """ thisdir = os.curdir expected = [ [os.path.join(thisdir, "a_1_d"), "a", "1 d"], [os.path.join(thisdir, "a_2_w"), "a", "2 w"], [os.path.join(thisdir, "a_shutdown"), "a", "shutdown"], [os.path.join(thisdir, "b_1_d"), "b", "1 d"], [os.path.join(thisdir, "b_2_w"), "b", "2 w"], [os.path.join(thisdir, "b_shutdown"), "b", "shutdown"] ] result = s2s.make_folders(self.isolist, self.coollist, thisdir) expected.sort() result.sort() self.assertEqual(expected, result)
def test_make_folders_already_exist(self): """Run make_folders() twice to make sure existing folders do not cause a problem """ s2s.make_folders(self.isolist, self.coollist) s2s.make_folders(self.isolist, self.coollist)