Skip to content

Commit

Permalink
Merge pull request #12 from shumatepf/main
Browse files Browse the repository at this point in the history
Add basic unit test
  • Loading branch information
shumatepf authored Jun 26, 2023
2 parents b58576f + f29fa39 commit 77bc2ff
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
2 changes: 2 additions & 0 deletions qualtrix/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

LOG_LEVEL = os.getenv("LOG_LEVEL", logging.getLevelName(logging.INFO))

API_TOKEN = None

try:
vcap_services = os.getenv("VCAP_SERVICES")
config = {}
Expand Down
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ black
pylint
bandit
pytest
httpx
Empty file added tests/__init__.py
Empty file.
22 changes: 22 additions & 0 deletions tests/test_api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import sys
import json
from unittest.mock import MagicMock

from fastapi import testclient

# pylint: disable=wrong-import-position
sys.modules["qualtrix.client"] = MagicMock()
from qualtrix import main

client = testclient.TestClient(main.app)


def test_session_delete() -> None:
"""test upload endpoint"""

response = client.post(
"/delete-session",
data=json.dumps({"surveyId": "1234", "sessionId": "5678"}),
)

assert response.status_code == 200

0 comments on commit 77bc2ff

Please sign in to comment.