From: Sarah Hoffmann Date: Tue, 27 Sep 2022 21:13:29 +0000 (+0200) Subject: add secondary importance to API BDD tests X-Git-Tag: v4.2.0~25^2~3 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/0a73ed7d6456c745fa710c0f8bc8b82d877c844e?ds=sidebyside add secondary importance to API BDD tests Also fixes a path issue during API test DB creation that could never possibly have worked. --- diff --git a/test/bdd/api/search/params.feature b/test/bdd/api/search/params.feature index 300948a9..af83bd33 100644 --- a/test/bdd/api/search/params.feature +++ b/test/bdd/api/search/params.feature @@ -68,14 +68,15 @@ Feature: Search queries | 0 | Then there are duplicates + @fail-legacy Scenario: Search with bounded viewbox in right area - When sending json search query "bar" with address + When sending json search query "post" with address | bounded | viewbox | | 1 | 9,47,10,48 | Then result addresses contain | ID | town | | 0 | Vaduz | - When sending json search query "bar" with address + When sending json search query "post" with address | bounded | viewbox | | 1 | 9.49712,47.17122,9.52605,47.16242 | Then result addresses contain @@ -118,18 +119,18 @@ Feature: Search queries Then result has centroid in 9.49712,47.16242,9.52605,47.17122 Scenario: Prefer results within viewbox - When sending json search query "Gässle" with address - | accept-language | - | en | - Then result addresses contain - | ID | town | - | 0 | Balzers | When sending json search query "Gässle" with address | accept-language | viewbox | | en | 9.52413,47.10759,9.53140,47.10539 | Then result addresses contain | ID | village | | 0 | Triesen | + When sending json search query "Gässle" with address + | accept-language | viewbox | + | en | 9.45949,47.08421,9.54094,47.05466 | + Then result addresses contain + | ID | town | + | 0 | Balzers | Scenario: viewboxes cannot be points When sending json search query "foo" diff --git a/test/bdd/steps/nominatim_environment.py b/test/bdd/steps/nominatim_environment.py index e7234788..1feafd75 100644 --- a/test/bdd/steps/nominatim_environment.py +++ b/test/bdd/steps/nominatim_environment.py @@ -201,19 +201,21 @@ class NominatimEnvironment: self.api_db_done = True if not self._reuse_or_drop_db(self.api_test_db): - testdata = Path('__file__') / '..' / '..' / 'testdb' - self.test_env['NOMINATIM_WIKIPEDIA_DATA_PATH'] = str(testdata.resolve()) + testdata = (Path(__file__) / '..' / '..' / '..' / 'testdb').resolve() + self.test_env['NOMINATIM_WIKIPEDIA_DATA_PATH'] = str(testdata) + simp_file = Path(self.website_dir.name) / 'secondary_importance.sql.gz' + simp_file.symlink_to(testdata / 'secondary_importance.sql.gz') try: self.run_nominatim('import', '--osm-file', str(self.api_test_file)) - self.run_nominatim('add-data', '--tiger-data', str((testdata / 'tiger').resolve())) + self.run_nominatim('add-data', '--tiger-data', str(testdata / 'tiger')) self.run_nominatim('freeze') if self.tokenizer == 'legacy': - phrase_file = str((testdata / 'specialphrases_testdb.sql').resolve()) + phrase_file = str(testdata / 'specialphrases_testdb.sql') run_script(['psql', '-d', self.api_test_db, '-f', phrase_file]) else: - csv_path = str((testdata / 'full_en_phrases_test.csv').resolve()) + csv_path = str(testdata / 'full_en_phrases_test.csv') self.run_nominatim('special-phrases', '--import-from-csv', csv_path) except: self.db_drop_database(self.api_test_db) diff --git a/test/testdb/secondary_importance.sql.gz b/test/testdb/secondary_importance.sql.gz new file mode 100644 index 00000000..e9c115d1 Binary files /dev/null and b/test/testdb/secondary_importance.sql.gz differ