-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathhook_dir_test.go
More file actions
45 lines (35 loc) · 812 Bytes
/
hook_dir_test.go
File metadata and controls
45 lines (35 loc) · 812 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package main
import (
"path/filepath"
"testing"
)
func TestHookDirHooks(t *testing.T) {
hooks, err := NewHookDir(filepath.Join("testdata", "hooks")).Hooks()
if err != nil {
t.Fatal(err)
}
if len(hooks) != 3 {
t.Fatalf("3 != %d", len(hooks))
}
hook, ok := hooks.Find("a@a.com")
if !ok {
t.Fatalf("couldn't find hook for a@a.com")
}
if hook.Hook != "http://a.com/a" {
t.Fatalf("http://a.com/a != %s", hook.Hook)
}
hook, ok = hooks.Find("c@a.com")
if !ok {
t.Fatalf("couldn't find hook for c@a.com")
}
if hook.Hook != "http://a.com/b" {
t.Fatalf("http://a.com/b != %s", hook.Hook)
}
hook, ok = hooks.Find("something@b.net")
if !ok {
t.Fatalf("couldn't find hook for something@b.net")
}
if hook.Hook != "http://b.net/" {
t.Fatalf("http://b.net/ != %s", hook.Hook)
}
}