func (s *WindowsHookSuite) TestHookCommandNotPowerShellScripts(c *gc.C) { restorer := envtesting.PatchValue(&version.Current.OS, version.Windows) cmdhook := "somehook.cmd" c.Assert(uniter.HookCommand(cmdhook), gc.DeepEquals, []string{cmdhook}) bathook := "somehook.bat" c.Assert(uniter.HookCommand(bathook), gc.DeepEquals, []string{bathook}) restorer() }
func (s *WindowsHookSuite) TestHookCommandPowerShellScript(c *gc.C) { restorer := envtesting.PatchValue(&version.Current.OS, version.Windows) hookname := "powerShellScript.ps1" expected := []string{ "powershell.exe", "-NonInteractive", "-ExecutionPolicy", "RemoteSigned", "-File", hookname, } c.Assert(uniter.HookCommand(hookname), gc.DeepEquals, expected) restorer() }