def test_station_index_for_climatologies(conn_params, test_session): app = PcdsStationIndex(app_root='/', templates=resource_filename('pdp_util', 'templates'), conn_params=conn_params, is_climo=True, network='MoTIe') assert app.get_elements(test_session) == [('34129', 'London Ridge High')] req = Request.blank('/pcds/climo/MoTIe/', {'sesh': test_session}) resp = req.get_response(app) make_common_assertions(resp) soup = BeautifulSoup(resp.body, features="html.parser") assert "Stations for network MoTIe" in soup.title.string assert "15124/" not in resp.body assert "Jackass" not in resp.body assert "34129/" in resp.body assert 'London Ridge High' in resp.body
def test_station_index_for_climatologies(conn_params, test_session): app = PcdsStationIndex(app_root='/', templates=resource_filename('pdp_util', 'templates'), conn_params=conn_params, is_climo=True, network='AGRI') assert app.get_elements() == [('de107climo', 'Deep "Climo Station" Creek')] req = Request.blank('/pcds/climo/AGRI/') resp = req.get_response(app) make_common_assertions(resp) soup = BeautifulSoup(resp.body) assert "Stations for network AGRI" in soup.title.string assert "de107/" not in resp.body assert "Deep Creek" not in resp.body assert "de107climo/" in resp.body assert 'Deep "Climo Station" Creek' in resp.body
def test_station_index(conn_params, test_session): app = PcdsStationIndex(app_root='/', templates=resource_filename('pdp_util', 'templates'), conn_params=conn_params, is_climo=False, network='AGRI') #FIXME: template path is fragile assert app.get_elements(test_session) == [('de107', 'Deep Creek')] req = Request.blank('/pcds/raw/AGRI/', {'sesh': test_session}) resp = req.get_response(app) make_common_assertions(resp) soup = BeautifulSoup(resp.body, features="html.parser") assert "Stations for network AGRI" in soup.title.string assert "de107/" in resp.body assert "Deep Creek" in resp.body assert "de107climo/" not in resp.body assert 'Deep "Climo Station" Creek' not in resp.body