mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-20 22:06:28 +00:00
.devcontainer
.devops
.github
.vscode
InvenTree
ci
check_api_endpoint.py
check_js_templates.py
check_locale_files.py
check_migration_files.py
version_check.py
contrib
deploy
docker
images
.eslintrc.yml
.gitattributes
.gitignore
.gitpod.yml
.pkgr.yml
.pre-commit-config.yaml
CONTRIBUTING.md
Dockerfile
LICENSE
Procfile
README.md
RELEASE.md
SECURITY.md
crowdin.yml
docker-compose.yml
docker.dev.env
package-lock.json
package.json
requirements-dev.in
requirements-dev.txt
requirements.in
requirements.txt
runtime.txt
setup.cfg
tasks.py
37 lines
666 B
Python
37 lines
666 B
Python
"""Test that the root API endpoint is available."""
|
|
|
|
import json
|
|
|
|
import requests
|
|
|
|
# We expect the server to be running on the local host
|
|
url = "http://localhost:8000/api/"
|
|
|
|
print("Testing InvenTree API endpoint")
|
|
|
|
response = requests.get(url)
|
|
|
|
assert response.status_code == 200
|
|
|
|
print("- Response 200 OK")
|
|
|
|
data = json.loads(response.text)
|
|
|
|
required_keys = [
|
|
'server',
|
|
'version',
|
|
'apiVersion',
|
|
'worker_running',
|
|
]
|
|
|
|
for key in required_keys:
|
|
assert key in data
|
|
print(f"- Found key '{key}'")
|
|
|
|
# Check that the worker is running
|
|
assert data['worker_running']
|
|
|
|
print("- Background worker is operational")
|
|
|
|
print("API Endpoint Tests Passed OK")
|