Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating TestNominatim.py #929

Merged
merged 94 commits into from
Nov 1, 2023
Merged
Changes from 1 commit
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
ceaddc7
Creating TestNominatim.py
nataliejschultz Jul 21, 2023
dbce159
Multiple changes for nominatim testing
nataliejschultz Aug 10, 2023
067158c
Cleaning up the PR to try out nominatim test.
nataliejschultz Aug 11, 2023
b7e77fb
Top of workflow edits
nataliejschultz Aug 14, 2023
0aed377
TestNominiatm Changes
nataliejschultz Aug 15, 2023
01a3b4d
Update TestNominatim.py
nataliejschultz Aug 15, 2023
fd453e6
Testing GH workflow file
nataliejschultz Aug 15, 2023
ce51ed8
Python command not found test + compose updates
nataliejschultz Aug 17, 2023
7efa164
Environment variables + prints
nataliejschultz Aug 17, 2023
f8e9512
Environment variable setup, small testing changes, removing TestNomin…
nataliejschultz Aug 21, 2023
6b9d98d
URL testing
nataliejschultz Aug 22, 2023
2bb9e66
URL Testing pt 2
nataliejschultz Aug 22, 2023
3b76ac1
Removing lsof
nataliejschultz Aug 22, 2023
927a6f7
Network naming change
nataliejschultz Aug 22, 2023
1ada684
"Universal" network removal
nataliejschultz Aug 22, 2023
c9135ed
Multiple network changes
nataliejschultz Aug 22, 2023
ccc1c46
Reverting; new ideas.
nataliejschultz Aug 22, 2023
ed91603
Health check + env variable moved
nataliejschultz Aug 22, 2023
b072a89
Remove restart on failure
nataliejschultz Aug 22, 2023
6794eae
Sleep command added
nataliejschultz Aug 22, 2023
93420dc
More sleep
nataliejschultz Aug 22, 2023
9af4e2e
Adding mock to bypass place_id.
nataliejschultz Aug 24, 2023
b6bb7cb
Implementing Dockerize
nataliejschultz Aug 28, 2023
867287d
Adding timeout
nataliejschultz Aug 28, 2023
bdc70ae
More timeout
nataliejschultz Aug 28, 2023
86d51e4
Fake place creation + geofabrik testing functionality
nataliejschultz Sep 14, 2023
eba9d4d
Query URL woes
nataliejschultz Sep 14, 2023
18ba878
Syntax error
nataliejschultz Sep 14, 2023
53c3e1e
Env variable testing + changing test_get_json_geo
nataliejschultz Sep 15, 2023
7c3fcbd
Temp change
nataliejschultz Sep 15, 2023
cc09fee
trying to get workflow to go on my nominatim branch
nataliejschultz Sep 15, 2023
dbdd359
Trying to get workflow unstuck
nataliejschultz Sep 15, 2023
4b1608d
Fixing workflow
nataliejschultz Sep 18, 2023
9b2ad65
Testing workflow yet again
nataliejschultz Sep 18, 2023
9f4f819
Removing schedule temporarily
nataliejschultz Sep 18, 2023
0283672
Trying to get this workflow to run!!!
nataliejschultz Sep 18, 2023
dbe4fa4
Still not succeeding
nataliejschultz Sep 18, 2023
e89ae7e
Removing tail
nataliejschultz Sep 18, 2023
5cf4a0d
Test worked! Now onto the variables.
nataliejschultz Sep 18, 2023
2c7418e
Get method test
nataliejschultz Sep 18, 2023
2b0c1e6
Test string
nataliejschultz Sep 19, 2023
1ddc01b
Formatting change
nataliejschultz Sep 19, 2023
72e4b77
Reinstating get method
nataliejschultz Sep 19, 2023
60d2b6b
Moving envs
nataliejschultz Sep 19, 2023
8f2c032
Moving env vars around
nataliejschultz Sep 19, 2023
f29c601
Trying to pass in environment variable
nataliejschultz Sep 19, 2023
fc5d0f7
Oops
nataliejschultz Sep 19, 2023
ed51883
Moving things around (again)
nataliejschultz Sep 19, 2023
e61066b
Removing brackets
nataliejschultz Sep 19, 2023
8e0c222
Moving (again!!)
nataliejschultz Sep 19, 2023
db2ea77
Only setting env var once
nataliejschultz Sep 20, 2023
182132f
Commenting out env
nataliejschultz Sep 20, 2023
aa11c5a
Geofabrik formatted!
nataliejschultz Sep 20, 2023
b9d500e
Modifying test_geofabrik_and_nominatim
nataliejschultz Sep 20, 2023
baa6bee
Fixing test_get_json_geo
nataliejschultz Sep 20, 2023
7a1974f
Modifying test_nominatim_aapi
nataliejschultz Sep 21, 2023
e941b5f
Constraining both results
nataliejschultz Sep 21, 2023
8377b59
Using new container with preloaded data
nataliejschultz Sep 26, 2023
ebb77f5
New image
nataliejschultz Sep 26, 2023
90b7063
Testing new docker image
nataliejschultz Sep 27, 2023
5fbf161
Testing entrypoint
nataliejschultz Sep 27, 2023
4c9c915
Testing 4.0 version
nataliejschultz Sep 27, 2023
ec73542
More edits
nataliejschultz Sep 28, 2023
4d46b20
Removing ground truth
nataliejschultz Sep 28, 2023
d1bdecb
Fixing print; removing db port
nataliejschultz Sep 28, 2023
8cc7187
Removing webserver
nataliejschultz Sep 28, 2023
88b0030
Removing port 8080!
nataliejschultz Sep 28, 2023
8a6d339
Re-adding port 8080
nataliejschultz Sep 29, 2023
1e90c65
createfakeplace.py + removing dockerize + setup_integrationtests.sh
nataliejschultz Oct 3, 2023
5050a66
Another whitespace
nataliejschultz Oct 3, 2023
518fdb3
Removing db.conf
nataliejschultz Oct 3, 2023
09e240f
The big one!
nataliejschultz Oct 9, 2023
80519bb
Cleanup
nataliejschultz Oct 9, 2023
d31df8c
Cleanup (2)
nataliejschultz Oct 11, 2023
efb963c
Emission network only
nataliejschultz Oct 11, 2023
a55a9ad
Workflow test
nataliejschultz Oct 11, 2023
3ce7e5b
Reverting workflow (final push?!)
nataliejschultz Oct 11, 2023
b779c1f
Pull on paths
nataliejschultz Oct 18, 2023
1c7cb3c
Removing port 8080 (again)
nataliejschultz Oct 18, 2023
693407e
Merge branch 'nominatim' of https://github.com/nataliejschultz/e-miss…
nataliejschultz Oct 18, 2023
70ff4ab
Re-Adding port 8080 (again)
nataliejschultz Oct 18, 2023
fa508ad
Pulling repo secret
nataliejschultz Oct 19, 2023
a6be71a
Replacing secret
nataliejschultz Oct 19, 2023
451a428
Setting secret as env var in workflow file
nataliejschultz Oct 19, 2023
b027485
Switching to using docker_user until I figure this out.
nataliejschultz Oct 19, 2023
2000144
Secret issues
nataliejschultz Oct 24, 2023
e3b93eb
Adding quotes
nataliejschultz Oct 24, 2023
0b9e455
Updating readme + Making sure the test still works (running on fork)
nataliejschultz Oct 26, 2023
ce2db01
Getting test to run on my branch again
nataliejschultz Oct 26, 2023
3bf52de
Removing port 8080 (yet again!!)
nataliejschultz Oct 30, 2023
8c2efb0
Re-adding port + setup changes
nataliejschultz Oct 31, 2023
b7e0165
Re-instating schedule (test will fail but that is expected)
nataliejschultz Oct 31, 2023
f5c35a0
Testing removing port export but still specifying 8080 in container url
nataliejschultz Oct 31, 2023
baf087a
Re-instating schedule (for the last time?!)
nataliejschultz Nov 1, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions emission/individual_tests/TestNominatim.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
from builtins import *
from builtins import object
import urllib.request, urllib.parse, urllib.error, urllib.request, urllib.error, urllib.parse
import logging
import json
import emission.core.get_database as edb
import emission.core.common as cm
import unittest

from emission.core.wrapper.trip_old import Coordinate

import emission.net.ext_service.geocoder.nominatim as eco

class NominatimTest(unittest.TestCase):

def test_make_url_geo(self):
expected_result = "http://nominatim.openstreetmap.org/search?q=Golden%2C+Colorado&format=json"
shankari marked this conversation as resolved.
Show resolved Hide resolved
actual_result = eco.Geocoder.make_url_geo("Golden, Colorado")
self.assertEqual(expected_result, actual_result)

def test_get_json_geo(self):
expected_result = [{'place_id': 230592559, 'licence': 'Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright', 'osm_type': 'way', 'osm_id': 612835578, 'boundingbox': ['39.9041195', '39.914106', '-105.2365674', '-105.21353'], 'lat': '39.909856500000004', 'lon': '-105.22861864321705', 'display_name': 'NREL Flatiron Campus, Jefferson County, Colorado, United States', 'class': 'landuse', 'type': 'industrial', 'importance': 0.41000999999999993}, {'place_id': 165458796, 'licence': 'Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright', 'osm_type': 'way', 'osm_id': 241338672, 'boundingbox': ['39.7385155', '39.7391893', '-105.1743745', '-105.1721491'], 'lat': '39.738987699999996', 'lon': '-105.17326231002255', 'display_name': 'NREL Employee Parking Garage, Denver West Parkway, Pleasant View, West Pleasant View, Jefferson County, Colorado, 80419, United States', 'class': 'amenity', 'type': 'parking', 'importance': 0.21000999999999997}, {'place_id': 165006264, 'licence': 'Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright', 'osm_type': 'way', 'osm_id': 241338673, 'boundingbox': ['39.7385895', '39.7394212', '-105.1760441', '-105.1746968'], 'lat': '39.73896555', 'lon': '-105.17536976308806', 'display_name': 'NREL Parking Lot, Denver West Parkway, Pleasant View, West Pleasant View, Jefferson County, Colorado, 80419, United States', 'class': 'amenity', 'type': 'parking', 'importance': 0.21000999999999997}]
actual_result = eco.Geocoder.get_json_geo("NREL, Colorado")
self.assertEqual(expected_result, actual_result)

def test_geocode(self):
expected_result_lon = Coordinate(39.7546349, -105.220580).get_lon()
expected_result_lat = Coordinate(39.7546349, -105.220580).get_lat()
actual_result_lon = eco.Geocoder.geocode("Golden, Colorado").get_lon()
actual_result_lat = eco.Geocoder.geocode("Golden, Colorado").get_lat()
self.assertEqual(expected_result_lon, actual_result_lon)
self.assertEqual(expected_result_lat, actual_result_lat)


def test_make_url_reverse(self):
expected_result = "http://nominatim.openstreetmap.org/reverse?lat=39.7406821&lon=-105.168522&format=json"
actual_result = (eco.Geocoder.make_url_reverse(39.7406821, -105.1685220))
self.assertEqual(expected_result, actual_result)

def test_get_json_reverse(self):
expected_result = {'place_id': 151856645, 'licence': 'Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright', 'osm_type': 'way', 'osm_id': 193193531, 'lat': '39.74074185', 'lon': '-105.168658237606', 'display_name': 'Visitors Center, 15013, Denver West Parkway, Applewood, Jefferson County, Colorado, 80401, United States', 'address': {'building': 'Visitors Center', 'house_number': '15013', 'road': 'Denver West Parkway', 'village': 'Applewood', 'county': 'Jefferson County', 'state': 'Colorado', 'ISO3166-2-lvl4': 'US-CO', 'postcode': '80401', 'country': 'United States', 'country_code': 'us'}, 'boundingbox': ['39.7405892', '39.7409443', '-105.1687471', '-105.1683515']}
actual_result = eco.Geocoder.get_json_reverse(39.7406821, -105.1685220)
self.assertEqual(expected_result, actual_result)

def test_reverse_geocode(self):
expected_result = "Visitors Center, 15013, Denver West Parkway, Applewood, Jefferson County, Colorado, 80401, United States"
actual_result = eco.Geocoder.reverse_geocode(39.7406821, -105.1685220)
self.assertEqual(expected_result, actual_result)

if __name__ == '__main__':
unittest.main()
Loading