Пример #1
0
def test_scripts_per_dir_should_accept_root_without_trailing_slash(
        monkeypatch, hooks_dir):
    with monkeypatch.context() as m:
        hooks_root = hooks.P_VDSM_HOOKS.rstrip("/")
        m.setattr(hooks, "P_VDSM_HOOKS", hooks_root)
        scripts = hooks._scriptsPerDir(hooks_dir.basename)

        assert len(scripts) == 1
Пример #2
0
 def test_scriptsPerDir(self):
     with self.tempScripts() as (dirName, scripts):
         sNames = [script.name for script in scripts]
         hooksNames = hooks._scriptsPerDir(dirName)
         hooksNames.sort()
         self.assertEqual(sNames, hooksNames)
Пример #3
0
def test_scripts_per_dir_should_list_scripts(hooks_dir):
    scripts = hooks._scriptsPerDir(hooks_dir.basename)

    assert len(scripts) == 2
    assert sorted(scripts) == sorted(list(str(p) for p in hooks_dir.visit()))
Пример #4
0
def test_scripts_per_dir_should_raise(fake_hooks_root, dir_name, error):
    with pytest.raises(ValueError) as e:
        hooks._scriptsPerDir(dir_name)

    assert error in str(e.value)
Пример #5
0
def test_scripts_per_dir_should_not_list(hooks_dir):
    assert hooks._scriptsPerDir(hooks_dir.basename) == []
Пример #6
0
 def test_scriptsPerDir(self):
     with self.tempScripts() as (dirName, scripts):
         sNames = [script.name for script in scripts]
         hooksNames = hooks._scriptsPerDir(dirName)
         hooksNames.sort()
         self.assertEqual(sNames, hooksNames)