django-getpaid / django-plans

Django application for managing account plans and quotas
MIT License
509 stars 127 forks source link

use test service for testing VIES to make testing more robust #172

Closed PetrDlouhy closed 2 years ago

PetrDlouhy commented 2 years ago

Tests failed sometimes when many of them ran at the same time, because VIES service is very unreliable. Hope would be fixed with usage of VIES testing service and VIES testing numbers.

codecov-commenter commented 2 years ago

Codecov Report

Merging #172 (2f14e64) into master (9189d35) will not change coverage. The diff coverage is n/a.

@@           Coverage Diff           @@
##           master     #172   +/-   ##
=======================================
  Coverage   85.24%   85.24%           
=======================================
  Files          48       48           
  Lines        2229     2229           
=======================================
  Hits         1900     1900           
  Misses        329      329           

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 9189d35...2f14e64. Read the comment docs.

Alir3z4 commented 2 years ago

@PetrDlouhy is it actually making http/web requests to some API? if that's the case, I believe best would be to have them all mocked as @nemesisdesign mentioned.

A simple network error could cripple the whole CI or any tests which is pretty common for CI environments.

PetrDlouhy commented 2 years ago

This patch doesn't introduce the HTTP requests, it only changes the API endpoint to test endpoint which should be much more stable.

I introduced the HTTP requests some time ago. The reason was, that django-plans had error in handling VAT IDs in which the country code was different than in django-countries. Namely for Greece the VAT ID should contain code EL, but the country code is GR. I wanted to demonstrate that it behaves correctly on real HTTP request to the VIES API. If I use mocked request, there is bigger chance, that even the mocked answer is wrong.

But if you still think, that mocking is better option, I will rewrite this to use mocking.

PetrDlouhy commented 2 years ago

I think this is superseeded by #174, I am closing this.