webid_test.go 700 B

1234567891011121314151617181920212223242526272829303132
  1. package gold
  2. import (
  3. "net/http"
  4. "testing"
  5. "github.com/stretchr/testify/assert"
  6. )
  7. func TestWebIDTLSauth(t *testing.T) {
  8. request, err := http.NewRequest("HEAD", testServer.URL, nil)
  9. assert.NoError(t, err)
  10. response, err := user1h.Do(request)
  11. assert.NoError(t, err)
  12. response.Body.Close()
  13. assert.Equal(t, 200, response.StatusCode)
  14. assert.Equal(t, user1, response.Header.Get("User"))
  15. }
  16. func TestAddProfileKeys(t *testing.T) {
  17. webid := testServer.URL + "/_test/user1#id"
  18. var account = webidAccount{
  19. WebID: webid,
  20. }
  21. g := NewWebIDProfile(account)
  22. g, k, p, err := AddProfileKeys(webid, g)
  23. assert.NoError(t, err)
  24. assert.NotNil(t, k)
  25. assert.NotNil(t, p)
  26. assert.Equal(t, 15, g.Len())
  27. }