openSUSE / orthos2

Orthos is a machine administration tool.
GNU General Public License v2.0
14 stars 13 forks source link

Tests: Fixup mock path #214

Closed SchoolGuy closed 1 year ago

SchoolGuy commented 1 year ago

This PR brings the first improvements to tests from #212.

This will fix up the import paths for the mocks. The error that before looked like this is now not occurring anymore.

======================================================================
ERROR: test_is_dns_resolvable (orthos2.utils.tests.test_misc.MiscMethodTests)
is_dns_resolvable() should return True if a FQDN is resolvable, False otherwise.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.10.12/x64/lib/python3.10/site-packages/mock/mock.py", line 1449, in patched
    with self.decoration_helper(patched,
  File "/opt/hostedtoolcache/Python/3.10.12/x64/lib/python3.10/contextlib.py", line 135, in __enter__
    return next(self.gen)
  File "/opt/hostedtoolcache/Python/3.10.12/x64/lib/python3.10/site-packages/mock/mock.py", line 1431, in decoration_helper
    arg = exit_stack.enter_context(patching)
  File "/opt/hostedtoolcache/Python/3.10.12/x64/lib/python3.10/contextlib.py", line 492, in enter_context
    result = _cm_type.__enter__(cm)
  File "/opt/hostedtoolcache/Python/3.10.12/x64/lib/python3.10/site-packages/mock/mock.py", line 1504, in __enter__
    self.target = self.getter()
  File "/opt/hostedtoolcache/Python/3.10.12/x64/lib/python3.10/site-packages/mock/mock.py", line 1691, in <lambda>
    getter = lambda: _importer(target)
  File "/opt/hostedtoolcache/Python/3.10.12/x64/lib/python3.10/site-packages/mock/mock.py", line 1330, in _importer
    thing = __import__(import_path)
ModuleNotFoundError: No module named 'utils'