diff options
author | Anthony Wang | 2022-03-19 16:36:44 -0500 |
---|---|---|
committer | Anthony Wang | 2022-03-19 16:36:44 -0500 |
commit | ea4129e88825e05a1c1cb803190f0351af7c6f60 (patch) | |
tree | 3a1e39b4ee8c422aadbd72e33c98366017558f9e | |
parent | f9e33d97cccf4de527567e93ff19a3d9d2223abb (diff) |
Use Gitea JSON library, add assert for pkp
Signed-off-by: Anthony Wang <ta180m@pm.me>
-rw-r--r-- | integrations/api_activitypub_person_test.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/integrations/api_activitypub_person_test.go b/integrations/api_activitypub_person_test.go index c204e6211..6d15ede0e 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() { |