/usr/share/gocode/src/strk.kbt.io/projects/go/libravatar/libravatar_test.go is in golang-strk.kbt-projects-go-libravatar-dev 0.0~git20161111.0.d628b68-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 46 47 48 49 50 51 52 53 54 55 56 | // Copyright 2016 by Sandro Santilli <strk@kbt.io>
// Use of this source code is governed by a MIT
// license that can be found in the LICENSE file.
package libravatar
import "testing"
func TestFromEmail(t *testing.T) {
avt := New()
// Email tests
cases := []struct{ in, want string }{
{"strk@kbt.io", "http://avatars.kbt.io/avatar/fe2a9e759730ee64c44bf8901bf4ccc3"},
{"strk@keybit.net", "http://cdn.libravatar.org/avatar/34bafd290f6f39380f5f87e0122daf83"},
{"strk@nonexistent.domain", "http://cdn.libravatar.org/avatar/3f30177111597990b15f8421eaf736c7"},
{"invalid", "mail: missing phrase"},
{"invalid@", "mail: no angle-addr"},
{"@invalid", "mail: missing word in phrase: mail: invalid string"},
}
for _, c := range cases {
got, err := avt.FromEmail(c.in)
if err != nil {
got = err.Error()
}
if got != c.want {
t.Errorf("fromEmail(%q) == %q, expected %q", c.in, got, c.want)
}
}
// TODO: test https with email
// OpenID tests
cases = []struct{ in, want string }{
{"https://strk.kbt.io/openid/", "http://cdn.libravatar.org/avatar/1eaf3174c95d0df02f177f7f6a1df5125ad3d6603fbd062defecd30810a0463c"},
{"invalid", "Is not an absolute URL"},
{"ssh://user@nothttp/", "Invalid protocol: ssh"},
}
for _, c := range cases {
got, err := avt.FromURL(c.in)
if err != nil {
got = err.Error()
}
if got != c.want {
t.Errorf("fromURL(%q) == %q, expected %q", c.in, got, c.want)
}
}
// TODO: test parameters
}
|