fix tests

This commit is contained in:
tobi 2025-02-26 11:45:39 +01:00
commit 7bca8c4f19
6 changed files with 20 additions and 10 deletions

View file

@ -102,7 +102,7 @@ import (
// description: internal server error
func (m *Module) InstancePeersGETHandler(c *gin.Context) {
authed, errWithCode := apiutil.TokenAuth(c,
true, true, true, true,
false, false, false, false,
)
if errWithCode != nil {
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)

View file

@ -76,7 +76,7 @@ func (suite *PushTestSuite) TestDeleteSubscription() {
func (suite *PushTestSuite) TestDeleteMissingSubscription() {
accountFixtureName := "local_account_1"
// 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)
suite.NoError(err)

View file

@ -95,7 +95,7 @@ func (suite *PushTestSuite) TestGetSubscription() {
func (suite *PushTestSuite) TestGetMissingSubscription() {
accountFixtureName := "local_account_1"
// 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)
suite.NoError(err)

View file

@ -116,7 +116,7 @@ func (suite *PushTestSuite) postSubscription(
func (suite *PushTestSuite) TestPostSubscription() {
accountFixtureName := "local_account_1"
// 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"
auth := "cgna/fzrYLDQyPf5hD7IsA=="
@ -152,7 +152,7 @@ func (suite *PushTestSuite) TestPostSubscription() {
func (suite *PushTestSuite) TestPostSubscriptionMinimal() {
accountFixtureName := "local_account_1"
// 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"
auth := "cgna/fzrYLDQyPf5hD7IsA=="
@ -186,7 +186,7 @@ func (suite *PushTestSuite) TestPostSubscriptionMinimal() {
func (suite *PushTestSuite) TestPostInvalidSubscription() {
accountFixtureName := "local_account_1"
// This token should not have a subscription.
tokenFixtureName := "local_account_1_user_authorization_token"
tokenFixtureName := "local_account_1_push_only"
// No endpoint.
auth := "cgna/fzrYLDQyPf5hD7IsA=="
@ -212,7 +212,7 @@ func (suite *PushTestSuite) TestPostInvalidSubscription() {
func (suite *PushTestSuite) TestPostSubscriptionJSON() {
accountFixtureName := "local_account_1"
// This token should not have a subscription.
tokenFixtureName := "local_account_1_user_authorization_token"
tokenFixtureName := "local_account_1_push_only"
requestJson := `{
"subscription": {
@ -258,7 +258,7 @@ func (suite *PushTestSuite) TestPostSubscriptionJSON() {
func (suite *PushTestSuite) TestPostSubscriptionJSONMinimal() {
accountFixtureName := "local_account_1"
// This token should not have a subscription.
tokenFixtureName := "local_account_1_user_authorization_token"
tokenFixtureName := "local_account_1_push_only"
requestJson := `{
"subscription": {
@ -298,7 +298,7 @@ func (suite *PushTestSuite) TestPostSubscriptionJSONMinimal() {
func (suite *PushTestSuite) TestPostInvalidSubscriptionJSON() {
accountFixtureName := "local_account_1"
// This token should not have a subscription.
tokenFixtureName := "local_account_1_user_authorization_token"
tokenFixtureName := "local_account_1_push_only"
// No endpoint.
requestJson := `{

View file

@ -170,7 +170,7 @@ func (suite *PushTestSuite) TestPutSubscriptionJSON() {
func (suite *PushTestSuite) TestPutMissingSubscription() {
accountFixtureName := "local_account_1"
// This token should not have a subscription.
tokenFixtureName := "local_account_1_user_authorization_token"
tokenFixtureName := "local_account_1_push_only"
alertsMention := true
alertsStatus := false

View file

@ -56,6 +56,16 @@ func NewTestTokens() map[string]*gtsmodel.Token {
AccessCreateAt: TimeMustParse("2022-06-10T15: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": {
ID: "01P9SVWS9J3SPHZQ3KCMBEN70N",
ClientID: "01F8MGV8AC3NGSJW0FE8W1BV70",