Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Test code

on: pull_request

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies and project
run: |
python -m pip install --upgrade pip
pip install -r dev-requirements.txt
pip install -e .
- name: Test with pytest
run: |
pip install pytest
pytest tests/
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ repos:
rev: v1.9.0
hooks:
- id: mypy
args: [--ignore-missing-imports]
7 changes: 4 additions & 3 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
mypy==0.982
pre-commit==3.6.2
ruff==0.3.3
mypy<1
pre-commit<4
pytest<9
ruff<1
Empty file.
11 changes: 11 additions & 0 deletions navitia_client/client/base_client.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from requests import Session # type: ignore

BASE_NAVITIA_URL: str = "https://api.navitia.io/v1/"


class HttpBaseClient:
def __init__(
self, auth_token: str, base_navitia_url: str = BASE_NAVITIA_URL
) -> None:
self.base_navitia_url = base_navitia_url
self.session = Session().headers.update({"Authorization": auth_token})
Empty file.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "airflow-providers-lokalise"
name = "navitia-client"
authors = [
{name = "Jonathan Perron", email = "jonathan@perron.bzh"},
]
Expand Down
Empty file added tests/__init__.py
Empty file.
Empty file added tests/client/__init.py
Empty file.
12 changes: 12 additions & 0 deletions tests/client/test_base_client.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from navitia_client.client.base_client import HttpBaseClient


def test_http_base_client() -> None:
# Given
auth_token = "foobar"

# When
client = HttpBaseClient(auth_token=auth_token)

# Then
assert isinstance(client, HttpBaseClient)