1
1
mirror of https://github.com/go-gitea/gitea synced 2024-11-18 08:04:25 +00:00

Correctly decode JSON in api_activitypub_person_test.go

This commit is contained in:
Anthony Wang 2022-06-10 11:19:23 -05:00
parent 86a3221563
commit d487a76572
No known key found for this signature in database
GPG Key ID: BC96B00AEC5F2D76

View File

@ -30,12 +30,13 @@ func TestActivityPubPerson(t *testing.T) {
username := "user2"
req := NewRequestf(t, "GET", fmt.Sprintf("/api/v1/activitypub/user/%s", username))
resp := MakeRequest(t, req, http.StatusOK)
assert.Contains(t, resp.Body.String(), "@context")
body := resp.Body.Bytes()
assert.Contains(t, string(body), "@context")
var m map[string]interface{}
DecodeJSON(t, resp, &m)
var person ap.Person
err := person.UnmarshalJSON(resp.Body.Bytes())
err := person.UnmarshalJSON(body)
assert.NoError(t, err)
assert.Equal(t, ap.ActivityVocabularyType("Person"), person.Type)