- #Used to check that correct place_classtype table already in the datase before is still there.
- query_existing_table = """
- SELECT table_name
- FROM information_schema.tables
- WHERE table_schema='public'
- AND table_name = 'place_classtype_amenity_animal_shelter';
- """
- queries_tests.add((query_existing_table, True))
-
- #Used to check that wrong place_classtype table was deleted from the database.
- query_wrong_table = """
- SELECT table_name
- FROM information_schema.tables
- WHERE table_schema='public'
- AND table_name = 'place_classtype_wrongclass_wrongtype';
- """
- queries_tests.add((query_wrong_table, False))
-
- with temp_db_conn.cursor() as temp_db_cursor:
- for query in queries_tests:
- temp_db_cursor.execute(query[0])
- if (query[1] == True):
- assert temp_db_cursor.fetchone()
- else:
- assert not temp_db_cursor.fetchone()
-
-def mock_get_wiki_content(self, lang):
- """
- Mock the _get_wiki_content() method to return
- static xml test file content.
- """
- return get_test_xml_wiki_content()
-
-def get_test_xml_wiki_content():
- """
- return the content of the static xml test file.
- """
- xml_test_content_path = (TEST_BASE_DIR / 'testdata' / 'special_phrases_test_content.txt').resolve()
- with open(xml_test_content_path) as xml_content_reader:
- return xml_content_reader.read()