Closed pcuzner closed 6 years ago
It is weird.... i have seen that the code coverage was incremented to 50%: (although i think it should be more than 0%) see: https://codecov.io/gh/pcuzner/ansible-runner-service/commits
Most of the source code files are not affected,however all the tests are covered!! :-O
Investigating and doing changes
A suspicion.... I think that the problem is in the way in what testapi* test are being executed. The process created to answer the test request make that "coverage" tools do not be able to trace the code behind these requests. Flask provides a test client that probably doesn't have that problem... i will try to prepare a couple of tests using this approach to see if i'm right.
My suspicion is true, I have created an alternative set of tests (test2_*.py) but using the flask test client instead of the test server used in the class "APITestCase". I have implemented a "replica" of the tests in "test_api_login.py" using the flask test client, and now i can see that we are covering the right parts of the code.
I think that this way of implement the functional tests for the API is more easy and straight forward, so if you want i can "translate" all the current "api" tests to the new approach. using the flask test client, neither we need to copy the tests to other folder.
Other possibility is investigate why the "current test server" makes that coverage won't be able to get the data. (probably ... "coverage deems the test server as external service"
Take a look to this PR in my repo: https://github.com/jmolmo/ansible-runner-service/pull/2
And to the coverage results of the commit: https://codecov.io/gh/jmolmo/ansible-runner-service/commit/e1d749d5d5df8b6ce75e4111054c4c8b36a0e626/graphs/sunburst
and especifically over "controller/login.py" https://codecov.io/gh/jmolmo/ansible-runner-service/src/e1d749d5d5df8b6ce75e4111054c4c8b36a0e626/runner_service/controllers/login.py
Closing PR - will restructure existing tests to align with Juan'f approach
Codecov Report
Continue to review full report at Codecov.