1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
"""Tests Météo-France module. MeteoFranceSession class."""
import pytest
from requests.exceptions import RequestException
from meteofrance_api.session import MeteoFranceSession
def test_session() -> None:
"""Test generic session."""
session = MeteoFranceSession()
resp = session.request("get", "places", params={"q": "Montréal"})
assert resp.status_code == 200
def test_session_wrong_token() -> None:
"""Test exceptions raised."""
session = MeteoFranceSession("fake_token")
with pytest.raises(RequestException):
session.request("get", "places")
|