package onionloc import ( "io" "net/http" "strings" "testing" ) func TestHTML(t *testing.T) { for _, table := range []struct { desc string html string want string }{ {"onion location set", htmlNoOnionLocation, ""}, {"onion location unset", htmlOnionLocation, htmlOnionLocationValue}, } { var r http.Response r.Body = io.NopCloser(strings.NewReader(table.html)) v, ok := HTML(&r) if got, want := ok, table.want != ""; got != want { t.Errorf("%s: got ok %v but wanted %v", table.desc, got, want) continue } if !ok { continue } if got, want := v, table.want; got != want { t.Errorf("%s: got %s but wanted %s", table.desc, got, want) } } } // curl -s https://www.rgdd.se/ const htmlNoOnionLocation = ` rgdd.se

avatar

PhD student at Karlstad University. Software engineer at Glasklar Teknik. I am passionate about transparency logs, anonymity networks, and Linux. I have a keen interest for the overlap between research, engineering, and operations. Off-work I cook, walk, socialize, lift weights, and spoil my cat.

Project involvement

I am a core member of the following projects:

Selected publications

Contact

Feel free to reach out on email or other platforms as you see fit.

` const htmlOnionLocationValue = "http://cyigahm4clwlimo6mfl4yjie5fwfbhlbuag57xo3kimk6invht6ffrad.onion/" // curl -s https://www.rgdd.se/ // then add // somewhere in the head portion const htmlOnionLocation = ` rgdd.se

avatar

PhD student at Karlstad University. Software engineer at Glasklar Teknik. I am passionate about transparency logs, anonymity networks, and Linux. I have a keen interest for the overlap between research, engineering, and operations. Off-work I cook, walk, socialize, lift weights, and spoil my cat.

Project involvement

I am a core member of the following projects:

Selected publications

Contact

Feel free to reach out on email or other platforms as you see fit.

`