Hello everyone, I would like to test my code that call the xero api server and to do that I want create mocked response to test different scenarios.
At the moment I want test just few endpoints, my Idea is to create a class as a container of the items needed to render.
The items are generated by a class that use a "stamp" of the returned json and add or modify the stamp using the given kwargs.
What you think about the example above? Maybe you have better idea?
e.g.
response = MockedXeroResponse()
invoice = fakeInvoice(**kwargs) # kwargs add fields
another_invoice = fakeInvoice(**{'Amount':1000})
response.add(invoice, another_invoice) #
response.json # return the json response as the XERO api with the two invoices.
Thank you
Karim N. Gorjux
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CACeuRGXGhbcAQhxB6aB06Ur92Dh%2BmQZQciQY2xGeCJsBe%2Bcnfw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment