More tests

merge-requests/30/head
Bob Mottram 2022-08-22 21:44:14 +01:00
parent 54bd5f802f
commit 1277c165fb
2 changed files with 28 additions and 18 deletions

View File

@ -486,8 +486,8 @@ def _hashtag_map_to_kml(base_dir: str, tag_name: str,
except OSError: except OSError:
print('EX: unable to read tag map links ' + tag_map_filename) print('EX: unable to read tag map links ' + tag_map_filename)
if map_links: if map_links:
start_secs_since_epoch = start_hours_since_epoch * 60 * 60 start_secs_since_epoch = int(start_hours_since_epoch * 60 * 60)
end_secs_since_epoch = end_hours_since_epoch * 60 * 60 end_secs_since_epoch = int(end_hours_since_epoch * 60 * 60)
for link_line in map_links: for link_line in map_links:
link_line = link_line.strip().split(' ') link_line = link_line.strip().split(' ')
if len(link_line) < 3: if len(link_line) < 3:
@ -599,7 +599,8 @@ def html_hashtag_maps(base_dir: str, tag_name: str,
_hashtag_map_kml_within_hours(base_dir, tag_name, hours) _hashtag_map_kml_within_hours(base_dir, tag_name, hours)
if not new_kml_str: if not new_kml_str:
continue continue
if new_kml_str != kml_str: if new_kml_str == kml_str:
continue
kml_str = new_kml_str kml_str = new_kml_str
period_str2 = period_str.replace('Last ', '').lower() period_str2 = period_str.replace('Last ', '').lower()
endpoint_str = \ endpoint_str = \

View File

@ -192,6 +192,7 @@ from happening import dav_month_via_server
from happening import dav_day_via_server from happening import dav_day_via_server
from webapp_theme_designer import color_contrast from webapp_theme_designer import color_contrast
from maps import get_map_links_from_post_content from maps import get_map_links_from_post_content
from maps import geocoords_from_map_link
TEST_SERVER_GROUP_RUNNING = False TEST_SERVER_GROUP_RUNNING = False
@ -7521,8 +7522,16 @@ def _test_hashtag_maps():
map_links = get_map_links_from_post_content(content) map_links = get_map_links_from_post_content(content)
link = "www.google.com/maps/@52.217291,-3.0811865,20.04z" link = "www.google.com/maps/@52.217291,-3.0811865,20.04z"
assert link in map_links 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" link = "www.openstreetmap.org/#map=19/52.90860/-3.59917"
assert link in map_links assert link in map_links
zoom, latitude, longitude = geocoords_from_map_link(link)
assert zoom
assert latitude
assert longitude
assert len(map_links) == 2 assert len(map_links) == 2