From ea4129e88825e05a1c1cb803190f0351af7c6f60 Mon Sep 17 00:00:00 2001 From: Anthony Wang Date: Sat, 19 Mar 2022 16:36:44 -0500 Subject: [PATCH] Use Gitea JSON library, add assert for pkp Signed-off-by: Anthony Wang --- integrations/api_activitypub_person_test.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/integrations/api_activitypub_person_test.go b/integrations/api_activitypub_person_test.go index c204e6211c..6d15ede0e0 100644 --- a/integrations/api_activitypub_person_test.go +++ b/integrations/api_activitypub_person_test.go @@ -6,13 +6,13 @@ package integrations import ( "context" - "encoding/json" "fmt" "net/http" "net/http/httptest" "net/url" "testing" + "code.gitea.io/gitea/modules/json" user_model "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/modules/activitypub" "code.gitea.io/gitea/modules/setting" @@ -37,7 +37,7 @@ func TestActivityPubPerson(t *testing.T) { resp := MakeRequest(t, req, http.StatusOK) assert.Contains(t, resp.Body.String(), "@context") var m map[string]interface{} - _ = json.Unmarshal(resp.Body.Bytes(), &m) + err := json.Unmarshal(resp.Body.Bytes(), &m) var person vocab.ActivityStreamsPerson resolver, _ := streams.NewJSONResolver(func(c context.Context, p vocab.ActivityStreamsPerson) error { @@ -55,6 +55,7 @@ func TestActivityPubPerson(t *testing.T) { assert.Regexp(t, fmt.Sprintf("activitypub/user/%s/inbox$", username), person.GetActivityStreamsInbox().GetIRI().String()) pkp := person.GetW3IDSecurityV1PublicKey() + assert.NotNil(t, pkp) publicKeyID := keyID + "/#main-key" var pkpFound vocab.W3IDSecurityV1PublicKey for pkpIter := pkp.Begin(); pkpIter != pkp.End(); pkpIter = pkpIter.Next() {