mirror of https://gitlab.com/bashrc2/epicyon
More tests
parent
54bd5f802f
commit
1277c165fb
37
maps.py
37
maps.py
|
@ -486,8 +486,8 @@ def _hashtag_map_to_kml(base_dir: str, tag_name: str,
|
|||
except OSError:
|
||||
print('EX: unable to read tag map links ' + tag_map_filename)
|
||||
if map_links:
|
||||
start_secs_since_epoch = start_hours_since_epoch * 60 * 60
|
||||
end_secs_since_epoch = end_hours_since_epoch * 60 * 60
|
||||
start_secs_since_epoch = int(start_hours_since_epoch * 60 * 60)
|
||||
end_secs_since_epoch = int(end_hours_since_epoch * 60 * 60)
|
||||
for link_line in map_links:
|
||||
link_line = link_line.strip().split(' ')
|
||||
if len(link_line) < 3:
|
||||
|
@ -599,22 +599,23 @@ def html_hashtag_maps(base_dir: str, tag_name: str,
|
|||
_hashtag_map_kml_within_hours(base_dir, tag_name, hours)
|
||||
if not new_kml_str:
|
||||
continue
|
||||
if new_kml_str != kml_str:
|
||||
kml_str = new_kml_str
|
||||
period_str2 = period_str.replace('Last ', '').lower()
|
||||
endpoint_str = \
|
||||
'/tagmaps/' + tag_name + '-' + period_str2.replace(' ', '_')
|
||||
download_filename = \
|
||||
(tag_name + '-' +
|
||||
period_str.lower()).replace(' ', '_') + '.kml'
|
||||
if html_str:
|
||||
html_str += ' '
|
||||
description = period_str
|
||||
if translate.get(period_str):
|
||||
description = translate[period_str]
|
||||
html_str += '<a href="' + endpoint_str + \
|
||||
'" download="' + download_filename + '">' + \
|
||||
description + '</a>'
|
||||
if new_kml_str == kml_str:
|
||||
continue
|
||||
kml_str = new_kml_str
|
||||
period_str2 = period_str.replace('Last ', '').lower()
|
||||
endpoint_str = \
|
||||
'/tagmaps/' + tag_name + '-' + period_str2.replace(' ', '_')
|
||||
download_filename = \
|
||||
(tag_name + '-' +
|
||||
period_str.lower()).replace(' ', '_') + '.kml'
|
||||
if html_str:
|
||||
html_str += ' '
|
||||
description = period_str
|
||||
if translate.get(period_str):
|
||||
description = translate[period_str]
|
||||
html_str += '<a href="' + endpoint_str + \
|
||||
'" download="' + download_filename + '">' + \
|
||||
description + '</a>'
|
||||
if html_str:
|
||||
html_str = '<center>' + html_str + '</center>\n'
|
||||
return html_str
|
||||
|
|
9
tests.py
9
tests.py
|
@ -192,6 +192,7 @@ from happening import dav_month_via_server
|
|||
from happening import dav_day_via_server
|
||||
from webapp_theme_designer import color_contrast
|
||||
from maps import get_map_links_from_post_content
|
||||
from maps import geocoords_from_map_link
|
||||
|
||||
|
||||
TEST_SERVER_GROUP_RUNNING = False
|
||||
|
@ -7521,8 +7522,16 @@ def _test_hashtag_maps():
|
|||
map_links = get_map_links_from_post_content(content)
|
||||
link = "www.google.com/maps/@52.217291,-3.0811865,20.04z"
|
||||
assert link in map_links
|
||||
zoom, latitude, longitude = geocoords_from_map_link(link)
|
||||
assert zoom
|
||||
assert latitude
|
||||
assert longitude
|
||||
link = "www.openstreetmap.org/#map=19/52.90860/-3.59917"
|
||||
assert link in map_links
|
||||
zoom, latitude, longitude = geocoords_from_map_link(link)
|
||||
assert zoom
|
||||
assert latitude
|
||||
assert longitude
|
||||
assert len(map_links) == 2
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue