Skip to content

Commit

Permalink
prvni test
Browse files Browse the repository at this point in the history
  • Loading branch information
kokes committed Dec 19, 2023
1 parent 47914ee commit 0e31dd6
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
4 changes: 4 additions & 0 deletions server/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# TODO: presun API z __main__
from server.__main__ import API

__all__ = [API]
2 changes: 1 addition & 1 deletion server/__main__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# TODO: docs, requirements, test endpoints (API.test_client?)
# TODO: docs, requirements
# TODO: expose bool arg
import argparse
import logging
Expand Down
Empty file added server/tests/__init__.py
Empty file.
15 changes: 15 additions & 0 deletions server/tests/test_status.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from server import API

import pytest


@pytest.fixture
def client(tmp_path):
db_path = tmp_path / "test.db"
yield API("test", f"sqlite:///{db_path}").test_client()


def test_status(client):
response = client.get("/status")
assert response.status_code == 200
assert response.data == b'{"status":"ok"}\n'

0 comments on commit 0e31dd6

Please sign in to comment.