quipucords / camayoc

Test automation framework that facilitates functional testing of quipucords.
https://camayoc.readthedocs.io/
GNU General Public License v3.0
5 stars 4 forks source link

Refactor csv report parsing (fixes #303) #304

Closed himmAllRight closed 5 years ago

himmAllRight commented 5 years ago

The header information of reports used to be hard-coded in, parsing the csv lines and binding them to specific variables. This caused the tests to break when a new field was added because there were more items parsed than variables to bind them to.

I've edited the csv parsing so that it is dynamically parsed into a dictionary that can then be used to create the report objects. I have added asserts so that if new fields are added, the tests will still fail to notify that it is out of date, but will just require at minimum adding the field to the expected list.

The process of normalizing the csv reports to what the json parsing returns has also been extracted to it's own set of the function, to clean up the actual tests a bit.

The one issue with this fix is that it still is hard coded to only process one source for the detail reports, but the tests only handled one source previously, and was hard coded to do so. This should at least be a step in the right direction for if we every expand that.

Fixes #303

codecov[bot] commented 5 years ago

Codecov Report

Merging #304 into master will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #304   +/-   ##
=======================================
  Coverage   76.23%   76.23%           
=======================================
  Files           5        5           
  Lines         202      202           
=======================================
  Hits          154      154           
  Misses         48       48

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update bd81c27...40820be. Read the comment docs.