Example #1
0
func (s *WindowsHookSuite) TestHookCommandNotPowerShellScripts(c *gc.C) {
	restorer := envtesting.PatchValue(&version.Current.OS, version.Windows)
	defer restorer()

	cmdhook := "somehook.cmd"
	c.Assert(runner.HookCommand(cmdhook), gc.DeepEquals, []string{cmdhook})

	bathook := "somehook.bat"
	c.Assert(runner.HookCommand(bathook), gc.DeepEquals, []string{bathook})
}
Example #2
0
func (s *WindowsHookSuite) TestHookCommandNotPowerShellScripts(c *gc.C) {
	restorer := envtesting.PatchValue(&os.HostOS, func() os.OSType { return os.Windows })
	defer restorer()

	cmdhook := "somehook.cmd"
	c.Assert(runner.HookCommand(cmdhook), gc.DeepEquals, []string{cmdhook})

	bathook := "somehook.bat"
	c.Assert(runner.HookCommand(bathook), gc.DeepEquals, []string{bathook})
}
Example #3
0
func (s *WindowsHookSuite) TestHookCommandPowerShellScript(c *gc.C) {
	restorer := envtesting.PatchValue(&version.Current.OS, version.Windows)
	defer restorer()

	hookname := "powerShellScript.ps1"
	expected := []string{
		"powershell.exe",
		"-NonInteractive",
		"-ExecutionPolicy",
		"RemoteSigned",
		"-File",
		hookname,
	}

	c.Assert(runner.HookCommand(hookname), gc.DeepEquals, expected)
}