1
0
mirror of https://github.com/drakkan/sftpgo.git synced 2025-11-29 22:08:10 +02:00

test: add test for InitializeActionHandler

Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
This commit is contained in:
Mark Sagi-Kazar
2020-10-20 22:51:58 +02:00
committed by Nicola Murino
parent 75750e3a79
commit 56bf8364cd

View File

@@ -179,3 +179,27 @@ func TestPreDeleteAction(t *testing.T) {
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)
}