Added acknowledge method for subscription

This commit is contained in:
Junpei Tsuji
2019-05-31 10:47:02 +09:00
parent c6347f9585
commit c446edf3c4
4 changed files with 83 additions and 13 deletions

View File

@@ -8,6 +8,7 @@ import (
"testing"
"golang.org/x/oauth2"
androidpublisher "google.golang.org/api/androidpublisher/v3"
"google.golang.org/appengine/urlfetch"
)
@@ -70,6 +71,25 @@ func TestNewWithClient(t *testing.T) {
}
}
func TestAcknowledgeSubscription(t *testing.T) {
t.Parallel()
// Exception scenario
expected := "googleapi: Error 404: No application was found for the given package name., applicationNotFound"
client, _ := New(jsonKey)
ctx := context.Background()
req := &androidpublisher.SubscriptionPurchasesAcknowledgeRequest{
DeveloperPayload: "user001",
}
err := client.AcknowledgeSubscription(ctx, "package", "subscriptionID", "purchaseToken", req)
if err.Error() != expected {
t.Errorf("got %v\nwant %v", err, expected)
}
// TODO Normal scenario
}
func TestVerifySubscription(t *testing.T) {
t.Parallel()
// Exception scenario