This commit is contained in:
hyperbel 2023-07-05 00:57:26 +02:00
commit f57f08eab0
6 changed files with 87 additions and 0 deletions

0
README.md Normal file
View File

38
endpoints.json Normal file
View File

@ -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"
}
]
}
]
]
}

4
party/__init__.py Normal file
View File

@ -0,0 +1,4 @@
from flask import Flask
app = Flask(__name__,
template_folder='templates')

14
pyproject.toml Normal file
View File

@ -0,0 +1,14 @@
[tool.poetry]
name = "party"
version = "0.1.0"
description = ""
authors = ["hyperbel <hyperbel@users.noreply.github.com>"]
readme = "README.md"
[tool.poetry.dependencies]
python = "^3.11"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

8
tests/__init__.py Normal file
View File

@ -0,0 +1,8 @@
import pytest
from party import app
@pytest.fixture
def client():
#app.config['TESTING'] = True
client = app.test_client()
yield client

23
tests/test_party.py Normal file
View File

@ -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