mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-06 14:20:55 +03:00
test: add test for InitializeActionHandler
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
This commit is contained in:
committed by
Nicola Murino
parent
75750e3a79
commit
56bf8364cd
@@ -179,3 +179,27 @@ func TestPreDeleteAction(t *testing.T) {
|
|||||||
|
|
||||||
Config.Actions = actionsCopy
|
Config.Actions = actionsCopy
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type actionHandlerStub struct {
|
||||||
|
called bool
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h *actionHandlerStub) Handle(notification ActionNotification) error {
|
||||||
|
h.called = true
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestInitializeActionHandler(t *testing.T) {
|
||||||
|
handler := &actionHandlerStub{}
|
||||||
|
|
||||||
|
InitializeActionHandler(handler)
|
||||||
|
t.Cleanup(func() {
|
||||||
|
InitializeActionHandler(defaultActionHandler{})
|
||||||
|
})
|
||||||
|
|
||||||
|
err := actionHandler.Handle(ActionNotification{})
|
||||||
|
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.True(t, handler.called)
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user