diff options
author | 2022-07-12 08:32:20 +0100 | |
---|---|---|
committer | 2022-07-12 08:32:20 +0100 | |
commit | 6934ae378ab5743da80a5995fc74d167502187b1 (patch) | |
tree | 6e3f58498158f1e844504961338eadb18f5a590e /internal/api/client/status/statusboost_test.go | |
parent | [performance] Add new index to fix slow web profile queries (#706) (diff) | |
download | gotosocial-6934ae378ab5743da80a5995fc74d167502187b1.tar.xz |
[chore] improved router logging, recovery and error handling (#705)
* move panic recovery to logging middleware, improve logging + panic recovery logic
Signed-off-by: kim <grufwub@gmail.com>
* remove dead code
Signed-off-by: kim <grufwub@gmail.com>
* remove skip paths code
Signed-off-by: kim <grufwub@gmail.com>
* re-enable log quoting
Signed-off-by: kim <grufwub@gmail.com>
* use human-friendly bytesize in logging body size
Signed-off-by: kim <grufwub@gmail.com>
* only disable quoting in debug builds
Signed-off-by: kim <grufwub@gmail.com>
* use logrus level instead of debug.DEBUG() to enable/disable quoting
Signed-off-by: kim <grufwub@gmail.com>
* shutup linter
Signed-off-by: kim <grufwub@gmail.com>
* fix instance tests
Signed-off-by: kim <grufwub@gmail.com>
* fix gin test contexts created with missing engine HTML renderer
Signed-off-by: kim <grufwub@gmail.com>
* add note regarding not logging query parameters
Signed-off-by: kim <grufwub@gmail.com>
* better explain 'DisableQuoting' logic
Signed-off-by: kim <grufwub@gmail.com>
* add license text
Signed-off-by: kim <grufwub@gmail.com>
Diffstat (limited to 'internal/api/client/status/statusboost_test.go')
-rw-r--r-- | internal/api/client/status/statusboost_test.go | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/internal/api/client/status/statusboost_test.go b/internal/api/client/status/statusboost_test.go index c8d33f0f8..5b4b1b3cd 100644 --- a/internal/api/client/status/statusboost_test.go +++ b/internal/api/client/status/statusboost_test.go @@ -31,6 +31,7 @@ import ( "github.com/superseriousbusiness/gotosocial/internal/api/model" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/oauth" + "github.com/superseriousbusiness/gotosocial/testrig" ) type StatusBoostTestSuite struct { @@ -38,7 +39,6 @@ type StatusBoostTestSuite struct { } func (suite *StatusBoostTestSuite) TestPostBoost() { - t := suite.testTokens["local_account_1"] oauthToken := oauth.DBTokenToToken(t) @@ -46,7 +46,7 @@ func (suite *StatusBoostTestSuite) TestPostBoost() { // setup recorder := httptest.NewRecorder() - ctx, _ := gin.CreateTestContext(recorder) + ctx, _ := testrig.CreateGinTestContext(recorder, nil) ctx.Set(oauth.SessionAuthorizedApplication, suite.testApplications["application_1"]) ctx.Set(oauth.SessionAuthorizedToken, oauthToken) ctx.Set(oauth.SessionAuthorizedUser, suite.testUsers["local_account_1"]) @@ -112,7 +112,7 @@ func (suite *StatusBoostTestSuite) TestPostBoostOwnFollowersOnly() { testUser := suite.testUsers["local_account_1"] recorder := httptest.NewRecorder() - ctx, _ := gin.CreateTestContext(recorder) + ctx, _ := testrig.CreateGinTestContext(recorder, nil) ctx.Set(oauth.SessionAuthorizedApplication, suite.testApplications["application_1"]) ctx.Set(oauth.SessionAuthorizedToken, oauthToken) ctx.Set(oauth.SessionAuthorizedUser, testUser) @@ -170,7 +170,6 @@ func (suite *StatusBoostTestSuite) TestPostBoostOwnFollowersOnly() { // try to boost a status that's not boostable func (suite *StatusBoostTestSuite) TestPostUnboostable() { - t := suite.testTokens["local_account_1"] oauthToken := oauth.DBTokenToToken(t) @@ -178,7 +177,7 @@ func (suite *StatusBoostTestSuite) TestPostUnboostable() { // setup recorder := httptest.NewRecorder() - ctx, _ := gin.CreateTestContext(recorder) + ctx, _ := testrig.CreateGinTestContext(recorder, nil) ctx.Set(oauth.SessionAuthorizedApplication, suite.testApplications["application_1"]) ctx.Set(oauth.SessionAuthorizedToken, oauthToken) ctx.Set(oauth.SessionAuthorizedUser, suite.testUsers["local_account_1"]) @@ -209,7 +208,6 @@ func (suite *StatusBoostTestSuite) TestPostUnboostable() { // try to boost a status that's not visible to the user func (suite *StatusBoostTestSuite) TestPostNotVisible() { - // stop local_account_2 following zork err := suite.db.DeleteByID(context.Background(), suite.testFollows["local_account_2_local_account_1"].ID, >smodel.Follow{}) suite.NoError(err) @@ -221,7 +219,7 @@ func (suite *StatusBoostTestSuite) TestPostNotVisible() { // setup recorder := httptest.NewRecorder() - ctx, _ := gin.CreateTestContext(recorder) + ctx, _ := testrig.CreateGinTestContext(recorder, nil) ctx.Set(oauth.SessionAuthorizedApplication, suite.testApplications["application_1"]) ctx.Set(oauth.SessionAuthorizedToken, oauthToken) ctx.Set(oauth.SessionAuthorizedUser, suite.testUsers["local_account_2"]) |