mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-29 11:46:16 -06:00
fix tests
This commit is contained in:
parent
513f4fefed
commit
7bca8c4f19
6 changed files with 20 additions and 10 deletions
|
|
@ -102,7 +102,7 @@ import (
|
||||||
// description: internal server error
|
// description: internal server error
|
||||||
func (m *Module) InstancePeersGETHandler(c *gin.Context) {
|
func (m *Module) InstancePeersGETHandler(c *gin.Context) {
|
||||||
authed, errWithCode := apiutil.TokenAuth(c,
|
authed, errWithCode := apiutil.TokenAuth(c,
|
||||||
true, true, true, true,
|
false, false, false, false,
|
||||||
)
|
)
|
||||||
if errWithCode != nil {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ func (suite *PushTestSuite) TestDeleteSubscription() {
|
||||||
func (suite *PushTestSuite) TestDeleteMissingSubscription() {
|
func (suite *PushTestSuite) TestDeleteMissingSubscription() {
|
||||||
accountFixtureName := "local_account_1"
|
accountFixtureName := "local_account_1"
|
||||||
// This token should not have a subscription.
|
// This token should not have a subscription.
|
||||||
tokenFixtureName := "local_account_1_user_authorization_token"
|
tokenFixtureName := "local_account_1_push_only"
|
||||||
|
|
||||||
err := suite.deleteSubscription(accountFixtureName, tokenFixtureName, 200)
|
err := suite.deleteSubscription(accountFixtureName, tokenFixtureName, 200)
|
||||||
suite.NoError(err)
|
suite.NoError(err)
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ func (suite *PushTestSuite) TestGetSubscription() {
|
||||||
func (suite *PushTestSuite) TestGetMissingSubscription() {
|
func (suite *PushTestSuite) TestGetMissingSubscription() {
|
||||||
accountFixtureName := "local_account_1"
|
accountFixtureName := "local_account_1"
|
||||||
// This token should not have a subscription.
|
// This token should not have a subscription.
|
||||||
tokenFixtureName := "local_account_1_user_authorization_token"
|
tokenFixtureName := "local_account_1_push_only"
|
||||||
|
|
||||||
_, err := suite.getSubscription(accountFixtureName, tokenFixtureName, 404)
|
_, err := suite.getSubscription(accountFixtureName, tokenFixtureName, 404)
|
||||||
suite.NoError(err)
|
suite.NoError(err)
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ func (suite *PushTestSuite) postSubscription(
|
||||||
func (suite *PushTestSuite) TestPostSubscription() {
|
func (suite *PushTestSuite) TestPostSubscription() {
|
||||||
accountFixtureName := "local_account_1"
|
accountFixtureName := "local_account_1"
|
||||||
// This token should not have a subscription.
|
// This token should not have a subscription.
|
||||||
tokenFixtureName := "local_account_1_user_authorization_token"
|
tokenFixtureName := "local_account_1_push_only"
|
||||||
|
|
||||||
endpoint := "https://example.test/push"
|
endpoint := "https://example.test/push"
|
||||||
auth := "cgna/fzrYLDQyPf5hD7IsA=="
|
auth := "cgna/fzrYLDQyPf5hD7IsA=="
|
||||||
|
|
@ -152,7 +152,7 @@ func (suite *PushTestSuite) TestPostSubscription() {
|
||||||
func (suite *PushTestSuite) TestPostSubscriptionMinimal() {
|
func (suite *PushTestSuite) TestPostSubscriptionMinimal() {
|
||||||
accountFixtureName := "local_account_1"
|
accountFixtureName := "local_account_1"
|
||||||
// This token should not have a subscription.
|
// This token should not have a subscription.
|
||||||
tokenFixtureName := "local_account_1_user_authorization_token"
|
tokenFixtureName := "local_account_1_push_only"
|
||||||
|
|
||||||
endpoint := "https://example.test/push"
|
endpoint := "https://example.test/push"
|
||||||
auth := "cgna/fzrYLDQyPf5hD7IsA=="
|
auth := "cgna/fzrYLDQyPf5hD7IsA=="
|
||||||
|
|
@ -186,7 +186,7 @@ func (suite *PushTestSuite) TestPostSubscriptionMinimal() {
|
||||||
func (suite *PushTestSuite) TestPostInvalidSubscription() {
|
func (suite *PushTestSuite) TestPostInvalidSubscription() {
|
||||||
accountFixtureName := "local_account_1"
|
accountFixtureName := "local_account_1"
|
||||||
// This token should not have a subscription.
|
// This token should not have a subscription.
|
||||||
tokenFixtureName := "local_account_1_user_authorization_token"
|
tokenFixtureName := "local_account_1_push_only"
|
||||||
|
|
||||||
// No endpoint.
|
// No endpoint.
|
||||||
auth := "cgna/fzrYLDQyPf5hD7IsA=="
|
auth := "cgna/fzrYLDQyPf5hD7IsA=="
|
||||||
|
|
@ -212,7 +212,7 @@ func (suite *PushTestSuite) TestPostInvalidSubscription() {
|
||||||
func (suite *PushTestSuite) TestPostSubscriptionJSON() {
|
func (suite *PushTestSuite) TestPostSubscriptionJSON() {
|
||||||
accountFixtureName := "local_account_1"
|
accountFixtureName := "local_account_1"
|
||||||
// This token should not have a subscription.
|
// This token should not have a subscription.
|
||||||
tokenFixtureName := "local_account_1_user_authorization_token"
|
tokenFixtureName := "local_account_1_push_only"
|
||||||
|
|
||||||
requestJson := `{
|
requestJson := `{
|
||||||
"subscription": {
|
"subscription": {
|
||||||
|
|
@ -258,7 +258,7 @@ func (suite *PushTestSuite) TestPostSubscriptionJSON() {
|
||||||
func (suite *PushTestSuite) TestPostSubscriptionJSONMinimal() {
|
func (suite *PushTestSuite) TestPostSubscriptionJSONMinimal() {
|
||||||
accountFixtureName := "local_account_1"
|
accountFixtureName := "local_account_1"
|
||||||
// This token should not have a subscription.
|
// This token should not have a subscription.
|
||||||
tokenFixtureName := "local_account_1_user_authorization_token"
|
tokenFixtureName := "local_account_1_push_only"
|
||||||
|
|
||||||
requestJson := `{
|
requestJson := `{
|
||||||
"subscription": {
|
"subscription": {
|
||||||
|
|
@ -298,7 +298,7 @@ func (suite *PushTestSuite) TestPostSubscriptionJSONMinimal() {
|
||||||
func (suite *PushTestSuite) TestPostInvalidSubscriptionJSON() {
|
func (suite *PushTestSuite) TestPostInvalidSubscriptionJSON() {
|
||||||
accountFixtureName := "local_account_1"
|
accountFixtureName := "local_account_1"
|
||||||
// This token should not have a subscription.
|
// This token should not have a subscription.
|
||||||
tokenFixtureName := "local_account_1_user_authorization_token"
|
tokenFixtureName := "local_account_1_push_only"
|
||||||
|
|
||||||
// No endpoint.
|
// No endpoint.
|
||||||
requestJson := `{
|
requestJson := `{
|
||||||
|
|
|
||||||
|
|
@ -170,7 +170,7 @@ func (suite *PushTestSuite) TestPutSubscriptionJSON() {
|
||||||
func (suite *PushTestSuite) TestPutMissingSubscription() {
|
func (suite *PushTestSuite) TestPutMissingSubscription() {
|
||||||
accountFixtureName := "local_account_1"
|
accountFixtureName := "local_account_1"
|
||||||
// This token should not have a subscription.
|
// This token should not have a subscription.
|
||||||
tokenFixtureName := "local_account_1_user_authorization_token"
|
tokenFixtureName := "local_account_1_push_only"
|
||||||
|
|
||||||
alertsMention := true
|
alertsMention := true
|
||||||
alertsStatus := false
|
alertsStatus := false
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,16 @@ func NewTestTokens() map[string]*gtsmodel.Token {
|
||||||
AccessCreateAt: TimeMustParse("2022-06-10T15:22:08Z"),
|
AccessCreateAt: TimeMustParse("2022-06-10T15:22:08Z"),
|
||||||
AccessExpiresAt: TimeMustParse("2050-01-01T15:22:08Z"),
|
AccessExpiresAt: TimeMustParse("2050-01-01T15:22:08Z"),
|
||||||
},
|
},
|
||||||
|
"local_account_1_push_only": {
|
||||||
|
ID: "01JN0X2D9GJTZQ5KYPYFWN16QW",
|
||||||
|
ClientID: "01F8MGV8AC3NGSJW0FE8W1BV70",
|
||||||
|
UserID: "01F8MGVGPHQ2D3P3X0454H54Z5",
|
||||||
|
RedirectURI: "http://localhost:8080",
|
||||||
|
Scope: "push",
|
||||||
|
Access: "01JN0X49RYKMP6G9X0HJAP317101JN0X49RYKMP6G9X0HJAP",
|
||||||
|
AccessCreateAt: TimeMustParse("2022-06-10T15:22:08Z"),
|
||||||
|
AccessExpiresAt: TimeMustParse("2050-01-01T15:22:08Z"),
|
||||||
|
},
|
||||||
"local_account_1_client_application_token": {
|
"local_account_1_client_application_token": {
|
||||||
ID: "01P9SVWS9J3SPHZQ3KCMBEN70N",
|
ID: "01P9SVWS9J3SPHZQ3KCMBEN70N",
|
||||||
ClientID: "01F8MGV8AC3NGSJW0FE8W1BV70",
|
ClientID: "01F8MGV8AC3NGSJW0FE8W1BV70",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue