pyhamtools/test/test_lookuplib.py

41 lines
1.2 KiB
Python
Raw Normal View History

2014-04-24 14:01:53 +02:00
import pytest
from pyhamtools.lookuplib import LookupLib
from pyhamtools.exceptions import APIKeyMissingError
@pytest.fixture(scope="function", params=[5, -5, "", "foo bar", 11.5, {}, [], None, ("foo", "bar")])
def fixAnyValue(request):
return request.param
class TestlookupLib:
2014-04-24 14:01:53 +02:00
def test_construction_with_invalid_kwargs(self, fixAnyValue):
"""Load with non without any args & kwargs"""
with pytest.raises(AttributeError):
LookupLib(fixAnyValue)
class TestlookupLibHelper:
2018-01-27 19:52:27 +01:00
2014-04-24 14:01:53 +02:00
# def test_checkApiKeyValidity(self, fixClublogApi, fixApiKey):
#
# with pytest.raises(AttributeError):
# fixClublogApi._checkApiKeyValidity()
#
# with pytest.raises(ValueError):
# fixClublogApi._checkApiKeyValidity(apikey="")
#
# assert fixClublogApi._checkApiKeyValidity(apikey=fixApiKey) is True
2018-01-27 19:52:27 +01:00
2014-04-24 14:01:53 +02:00
def test_generateRandomWord(self, fixClublogApi, fixNonUnsignedInteger):
2018-01-27 19:52:27 +01:00
2014-04-24 14:01:53 +02:00
with pytest.raises(TypeError):
fixClublogApi._generate_random_word()
2023-12-28 21:02:41 +01:00
assert type(fixClublogApi._generate_random_word(5)) is str
2021-06-01 03:27:32 +02:00
assert len(fixClublogApi._generate_random_word(5)) == 5