Skip to content

Commit

Permalink
🧪 API Test Runner
Browse files Browse the repository at this point in the history
  • Loading branch information
juftin committed Aug 22, 2023
1 parent ece2571 commit 47e856b
Show file tree
Hide file tree
Showing 14 changed files with 573 additions and 92 deletions.
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# zoo
<div style="text-align: center;">
<p style="margin-bottom: 0;" align="center">
<img src="https://i.imgur.com/EBsFZfD.png" width="400">
</p>
<p style="font-size: 36px; margin-top: 0;" align="center">
ZOO
</p>
</div>

An asynchronous zoo API, powered by [FastAPI](https://fastapi.tiangolo.com/),
[SQLAlchemy](https://www.sqlalchemy.org/), [Pydantic](https://docs.pydantic.dev/latest/),
[SQLAlchemy 2.0](https://www.sqlalchemy.org/), [Pydantic v2](https://docs.pydantic.dev/latest/),
and [Alembic](https://alembic.sqlalchemy.org/en/latest/).
13 changes: 11 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
# zoo
<div style="text-align: center;">
<p style="margin-bottom: 0;" align="center">
<img src="https://i.imgur.com/EBsFZfD.png" width="400">
</p>
<p style="font-size: 36px; margin-top: 0;" align="center">
ZOO
</p>
</div>

An asynchronous zoo API, powered by FastAPI, SQLModel, and Alembic.
An asynchronous zoo API, powered by [FastAPI](https://fastapi.tiangolo.com/),
[SQLAlchemy 2.0](https://www.sqlalchemy.org/), [Pydantic v2](https://docs.pydantic.dev/latest/),
and [Alembic](https://alembic.sqlalchemy.org/en/latest/).

## Table of Contents

Expand Down
283 changes: 222 additions & 61 deletions docs/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,7 @@
"content": {
"application/x-www-form-urlencoded": {
"schema": {
"$ref": "#/components/schemas/Body_auth-auth"
"$ref": "#/components/schemas/pydantic__main__Body_auth-auth__1"
}
}
},
Expand Down Expand Up @@ -916,6 +916,108 @@
"security": [
{
"OAuth2PasswordBearer": []
},
{
"APIKeyCookie": []
}
]
}
},
"/auth/cookie/login": {
"post": {
"tags": [
"auth"
],
"summary": "Auth:Cookie.Login",
"operationId": "auth-auth:cookie.login",
"requestBody": {
"content": {
"application/x-www-form-urlencoded": {
"schema": {
"$ref": "#/components/schemas/pydantic__main__Body_auth-auth__2"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
},
"400": {
"description": "Bad Request",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorModel"
},
"examples": {
"LOGIN_BAD_CREDENTIALS": {
"summary": "Bad credentials or the user is inactive.",
"value": {
"detail": "LOGIN_BAD_CREDENTIALS"
}
},
"LOGIN_USER_NOT_VERIFIED": {
"summary": "The user is not verified.",
"value": {
"detail": "LOGIN_USER_NOT_VERIFIED"
}
}
}
}
}
},
"204": {
"description": "No Content"
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/auth/cookie/logout": {
"post": {
"tags": [
"auth"
],
"summary": "Auth:Cookie.Logout",
"operationId": "auth-auth:cookie.logout",
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
},
"401": {
"description": "Missing token or inactive user."
},
"204": {
"description": "No Content"
}
},
"security": [
{
"OAuth2PasswordBearer": []
},
{
"APIKeyCookie": []
}
]
}
Expand Down Expand Up @@ -1224,63 +1326,6 @@
],
"title": "BearerResponse"
},
"Body_auth-auth": {
"properties": {
"grant_type": {
"anyOf": [
{
"type": "string",
"pattern": "password"
},
{
"type": "null"
}
],
"title": "Grant Type"
},
"username": {
"type": "string",
"title": "Username"
},
"password": {
"type": "string",
"title": "Password"
},
"scope": {
"type": "string",
"title": "Scope",
"default": ""
},
"client_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Client Id"
},
"client_secret": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Client Secret"
}
},
"type": "object",
"required": [
"username",
"password"
],
"title": "Body_auth-auth:jwt.login"
},
"ErrorModel": {
"properties": {
"detail": {
Expand Down Expand Up @@ -1813,9 +1858,6 @@
}
},
"type": "object",
"required": [
"name"
],
"title": "StaffUpdate",
"description": "\n Staff model: update\n ",
"examples": [
Expand Down Expand Up @@ -1964,6 +2006,120 @@
"type"
],
"title": "ValidationError"
},
"pydantic__main__Body_auth-auth__1": {
"properties": {
"grant_type": {
"anyOf": [
{
"type": "string",
"pattern": "password"
},
{
"type": "null"
}
],
"title": "Grant Type"
},
"username": {
"type": "string",
"title": "Username"
},
"password": {
"type": "string",
"title": "Password"
},
"scope": {
"type": "string",
"title": "Scope",
"default": ""
},
"client_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Client Id"
},
"client_secret": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Client Secret"
}
},
"type": "object",
"required": [
"username",
"password"
],
"title": "Body_auth-auth:jwt.login"
},
"pydantic__main__Body_auth-auth__2": {
"properties": {
"grant_type": {
"anyOf": [
{
"type": "string",
"pattern": "password"
},
{
"type": "null"
}
],
"title": "Grant Type"
},
"username": {
"type": "string",
"title": "Username"
},
"password": {
"type": "string",
"title": "Password"
},
"scope": {
"type": "string",
"title": "Scope",
"default": ""
},
"client_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Client Id"
},
"client_secret": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Client Secret"
}
},
"type": "object",
"required": [
"username",
"password"
],
"title": "Body_auth-auth:cookie.login"
}
},
"securitySchemes": {
Expand All @@ -1975,6 +2131,11 @@
"tokenUrl": "auth/jwt/login"
}
}
},
"APIKeyCookie": {
"type": "apiKey",
"in": "cookie",
"name": "zoo-auth"
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion migrations/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import asyncio
import logging
from logging.config import fileConfig
from os import getenv

from alembic import context
from sqlalchemy.ext.asyncio import create_async_engine
Expand All @@ -21,7 +22,7 @@
known_models = __all_models__
target_metadata = Base.metadata

if not app_config.DOCKER:
if not app_config.DOCKER and getenv("PYTEST_CURRENT_TEST", None) is None:
app_config.rich_logging(loggers=[logging.getLogger()])


Expand Down
Loading

0 comments on commit 47e856b

Please sign in to comment.