YangCatalog / backend

YANG Catalog's REST API and internal module processing pipeline
https://yangcatalog.org
Apache License 2.0
2 stars 11 forks source link

tests: factor out and generelize json validation, clean up mocks #759

Closed richardzilincikPantheon closed 1 year ago

codecov[bot] commented 1 year ago

Codecov Report

Merging #759 (6e6da37) into develop (fa1ad49) will decrease coverage by 1.37%. The diff coverage is 96.44%.

:exclamation: Current head 6e6da37 differs from pull request most recent head bb05e74. Consider uploading reports for the commit bb05e74 to get more accurate results

@@             Coverage Diff             @@
##           develop     #759      +/-   ##
===========================================
- Coverage    77.72%   76.35%   -1.37%     
===========================================
  Files          107      109       +2     
  Lines        12169    11534     -635     
===========================================
- Hits          9458     8807     -651     
- Misses        2711     2727      +16     
Impacted Files Coverage Δ
api/views/json_checker.py 86.56% <86.56%> (ø)
tests/test_api_search.py 99.59% <96.15%> (-0.27%) :arrow_down:
api/views/user_specific_module_maintenance.py 90.15% <96.42%> (-1.91%) :arrow_down:
api/views/admin.py 96.92% <96.77%> (-0.22%) :arrow_down:
tests/test_json_checker.py 96.96% <96.96%> (ø)
tests/test_api_admin.py 99.38% <98.14%> (-0.42%) :arrow_down:
api/views/comparisons.py 65.47% <100.00%> (-1.06%) :arrow_down:
api/views/redis_search.py 69.68% <100.00%> (-0.08%) :arrow_down:
tests/test_api_contribute.py 99.01% <100.00%> (-0.49%) :arrow_down:
richardzilincikPantheon commented 1 year ago

what about Pydantic btw? Isn't it suitable for this case? That would also work, but our requirements are quite simple, writing equivalent checks in pydantic and similar tools would be more verbose, and I think json_checker.py is small enough that it shouldn't be a significant maintenance burden.

bskqd commented 1 year ago

That would also work, but our requirements are quite simple, writing equivalent checks in pydantic and similar tools would be more verbose, and I think json_checker.py is small enough that it shouldn't be a significant maintenance burden.

Okay, it may be enough for now, but if the functionality of json_checker.py starts growing then it'll be the right decision to switch to an already well-documented and well-tested tool like Pydantic

richardzilincikPantheon commented 1 year ago

Yep, I agree.