commit f57f08eab09dc5f7bde14c523606153e7b9eec6a Author: hyperbel Date: Wed Jul 5 00:57:26 2023 +0200 poetry diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/endpoints.json b/endpoints.json new file mode 100644 index 0000000..85754a0 --- /dev/null +++ b/endpoints.json @@ -0,0 +1,38 @@ +{ + "endpoints": [ + "/api": [ + { + "/mate": [ + { + "endpoint": "/", + "method":"GET" + }, + { + "endpoint": "/status", + "method":"GET" + }, + { + "endpoint": "/trinken", + "method":"POST" + } + ] + }, + { + "/chat": [ + { + "endpoint": "/", + "method":"GET" + }, + { + "endpoint": "/messages:count", + "method": "GET" + }, + { + "endpoint": "/new", + "method": "POST" + } + ] + } + ] + ] +} diff --git a/party/__init__.py b/party/__init__.py new file mode 100644 index 0000000..fc66062 --- /dev/null +++ b/party/__init__.py @@ -0,0 +1,4 @@ +from flask import Flask + +app = Flask(__name__, + template_folder='templates') diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..046bf33 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,14 @@ +[tool.poetry] +name = "party" +version = "0.1.0" +description = "" +authors = ["hyperbel "] +readme = "README.md" + +[tool.poetry.dependencies] +python = "^3.11" + + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..80d6ec7 --- /dev/null +++ b/tests/__init__.py @@ -0,0 +1,8 @@ +import pytest +from party import app + +@pytest.fixture +def client(): + #app.config['TESTING'] = True + client = app.test_client() + yield client diff --git a/tests/test_party.py b/tests/test_party.py new file mode 100644 index 0000000..ea99b78 --- /dev/null +++ b/tests/test_party.py @@ -0,0 +1,23 @@ +from test import client + +def test_api(client): + endpoints = [("/api", "GET"), + ("/api/mate", "GET"), + ("/api/mate/status", "GET"), + ("/api/mate/trinken", "POST"), + ("/api/chat/", "GET"), + ("/api/chat/messages/:count", "GET"), + ("/api/chat/new_message", "POST"), + ("/api/music", "GET"), + ("/api/music/skip", "POST"), + ("/api/music/queue", "GET"), + ("/api/music/add_song", "POST") + ] + response = client.get('/api') + + for endpoint in endpoints: + if endpoint[1] == "GET": + response = client.get(endpoint[0]) + elif endpoint[1] == "POST": + response = client.post(endpoint[0]) + assert response.status_code == 200