26 lines
687 B
Go
26 lines
687 B
Go
package mitm
|
|
|
|
import "testing"
|
|
|
|
func TestDiskCachePath(t *testing.T) {
|
|
cache := diskCache("testdata")
|
|
tests := []struct {
|
|
test string
|
|
want string
|
|
}{
|
|
{"x.com", "testdata/com/x/x.com.crt"},
|
|
{"feed.x.com", "testdata/com/x/x/feed.x.com.crt"},
|
|
{"nu.nl", "testdata/nl/n/nu/nu.nl.crt"},
|
|
{"maze.io", "testdata/io/m/ma/maze.io.crt"},
|
|
{"lab.maze.io", "testdata/io/m/ma/maze/lab.maze.io.crt"},
|
|
{"dev.lab.maze.io", "testdata/io/m/ma/maze/dev.lab.maze.io.crt"},
|
|
}
|
|
for _, test := range tests {
|
|
t.Run(test.test, func(it *testing.T) {
|
|
if v := cache.path(test.test); v != test.want {
|
|
it.Errorf("expected %q to resolve to %q, got %q", test.test, test.want, v)
|
|
}
|
|
})
|
|
}
|
|
}
|