File: test_session.py

package info (click to toggle)
meteofrance-api 1.5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 608 kB
  • sloc: python: 1,497; makefile: 8
file content (23 lines) | stat: -rw-r--r-- 593 bytes parent folder | download | duplicates (2)
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")