mirror of
https://github.com/dh1tw/pyhamtools.git
synced 2026-01-20 07:20:26 +01:00
Bugfix for badly escaped json data after reading from redis (#16)
Apostrophes and quotation marks where escaped after retrieving the JSON formatted data from redis.
This commit is contained in:
parent
bcb03b13b5
commit
01869462df
|
|
@ -1485,8 +1485,7 @@ class LookupLib(object):
|
|||
Deserialize a JSON into a dictionary
|
||||
"""
|
||||
|
||||
my_dict = json.loads(json_data.decode('utf8').replace("'", '"'),
|
||||
encoding='UTF-8')
|
||||
my_dict = json.loads(json_data.decode('utf8'), encoding='UTF-8')
|
||||
|
||||
for item in my_dict:
|
||||
if item == const.ADIF:
|
||||
|
|
|
|||
|
|
@ -22,6 +22,14 @@ response_Exception_VP8STI_with_start_and_stop_date = {
|
|||
'cqz': 13,
|
||||
}
|
||||
|
||||
response_TU5PCT = {
|
||||
'adif': 428,
|
||||
'country': u"COTE D'IVOIRE",
|
||||
'continent': u'AF',
|
||||
'latitude': 5.3,
|
||||
'longitude': -4.0,
|
||||
'cqz': 35,
|
||||
}
|
||||
|
||||
class TestStoreDataInRedis:
|
||||
|
||||
|
|
@ -32,6 +40,7 @@ class TestStoreDataInRedis:
|
|||
assert fix_redis.lookup_callsign("VK9XO") == fixClublogXML.lookup_callsign("VK9XO")
|
||||
assert fix_redis.lookup_prefix("DH") == fixClublogXML.lookup_prefix("DH")
|
||||
|
||||
|
||||
with pytest.raises(KeyError):
|
||||
fix_redis.is_invalid_operation("VK0MC")
|
||||
|
||||
|
|
@ -55,3 +64,4 @@ class TestStoreDataInRedis:
|
|||
timestamp = datetime(year=2016, month=1, day=20, tzinfo=UTC)
|
||||
ci = Callinfo(fix_redis)
|
||||
assert ci.get_all("VP8STI", timestamp) == response_Exception_VP8STI_with_start_and_stop_date
|
||||
assert ci.get_all("tu5pct") == response_TU5PCT
|
||||
|
|
|
|||
Loading…
Reference in a new issue