2014-06-26 18:52:15 -05:00
|
|
|
package terraform
|
|
|
|
|
|
|
|
// MockHook is an implementation of Hook that can be used for tests.
|
|
|
|
// It records all of its function calls.
|
|
|
|
type MockHook struct {
|
|
|
|
PostRefreshCalled bool
|
2014-06-26 19:05:21 -05:00
|
|
|
PostRefreshId string
|
2014-06-26 18:52:15 -05:00
|
|
|
PostRefreshState *ResourceState
|
|
|
|
PostRefreshReturn HookAction
|
|
|
|
PostRefreshError error
|
|
|
|
|
|
|
|
PreRefreshCalled bool
|
2014-06-26 19:05:21 -05:00
|
|
|
PreRefreshId string
|
2014-06-26 18:52:15 -05:00
|
|
|
PreRefreshState *ResourceState
|
|
|
|
PreRefreshReturn HookAction
|
|
|
|
PreRefreshError error
|
|
|
|
}
|
|
|
|
|
2014-06-26 19:05:21 -05:00
|
|
|
func (h *MockHook) PreRefresh(n string, s *ResourceState) (HookAction, error) {
|
2014-06-26 18:52:15 -05:00
|
|
|
h.PreRefreshCalled = true
|
2014-06-26 19:05:21 -05:00
|
|
|
h.PreRefreshId = n
|
2014-06-26 18:52:15 -05:00
|
|
|
h.PreRefreshState = s
|
|
|
|
return h.PreRefreshReturn, h.PreRefreshError
|
|
|
|
}
|
|
|
|
|
2014-06-26 19:05:21 -05:00
|
|
|
func (h *MockHook) PostRefresh(n string, s *ResourceState) (HookAction, error) {
|
2014-06-26 18:52:15 -05:00
|
|
|
h.PostRefreshCalled = true
|
2014-06-26 19:05:21 -05:00
|
|
|
h.PostRefreshId = n
|
2014-06-26 18:52:15 -05:00
|
|
|
h.PostRefreshState = s
|
|
|
|
return h.PostRefreshReturn, h.PostRefreshError
|
|
|
|
}
|