Mock stripe calls for tests


(Gligor Gudjevski) #1

I am writing tests and I need to mock stripe calls and I can not mock it. Help!
Thanks :slight_smile:


(Lutz Horn) #2

What do you mean by ‘stripe calls’?


(Gligor Gudjevski) #3

when i want to get stripe customer, charge, invoice or smth


(Lutz Horn) #4

So you talk about https://stripe.com/, right?

Please help us helping you.

  • What do you want to mock: a REST API? Which?
  • Do you use any mocking library? Which? How do you use it?
  • Do you have written any code? Show us the relevant parts.
  • Do you get any errors? Which?
  • What result do you expect? What actual result do you get?

(Gligor Gudjevski) #5

yes about that stripe

i want to mock the hooks i get from stripe
i use github.com/stretchr/testify/mock

type mockClient struct {
	client.API
	mock.Mock
} 

and i override the methods i use

i am getting error that i cant use mockClient as client.API


(Mahmood Tehrani) #6

could you send your code and catched Error?