def test_with_no_api_key(self): with pytest.raises(APIKeyMissingError): lib = LookupLib(lookuptype="clublogxml") lib.lookup_entity(230)
def test_with_file(self, fix_cty_xml_file): lib = LookupLib(lookuptype="clublogxml", filename=fix_cty_xml_file) assert lib.lookup_entity(230) == response_Entity_230
def test_constructor_with_file_instead_of_downlad(self, fix_plist_file): lib = LookupLib("countryfile", filename=fix_plist_file) assert lib.lookup_callsign("3D2RI") == response_Exception_3D2RI
def test_constructor_with_invalid_file(self): with pytest.raises(IOError): lib = LookupLib("countryfile", filename="foo bar") lib.lookup_callsign("GB0BVL")
def test_construction_with_invalid_kwargs(self, fixAnyValue): """Load with non without any args & kwargs""" with pytest.raises(AttributeError): LookupLib(fixAnyValue)
def test_get_session_key_with_empty_username_and_password(self): with pytest.raises(ValueError): lib = LookupLib(lookuptype="qrz", username="", pwd="")
def test_get_session_key_with_invalid_username(self): with pytest.raises(ValueError): lib = LookupLib(lookuptype="qrz", username="******", pwd=QRZ_PWD)
def test_get_session_key_with_invalid_password(self): with pytest.raises(ValueError): lib = LookupLib(lookuptype="qrz", username=QRZ_USERNAME, pwd="hello")
def test_get_session_key(self): lib = LookupLib(lookuptype="qrz", username=QRZ_USERNAME, pwd=QRZ_PWD) assert len(lib._apikey) == 32
def test_with_no_api_key(self): with pytest.raises(APIKeyMissingError): lib = LookupLib(lookuptype="clublogapi") lib.lookup_callsign("DH1TW")