MCPcopy Create free account
hub / github.com/foxcpp/maddy / TestFieldsToSign

Function TestFieldsToSign

internal/modify/dkim/dkim_test.go:226–246  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

224}
225
226func TestFieldsToSign(t *testing.T) {
227 h := textproto.Header{}
228 h.Add("A", "1")
229 h.Add("c", "2")
230 h.Add("C", "3")
231 h.Add("a", "4")
232 h.Add("b", "5")
233 h.Add("unrelated", "6")
234
235 m := Modifier{
236 oversignHeader: []string{"A", "B"},
237 signHeader: []string{"C"},
238 }
239 fields := m.fieldsToSign(&h)
240 sort.Strings(fields)
241 expected := []string{"A", "A", "A", "B", "B", "C", "C"}
242
243 if !reflect.DeepEqual(fields, expected) {
244 t.Errorf("incorrect set of fields to sign\nwant: %v\ngot: %v", expected, fields)
245 }
246}

Callers

nothing calls this directly

Calls 2

fieldsToSignMethod · 0.95
AddMethod · 0.80

Tested by

no test coverage detected