pyhamtools/test/test_eqsl.py
Tobias Wellnitz, DH1TW b1ef2a6d93 merging v0.8.0 branch
- finally using libxml2 parser in beautifulsoup/lxml
- minor bug in parsing the CCC field (qrz.com)
- fixed VK9XX fixture (lat/long)
- added support for python 3.10 and 3.11, pypy3.7-3.9
- removed support for python 3.4
- fixed escapings in regular expressions
- replaced exefile from past.buildins with custom function
2022-12-05 01:01:45 +01:00

34 lines
1.1 KiB
Python

from .execfile import execfile
import os
import sys
import datetime
import pytest
from pyhamtools.qsl import get_eqsl_users
if sys.version_info.major == 3:
unicode = str
test_dir = os.path.dirname(os.path.abspath(__file__))
fix_dir = os.path.join(test_dir, 'fixtures')
class Test_eqsl_methods:
def test_check_content_with_mocked_http_server(self, httpserver):
httpserver.serve_content(open(os.path.join(fix_dir, 'eqsl_data.html'), 'rb').read(), headers={'content-type': 'text/plain; charset=ISO-8859-1'})
namespace = {}
execfile(os.path.join(fix_dir,"eqsl_data.py"), namespace)
assert get_eqsl_users(url=httpserver.url) == namespace['eqsl_fixture']
def test_download_lotw_list_and_check_types(self):
data = get_eqsl_users()
assert isinstance(data, list)
for el in data:
assert isinstance(el, unicode)
assert len(data) > 1000
def test_with_invalid_url(self):
with pytest.raises(IOError):
get_eqsl_users(url="http://www.eqsl.cc/QSLCard/DownloadedFiles/AGMemberlist_my_unit_test.txt")