Skip to content

Commit

Permalink
chore(playstore): update test TestVoidedPurchases to fix 403 argument
Browse files Browse the repository at this point in the history
  • Loading branch information
kaijietti committed Nov 20, 2023
1 parent b897526 commit 2fe40e7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions playstore/validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"errors"
"reflect"
"testing"
"time"

"google.golang.org/api/androidpublisher/v3"
"google.golang.org/appengine/urlfetch"
Expand Down Expand Up @@ -195,11 +196,15 @@ func TestConsumeProduct(t *testing.T) {
func TestVoidedPurchases(t *testing.T) {
t.Parallel()
// Exception scenario
expected := "googleapi: Error 403: The current user has insufficient permissions to perform the requested operation., forbidden"
expected := "googleapi: Error 404: No application was found for the given package name., applicationNotFound"

client, _ := New(jsonKey)
ctx := context.Background()
_, err := client.VoidedPurchases(ctx, "package", 0, 0, 3, "token", 0, VoidedPurchaseTypeWithoutSubscription)

endTime := time.Now()
startTime := endTime.Add(-29 * 24 * time.Hour)

_, err := client.VoidedPurchases(ctx, "package", startTime.UnixMilli(), endTime.UnixMilli(), 3, "", 0, VoidedPurchaseTypeWithoutSubscription)

if err == nil || err.Error() != expected {
t.Errorf("got %v", err)
Expand Down

0 comments on commit 2fe40e7

Please sign in to comment.