From c053ec3b5648a534165a6504829cfe31b7b1d129 Mon Sep 17 00:00:00 2001 From: omri zaher Date: Sun, 3 Aug 2025 18:31:27 +0300 Subject: [PATCH] Add initial Python test setup and health check test --- .env.example | 0 .gitignore | 18 ++++++++++++++++++ package.json | 4 ++++ pytest.ini | 2 ++ requirements.txt | 2 ++ tests/__init__.py | 0 tests/auth/__init__.py | 0 tests/auth/test_login.py | 18 ++++++++++++++++++ 8 files changed, 44 insertions(+) create mode 100644 .env.example create mode 100644 pytest.ini create mode 100644 requirements.txt create mode 100644 tests/__init__.py create mode 100644 tests/auth/__init__.py create mode 100644 tests/auth/test_login.py diff --git a/.env.example b/.env.example new file mode 100644 index 000000000..e69de29bb diff --git a/.gitignore b/.gitignore index e159c4fe2..5461a64a5 100644 --- a/.gitignore +++ b/.gitignore @@ -39,3 +39,21 @@ ehthumbs.db # Chart dependencies /helm/wekan/**/*.tgz /helm/wekan/charts + + +# Python virtual environment +venv/ +.venv/ +__pycache__/ +*.pyc +*.pyo +*.pyd +.Python +env/ +pip-log.txt +pip-delete-this-directory.txt +.tox/ +.pytest_cache/ +*.egg-info/ +.coverage +htmlcov/ diff --git a/package.json b/package.json index 250b9671f..4447f2dae 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,10 @@ "url": "https://github.com/wekan/wekan/issues" }, "homepage": "https://wekan.github.io", + "scripts": { + "test:python": "python -m pytest tests/ -v -s", + "test:auth": "python -m pytest tests/auth/test_login.py -v" + }, "devDependencies": { "flatted": "^3.3.1", "sinon": "^13.0.2" diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 000000000..5ee647716 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,2 @@ +[pytest] +testpaths = tests diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 000000000..a8f7fc256 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +pytest==7.4.3 +requests==2.31.0 diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/auth/__init__.py b/tests/auth/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/auth/test_login.py b/tests/auth/test_login.py new file mode 100644 index 000000000..38c8caedf --- /dev/null +++ b/tests/auth/test_login.py @@ -0,0 +1,18 @@ +import pytest +import requests +import os + +BASE_URL = os.getenv('WEKAN_URL', 'http://localhost:3000') +TEST_USERNAME = 'testuser' +TEST_PASSWORD = 'testpass123' +TEST_EMAIL = 'test@example.com' + +base_url="http://10.0.0.17/" +class TestLogin: + + def test_health_check(self): + """Test basic health check""" + response = requests.get(f"{base_url}") + # assert response.status_code == 400 + print("**************",response.status_code) + assert response.status_code == 200