github.com/cloudfoundry-attic/ltc@v0.0.0-20151123212628-098adc7919fc/ssh/mocks/fake_term.go (about) 1 // This file was generated by counterfeiter 2 package mocks 3 4 import ( 5 "sync" 6 7 "github.com/cloudfoundry-incubator/ltc/ssh" 8 "github.com/docker/docker/pkg/term" 9 ) 10 11 type FakeTerm struct { 12 SetRawTerminalStub func(fd uintptr) (*term.State, error) 13 setRawTerminalMutex sync.RWMutex 14 setRawTerminalArgsForCall []struct { 15 fd uintptr 16 } 17 setRawTerminalReturns struct { 18 result1 *term.State 19 result2 error 20 } 21 RestoreTerminalStub func(fd uintptr, state *term.State) error 22 restoreTerminalMutex sync.RWMutex 23 restoreTerminalArgsForCall []struct { 24 fd uintptr 25 state *term.State 26 } 27 restoreTerminalReturns struct { 28 result1 error 29 } 30 GetWinsizeStub func(fd uintptr) (width int, height int) 31 getWinsizeMutex sync.RWMutex 32 getWinsizeArgsForCall []struct { 33 fd uintptr 34 } 35 getWinsizeReturns struct { 36 result1 int 37 result2 int 38 } 39 IsTTYStub func(fd uintptr) bool 40 isTTYMutex sync.RWMutex 41 isTTYArgsForCall []struct { 42 fd uintptr 43 } 44 isTTYReturns struct { 45 result1 bool 46 } 47 } 48 49 func (fake *FakeTerm) SetRawTerminal(fd uintptr) (*term.State, error) { 50 fake.setRawTerminalMutex.Lock() 51 fake.setRawTerminalArgsForCall = append(fake.setRawTerminalArgsForCall, struct { 52 fd uintptr 53 }{fd}) 54 fake.setRawTerminalMutex.Unlock() 55 if fake.SetRawTerminalStub != nil { 56 return fake.SetRawTerminalStub(fd) 57 } else { 58 return fake.setRawTerminalReturns.result1, fake.setRawTerminalReturns.result2 59 } 60 } 61 62 func (fake *FakeTerm) SetRawTerminalCallCount() int { 63 fake.setRawTerminalMutex.RLock() 64 defer fake.setRawTerminalMutex.RUnlock() 65 return len(fake.setRawTerminalArgsForCall) 66 } 67 68 func (fake *FakeTerm) SetRawTerminalArgsForCall(i int) uintptr { 69 fake.setRawTerminalMutex.RLock() 70 defer fake.setRawTerminalMutex.RUnlock() 71 return fake.setRawTerminalArgsForCall[i].fd 72 } 73 74 func (fake *FakeTerm) SetRawTerminalReturns(result1 *term.State, result2 error) { 75 fake.SetRawTerminalStub = nil 76 fake.setRawTerminalReturns = struct { 77 result1 *term.State 78 result2 error 79 }{result1, result2} 80 } 81 82 func (fake *FakeTerm) RestoreTerminal(fd uintptr, state *term.State) error { 83 fake.restoreTerminalMutex.Lock() 84 fake.restoreTerminalArgsForCall = append(fake.restoreTerminalArgsForCall, struct { 85 fd uintptr 86 state *term.State 87 }{fd, state}) 88 fake.restoreTerminalMutex.Unlock() 89 if fake.RestoreTerminalStub != nil { 90 return fake.RestoreTerminalStub(fd, state) 91 } else { 92 return fake.restoreTerminalReturns.result1 93 } 94 } 95 96 func (fake *FakeTerm) RestoreTerminalCallCount() int { 97 fake.restoreTerminalMutex.RLock() 98 defer fake.restoreTerminalMutex.RUnlock() 99 return len(fake.restoreTerminalArgsForCall) 100 } 101 102 func (fake *FakeTerm) RestoreTerminalArgsForCall(i int) (uintptr, *term.State) { 103 fake.restoreTerminalMutex.RLock() 104 defer fake.restoreTerminalMutex.RUnlock() 105 return fake.restoreTerminalArgsForCall[i].fd, fake.restoreTerminalArgsForCall[i].state 106 } 107 108 func (fake *FakeTerm) RestoreTerminalReturns(result1 error) { 109 fake.RestoreTerminalStub = nil 110 fake.restoreTerminalReturns = struct { 111 result1 error 112 }{result1} 113 } 114 115 func (fake *FakeTerm) GetWinsize(fd uintptr) (width int, height int) { 116 fake.getWinsizeMutex.Lock() 117 fake.getWinsizeArgsForCall = append(fake.getWinsizeArgsForCall, struct { 118 fd uintptr 119 }{fd}) 120 fake.getWinsizeMutex.Unlock() 121 if fake.GetWinsizeStub != nil { 122 return fake.GetWinsizeStub(fd) 123 } else { 124 return fake.getWinsizeReturns.result1, fake.getWinsizeReturns.result2 125 } 126 } 127 128 func (fake *FakeTerm) GetWinsizeCallCount() int { 129 fake.getWinsizeMutex.RLock() 130 defer fake.getWinsizeMutex.RUnlock() 131 return len(fake.getWinsizeArgsForCall) 132 } 133 134 func (fake *FakeTerm) GetWinsizeArgsForCall(i int) uintptr { 135 fake.getWinsizeMutex.RLock() 136 defer fake.getWinsizeMutex.RUnlock() 137 return fake.getWinsizeArgsForCall[i].fd 138 } 139 140 func (fake *FakeTerm) GetWinsizeReturns(result1 int, result2 int) { 141 fake.GetWinsizeStub = nil 142 fake.getWinsizeReturns = struct { 143 result1 int 144 result2 int 145 }{result1, result2} 146 } 147 148 func (fake *FakeTerm) IsTTY(fd uintptr) bool { 149 fake.isTTYMutex.Lock() 150 fake.isTTYArgsForCall = append(fake.isTTYArgsForCall, struct { 151 fd uintptr 152 }{fd}) 153 fake.isTTYMutex.Unlock() 154 if fake.IsTTYStub != nil { 155 return fake.IsTTYStub(fd) 156 } else { 157 return fake.isTTYReturns.result1 158 } 159 } 160 161 func (fake *FakeTerm) IsTTYCallCount() int { 162 fake.isTTYMutex.RLock() 163 defer fake.isTTYMutex.RUnlock() 164 return len(fake.isTTYArgsForCall) 165 } 166 167 func (fake *FakeTerm) IsTTYArgsForCall(i int) uintptr { 168 fake.isTTYMutex.RLock() 169 defer fake.isTTYMutex.RUnlock() 170 return fake.isTTYArgsForCall[i].fd 171 } 172 173 func (fake *FakeTerm) IsTTYReturns(result1 bool) { 174 fake.IsTTYStub = nil 175 fake.isTTYReturns = struct { 176 result1 bool 177 }{result1} 178 } 179 180 var _ ssh.Term = new(FakeTerm)