pacificclimate / pdp

The PCIC Data Portal - Server software to run the entire web application
GNU General Public License v3.0
1 stars 2 forks source link

Tests are failing for `hydro_stn` page #9

Closed jameshiebert closed 9 years ago

jameshiebert commented 9 years ago

All of the tests in test_functional.py for test_hydro_stn_data are failing with a 404 Not Found error. It looks like:

a) The hydrology theme moved the data that they are serving and b) The hydrology theme renamed all of the static CSV files that they are serving

hiebert@atlas:~/code/git/pdp$ $HOME/pdp-dev/bin/py.test -v tests -k test_hydro_stn
================================================================= test session starts =================================================================
platform linux2 -- Python 2.7.6 -- py-1.4.20 -- pytest-2.5.2 -- /home/hiebert/pdp-dev/bin/python
collected 48 items 

tests/test_functional.py:311: test_hydro_stn_data_catalog FAILED
tests/test_functional.py:321: test_hydro_stn_data_csv_csv FAILED
tests/test_functional.py:334: test_hydro_stn_data_csv_selection_projection FAILED

====================================================================== FAILURES =======================================================================
_____________________________________________________________ test_hydro_stn_data_catalog _____________________________________________________________

pcic_data_portal = <pdp.error.ErrorMiddleware object at 0x7feba741f610>

    def test_hydro_stn_data_catalog(pcic_data_portal):
        url = '/hydro_stn/data/catalog.json'
        req = Request.blank(url)
        resp = req.get_response(pcic_data_portal)
        assert resp.status == '200 OK'
        assert resp.content_type == 'application/json'
>       assert 'hydro_stn/data/fraser_SEYMO.csv' in resp.body
E       assert 'hydro_stn/data/fraser_SEYMO.csv' in '[\n    "http://atlas.pcic.uvic.ca/db_portal/hydro_stn/data/08KE009_Fraser.csv",\n    "http://atlas.pcic.uvic.ca/db_po...Fraser.csv",\n    "http://atlas.pcic.uvic.ca/db_portal/hydro_stn/data/backup_before_sed_replace/08KG003_Fraser.csv"\n]'
E        +  where '[\n    "http://atlas.pcic.uvic.ca/db_portal/hydro_stn/data/08KE009_Fraser.csv",\n    "http://atlas.pcic.uvic.ca/db_po...Fraser.csv",\n    "http://atlas.pcic.uvic.ca/db_portal/hydro_stn/data/backup_before_sed_replace/08KG003_Fraser.csv"\n]' = <Response at 0x7feba7bc1490 200 OK>.body

tests/test_functional.py:317: AssertionError
------------------------------------------------------------------- Captured stderr -------------------------------------------------------------------
DEBUG:ga_wsgi_client:AnalyticsMiddleware got called
DEBUG:ga_wsgi_client:Consumer-1: AnalyticsSubmitter('{'dl': 'http://localhost/hydro_stn/data/catalog.json', 'cid': '', 'pdt': 36, 't': 'pageview', 'tid': 'UA-20166041-3', 'dr': '', 'cm1': 20800, 'cd1': ''}', '2015-01-05 13:54:32.757152', 'None')
DEBUG:ga_wsgi_client:Submitting these analytics to Google: dl=http%3A%2F%2Flocalhost%2Fhydro_stn%2Fdata%2Fcatalog.json&qt=39&cid=&pdt=36&t=pageview&v=1&tid=UA-20166041-3&dr=&cm1=20800&cd1=
DEBUG:ga_wsgi_client:200 OK
_____________________________________________________________ test_hydro_stn_data_csv_csv _____________________________________________________________

pcic_data_portal = <pdp.error.ErrorMiddleware object at 0x7feba741f610>

    def test_hydro_stn_data_csv_csv(pcic_data_portal):
        url = '/hydro_stn/data/campbell_BCSCA.csv.csv'
        req = Request.blank(url)
        resp = req.get_response(pcic_data_portal)
>       assert resp.status == '200 OK'
E       assert '404 Not Found' == '200 OK'
E         - 404 Not Found
E         + 200 OK

tests/test_functional.py:325: AssertionError
------------------------------------------------------------------- Captured stderr -------------------------------------------------------------------
DEBUG:ga_wsgi_client:AnalyticsMiddleware got called
DEBUG:ga_wsgi_client:Consumer-1: AnalyticsSubmitter('{'dl': 'http://localhost/hydro_stn/data/campbell_BCSCA.csv.csv', 'cid': '', 'pdt': 29, 't': 'pageview', 'tid': 'UA-20166041-3', 'dr': '', 'cm1': 226, 'cd1': ''}', '2015-01-05 13:54:32.877684', 'None')
DEBUG:ga_wsgi_client:Submitting these analytics to Google: dl=http%3A%2F%2Flocalhost%2Fhydro_stn%2Fdata%2Fcampbell_BCSCA.csv.csv&qt=31&cid=&pdt=29&t=pageview&v=1&tid=UA-20166041-3&dr=&cm1=226&cd1=
____________________________________________________ test_hydro_stn_data_csv_selection_projection _____________________________________________________

pcic_data_portal = <pdp.error.ErrorMiddleware object at 0x7feba741f610>

    def test_hydro_stn_data_csv_selection_projection(pcic_data_portal):
        url = '/hydro_stn/data/campbell_BCSCA.csv.csv?sequence.ccsm3_A2run1&sequence.ccsm3_A2run1>100'
        req = Request.blank(url)
        resp = req.get_response(pcic_data_portal)
>       assert resp.status == '200 OK'
E       assert '404 Not Found' == '200 OK'
E         - 404 Not Found
E         + 200 OK

tests/test_functional.py:338: AssertionError
------------------------------------------------------------------- Captured stderr -------------------------------------------------------------------
DEBUG:ga_wsgi_client:AnalyticsMiddleware got called
====================================================== 45 tests deselected by '-ktest_hydro_stn' ======================================================
======================================================= 3 failed, 45 deselected in 1.93 seconds =======================================================
Removing session directory /tmp/tmpTjg4CF

In the short term we should update the tests to select a file that actually exists. In the long term we should include one sample data file in the package which all of the tests for this page use.

basilveerman commented 9 years ago

Fixed with 68716f7c3bbb3c2fec347b4f1f6053e4bea05eab