MCPcopy Index your code
hub / github.com/foxcpp/maddy / newTestModifier

Function newTestModifier

internal/modify/dkim/dkim_test.go:40–73  ·  view source on GitHub ↗
(t *testing.T, dir, keyAlgo string, domains []string)

Source from the content-addressed store, hash-verified

38)
39
40func newTestModifier(t *testing.T, dir, keyAlgo string, domains []string) *Modifier {
41 mod, err := New(container.New(), "", "test")
42 if err != nil {
43 t.Fatal(err)
44 }
45 m := mod.(*Modifier)
46 m.log = testutils.Logger(t, m.Name())
47
48 err = m.Configure(nil, config.NewMap(nil, config.Node{
49 Children: []config.Node{
50 {
51 Name: "domains",
52 Args: domains,
53 },
54 {
55 Name: "selector",
56 Args: []string{"default"},
57 },
58 {
59 Name: "key_path",
60 Args: []string{filepath.Join(dir, "{domain}.key")},
61 },
62 {
63 Name: "newkey_algo",
64 Args: []string{keyAlgo},
65 },
66 },
67 }))
68 if err != nil {
69 t.Fatal(err)
70 }
71
72 return m
73}
74
75func signTestMsg(t *testing.T, m *Modifier, envelopeFrom string) (textproto.Header, []byte) {
76 t.Helper()

Callers 1

TestGenerateSignVerifyFunction · 0.85

Calls 6

NewFunction · 0.92
LoggerFunction · 0.92
NewMapFunction · 0.92
NewFunction · 0.70
NameMethod · 0.65
ConfigureMethod · 0.65

Tested by

no test coverage detected