We have developed the APIs using the python eve
framework . Is there a way we can write the unit test cases for the APIs we have developed in EVE
. Is there a Unit Test case component bundled into Python EVE
.I need to bundle them with my Continuous Integration setup.
If yes please help me with the steps how to proceed with it.
Asked
Active
Viewed 903 times
4

tushar_sappal
- 308
- 4
- 16
-
possible duplicate of [Writing tests for Python Eve RESTful APIs against a real MongoDB](http://stackoverflow.com/questions/23748571/writing-tests-for-python-eve-restful-apis-against-a-real-mongodb) – Jamie Bull Jul 27 '15 at 14:07
-
I had a look on the wiki link . I think I have a bit of different problem to solve – tushar_sappal Jul 27 '15 at 16:42
1 Answers
4
You could start by looking at Eve's own test suite. There's 600+ examples in there. There are two base classes that provide a lot of utility methods: TestMinimal
and TestBase
. Almost all other test classes inherit from either of those. You probably want to use TestMinimal
as it takes care of setting up and dropping the MongoDB connection for you. It also provides stuff like assert200
, assert404
etc.
In general, you use the test_client
object, as you do with Flask itself. Have a look at Testing Flask Applications too and Eve's Running the Tests page.

Nicola Iarocci
- 6,606
- 1
- 20
- 33
-
-
What about a more live situation in which i want to test i using actual requests? Is there something out of the box for that? – FabioCosta Jan 28 '16 at 14:58
-
1