openwisp/django-loci

[bug] Geocoding operations should not hit external services during tests but should be mocked

nemesifier opened this issue · 0 comments

Try to run the tests of django-loci while offline.

Result: some tests fail because they perform real geocoding operations.

We need to fix this, we should use mocking, I have used the responses library for similar simple HTTP request mocking operations successfully in the past and we could reuse it here if applicable.

The tests that have to be fixed are:

  • test_geocode
  • test_reverse_geocode

Once the response from the geocoding server is mocked, the real web service won't be called anymore during tests, therefore we expect to run tests while being offline with no failures.

This issue is affecting also openwisp-controller, because openwisp-controller imports the test suite from django-loci and executes it.