Naftuli Kay
Naftuli Kay

Reputation: 91620

Unit test fixtures in Python?

I'm writing a library in Python which makes calls to a REST API, receives results in JSON, and returns Python class instances after transforming the results.

Is there a generally accepted way of including test fixtures (ie JSON files to test against) inside of the Python package and test namespace to load and test against in your test cases?

Upvotes: 6

Views: 1526

Answers (1)

m3lhIN400Forty4
m3lhIN400Forty4

Reputation: 37

You could try using the mock module. and mock the request.get like in this post Mock, UnitTest, JSON

Upvotes: 0

Related Questions