github.com/wallyworld/juju@v0.0.0-20161013125918-6cf1bc9d917a/service/windows/stubuserops_test.go (about) 1 // Copyright 2015 Cloudbase Solutions 2 // Copyright 2015 Canonical Ltd. 3 // Licensed under the AGPLv3, see LICENCE file for details. 4 5 // +build !linux windows 6 7 package windows 8 9 import ( 10 "syscall" 11 12 "github.com/juju/testing" 13 ) 14 15 type StubGetPassword struct { 16 *testing.Stub 17 18 passwd string 19 } 20 21 func (p *StubGetPassword) SetPasswd(passwd string) { 22 p.passwd = passwd 23 } 24 25 func (p *StubGetPassword) GetPassword() (string, error) { 26 p.AddCall("getPassword") 27 28 err := p.NextErr() 29 if err != nil { 30 return "", err 31 } 32 return p.passwd, nil 33 } 34 35 type StubLogonUser struct { 36 *testing.Stub 37 38 passwd string 39 } 40 41 func (p *StubLogonUser) LogonUser(username *uint16, domain *uint16, 42 password *uint16, logonType uint32, 43 logonProvider uint32) (handle syscall.Handle, err error) { 44 p.AddCall("logonUser") 45 46 err = p.NextErr() 47 if err != nil { 48 return syscall.InvalidHandle, err 49 } 50 // We don't really care about the handle. We are only interested in the 51 // error returned by this function 52 return syscall.InvalidHandle, nil 53 }