Ejemplo n.º 1
0
 def test_file_fetch_error(self):
     responses.add(responses.GET,
                   Config.METEO_FRANCE_LAST_NIVO_JS_URL,
                   status=302)
     with pytest.raises(AssertionError) as e:
         get_last_nivo_date()
     assert str(
         e.value
     ) == "Impossible to fetch last nivo data from meteofrance url"
Ejemplo n.º 2
0
 def test_wrong_date(self):
     """
     it should raise in case of wrongly formated date format.
     """
     responses.add(responses.GET,
                   Config.METEO_FRANCE_LAST_NIVO_JS_URL,
                   body="jour=20190;")
     with pytest.raises(ValueError) as e:
         get_last_nivo_date()
Ejemplo n.º 3
0
 def test_wrong_file(self):
     """
     it should raise if the regex doesn't match
     """
     responses.add(
         responses.GET,
         Config.METEO_FRANCE_LAST_NIVO_JS_URL,
         body="THIS WILL NOT MATCH",
     )
     with pytest.raises(AttributeError) as e:
         get_last_nivo_date()
     assert str(e.value) == "'NoneType' object has no attribute 'group'"
Ejemplo n.º 4
0
 def test_date_ok(self):
     responses.add(responses.GET,
                   Config.METEO_FRANCE_LAST_NIVO_JS_URL,
                   body="jour=20190101;")
     res = get_last_nivo_date()
     assert NivoDate(False, date(2019, 1, 1)) == res