summaryrefslogtreecommitdiff
path: root/internal/api/client/followrequests/authorize_test.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2023-01-13 17:02:45 +0100
committerLibravatar GitHub <noreply@github.com>2023-01-13 17:02:45 +0100
commiteafd73c29204072050591a0579e0cedb174e6d38 (patch)
tree8cb581647e00f366395d97d27c36c6099e93754b /internal/api/client/followrequests/authorize_test.go
parent[performance] media processing improvements (#1288) (diff)
downloadgotosocial-eafd73c29204072050591a0579e0cedb174e6d38.tar.xz
[chore] Remove omitempty on account source; refactor tests to use prettyprint json (#1337)
* remove omitEmpty tag on account source items * update tests
Diffstat (limited to 'internal/api/client/followrequests/authorize_test.go')
-rw-r--r--internal/api/client/followrequests/authorize_test.go27
1 files changed, 22 insertions, 5 deletions
diff --git a/internal/api/client/followrequests/authorize_test.go b/internal/api/client/followrequests/authorize_test.go
index 4f2e69d49..e6ad1ff30 100644
--- a/internal/api/client/followrequests/authorize_test.go
+++ b/internal/api/client/followrequests/authorize_test.go
@@ -19,7 +19,9 @@
package followrequests_test
import (
+ "bytes"
"context"
+ "encoding/json"
"fmt"
"io/ioutil"
"net/http"
@@ -28,7 +30,6 @@ import (
"time"
"github.com/gin-gonic/gin"
- "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/gotosocial/internal/api/client/followrequests"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
@@ -77,9 +78,25 @@ func (suite *AuthorizeTestSuite) TestAuthorize() {
// check the response
b, err := ioutil.ReadAll(result.Body)
- assert.NoError(suite.T(), err)
-
- suite.Equal(`{"id":"01FHMQX3GAABWSM0S2VZEC2SWC","following":false,"showing_reblogs":false,"notifying":false,"followed_by":true,"blocking":false,"blocked_by":false,"muting":false,"muting_notifications":false,"requested":false,"domain_blocking":false,"endorsed":false,"note":""}`, string(b))
+ suite.NoError(err)
+ dst := new(bytes.Buffer)
+ err = json.Indent(dst, b, "", " ")
+ suite.NoError(err)
+ suite.Equal(`{
+ "id": "01FHMQX3GAABWSM0S2VZEC2SWC",
+ "following": false,
+ "showing_reblogs": false,
+ "notifying": false,
+ "followed_by": true,
+ "blocking": false,
+ "blocked_by": false,
+ "muting": false,
+ "muting_notifications": false,
+ "requested": false,
+ "domain_blocking": false,
+ "endorsed": false,
+ "note": ""
+}`, dst.String())
}
func (suite *AuthorizeTestSuite) TestAuthorizeNoFR() {
@@ -105,7 +122,7 @@ func (suite *AuthorizeTestSuite) TestAuthorizeNoFR() {
// check the response
b, err := ioutil.ReadAll(result.Body)
- assert.NoError(suite.T(), err)
+ suite.NoError(err)
suite.Equal(`{"error":"Not Found"}`, string(b))
}