def test_base_directory_does_not_exist(self): """ Test when base directory does not exist or contains incorrect name """ path_to_create = "opt/" path_with_error = self.basedir + "/error_path" msg, path_created = create_directory(path_with_error, path_to_create) self.assertEquals(msg, _("Base path does not exist"))
def test_directory_already_exists(self): """ Test directory creation when it already exists """ # in this case, nothing will change path_to_create = "opt/" mkdir(path.join(self.basedir, path_to_create)) self.assertTrue(path.exists(path.join(self.basedir, path_to_create))) # call function to create an already created directory msg, path_created = create_directory(self.basedir, path_to_create) self.assertEquals(msg, "") self.assertEquals(path_created, path.join(self.basedir, path_to_create))
def test_directory_create(self): """ Test if directory is created correctly """ path_to_create = "opt/" create_directory(self.basedir, path_to_create) self.assertTrue(path.exists(path.join(self.basedir, path_to_create)))