create mocks for playstore

This commit is contained in:
Sabrina
2020-01-28 13:31:57 -08:00
parent 3fcc899200
commit 8359bd764f
3 changed files with 161 additions and 0 deletions

View File

@@ -0,0 +1,158 @@
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/awa/go-iap/playstore (interfaces: IABProduct,IABSubscription)
// Package mocks is a generated GoMock package.
package mocks
import (
context "context"
gomock "github.com/golang/mock/gomock"
v3 "google.golang.org/api/androidpublisher/v3"
reflect "reflect"
)
// MockIABProduct is a mock of IABProduct interface
type MockIABProduct struct {
ctrl *gomock.Controller
recorder *MockIABProductMockRecorder
}
// MockIABProductMockRecorder is the mock recorder for MockIABProduct
type MockIABProductMockRecorder struct {
mock *MockIABProduct
}
// NewMockIABProduct creates a new mock instance
func NewMockIABProduct(ctrl *gomock.Controller) *MockIABProduct {
mock := &MockIABProduct{ctrl: ctrl}
mock.recorder = &MockIABProductMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use
func (m *MockIABProduct) EXPECT() *MockIABProductMockRecorder {
return m.recorder
}
// AcknowledgeProduct mocks base method
func (m *MockIABProduct) AcknowledgeProduct(arg0 context.Context, arg1, arg2, arg3, arg4 string) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "AcknowledgeProduct", arg0, arg1, arg2, arg3, arg4)
ret0, _ := ret[0].(error)
return ret0
}
// AcknowledgeProduct indicates an expected call of AcknowledgeProduct
func (mr *MockIABProductMockRecorder) AcknowledgeProduct(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AcknowledgeProduct", reflect.TypeOf((*MockIABProduct)(nil).AcknowledgeProduct), arg0, arg1, arg2, arg3, arg4)
}
// VerifyProduct mocks base method
func (m *MockIABProduct) VerifyProduct(arg0 context.Context, arg1, arg2, arg3 string) (*v3.ProductPurchase, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "VerifyProduct", arg0, arg1, arg2, arg3)
ret0, _ := ret[0].(*v3.ProductPurchase)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// VerifyProduct indicates an expected call of VerifyProduct
func (mr *MockIABProductMockRecorder) VerifyProduct(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VerifyProduct", reflect.TypeOf((*MockIABProduct)(nil).VerifyProduct), arg0, arg1, arg2, arg3)
}
// MockIABSubscription is a mock of IABSubscription interface
type MockIABSubscription struct {
ctrl *gomock.Controller
recorder *MockIABSubscriptionMockRecorder
}
// MockIABSubscriptionMockRecorder is the mock recorder for MockIABSubscription
type MockIABSubscriptionMockRecorder struct {
mock *MockIABSubscription
}
// NewMockIABSubscription creates a new mock instance
func NewMockIABSubscription(ctrl *gomock.Controller) *MockIABSubscription {
mock := &MockIABSubscription{ctrl: ctrl}
mock.recorder = &MockIABSubscriptionMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use
func (m *MockIABSubscription) EXPECT() *MockIABSubscriptionMockRecorder {
return m.recorder
}
// AcknowledgeSubscription mocks base method
func (m *MockIABSubscription) AcknowledgeSubscription(arg0 context.Context, arg1, arg2, arg3 string, arg4 *v3.SubscriptionPurchasesAcknowledgeRequest) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "AcknowledgeSubscription", arg0, arg1, arg2, arg3, arg4)
ret0, _ := ret[0].(error)
return ret0
}
// AcknowledgeSubscription indicates an expected call of AcknowledgeSubscription
func (mr *MockIABSubscriptionMockRecorder) AcknowledgeSubscription(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AcknowledgeSubscription", reflect.TypeOf((*MockIABSubscription)(nil).AcknowledgeSubscription), arg0, arg1, arg2, arg3, arg4)
}
// CancelSubscription mocks base method
func (m *MockIABSubscription) CancelSubscription(arg0 context.Context, arg1, arg2, arg3 string) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "CancelSubscription", arg0, arg1, arg2, arg3)
ret0, _ := ret[0].(error)
return ret0
}
// CancelSubscription indicates an expected call of CancelSubscription
func (mr *MockIABSubscriptionMockRecorder) CancelSubscription(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CancelSubscription", reflect.TypeOf((*MockIABSubscription)(nil).CancelSubscription), arg0, arg1, arg2, arg3)
}
// RefundSubscription mocks base method
func (m *MockIABSubscription) RefundSubscription(arg0 context.Context, arg1, arg2, arg3 string) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "RefundSubscription", arg0, arg1, arg2, arg3)
ret0, _ := ret[0].(error)
return ret0
}
// RefundSubscription indicates an expected call of RefundSubscription
func (mr *MockIABSubscriptionMockRecorder) RefundSubscription(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RefundSubscription", reflect.TypeOf((*MockIABSubscription)(nil).RefundSubscription), arg0, arg1, arg2, arg3)
}
// RevokeSubscription mocks base method
func (m *MockIABSubscription) RevokeSubscription(arg0 context.Context, arg1, arg2, arg3 string) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "RevokeSubscription", arg0, arg1, arg2, arg3)
ret0, _ := ret[0].(error)
return ret0
}
// RevokeSubscription indicates an expected call of RevokeSubscription
func (mr *MockIABSubscriptionMockRecorder) RevokeSubscription(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RevokeSubscription", reflect.TypeOf((*MockIABSubscription)(nil).RevokeSubscription), arg0, arg1, arg2, arg3)
}
// VerifySubscription mocks base method
func (m *MockIABSubscription) VerifySubscription(arg0 context.Context, arg1, arg2, arg3 string) (*v3.SubscriptionPurchase, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "VerifySubscription", arg0, arg1, arg2, arg3)
ret0, _ := ret[0].(*v3.SubscriptionPurchase)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// VerifySubscription indicates an expected call of VerifySubscription
func (mr *MockIABSubscriptionMockRecorder) VerifySubscription(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VerifySubscription", reflect.TypeOf((*MockIABSubscription)(nil).VerifySubscription), arg0, arg1, arg2, arg3)
}

View File

@@ -17,6 +17,8 @@ import (
androidpublisher "google.golang.org/api/androidpublisher/v3"
)
//go:generate mockgen -destination=mocks/mock_playstore.go -package=mocks github.com/awa/go-iap/playstore IABProduct,IABSubscription
// The IABProduct type is an interface for product service
type IABProduct interface {
VerifyProduct(context.Context, string, string, string) (*androidpublisher.ProductPurchase, error)