diff options
author | Frederick Muriuki Muriithi | 2023-08-07 12:17:08 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2023-08-07 12:29:09 +0300 |
commit | 91061a7b4af2aaa7c7c97d0cd215a0dc28a42419 (patch) | |
tree | 59ae52f8ebebb86ec3917ad387d9b7d136480dcc | |
parent | af9ab012a3763e3046d8c42a8af8fd5c06e3df04 (diff) | |
download | gn-auth-91061a7b4af2aaa7c7c97d0cd215a0dc28a42419.tar.gz |
Fix tests
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | .guix/modules/guix-package.scm | 9 | ||||
-rw-r--r-- | pytest.ini | 8 | ||||
-rw-r--r-- | tests/unit/auth/test_token.py | 2 | ||||
-rw-r--r-- | tests/unit/conftest.py | 5 |
5 files changed, 20 insertions, 5 deletions
@@ -1,5 +1,6 @@ # python temp files and cache /**/__pycache__ +/**/.hypothesis # emacs temporary files /**/*~ diff --git a/.guix/modules/guix-package.scm b/.guix/modules/guix-package.scm index 80f29c6..5e59df8 100644 --- a/.guix/modules/guix-package.scm +++ b/.guix/modules/guix-package.scm @@ -16,6 +16,7 @@ #:use-module (gnu packages python-web) #:use-module (gnu packages python-xyz) + #:use-module (gnu packages python-check) #:use-module (gnu packages python-crypto) #:use-module (gnu packages databases) @@ -85,8 +86,12 @@ (build-system python-build-system) ;; (inputs (list)) (native-inputs - (list python-pytest - python-pylint)) + (list python-mypy + python-pytest + python-pylint + python-hypothesis + python-pytest-mock + python-mypy-extensions)) (propagated-inputs (list python-flask python-redis diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..3fc29c6 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,8 @@ +[pytest] +addopts = --strict-markers +markers = + slow + unit_test + integration_test + performance_test + under_dev
\ No newline at end of file diff --git a/tests/unit/auth/test_token.py b/tests/unit/auth/test_token.py index f66954f..971e4de 100644 --- a/tests/unit/auth/test_token.py +++ b/tests/unit/auth/test_token.py @@ -53,7 +53,7 @@ def test_token(fxtr_app, fxtr_oauth2_clients, test_data, expected): "username": email, "password": password} with fxtr_app.test_client() as client, db.cursor(conn) as cursor: - res = client.post("/api/oauth2/token", data=data) + res = client.post("/auth/token", data=data) # cleanup db cursor.execute("DELETE FROM oauth2_tokens WHERE access_token=?", (gen_token(None, None, None, None),)) diff --git a/tests/unit/conftest.py b/tests/unit/conftest.py index 4180528..2230f7a 100644 --- a/tests/unit/conftest.py +++ b/tests/unit/conftest.py @@ -5,7 +5,7 @@ from tempfile import TemporaryDirectory import pytest -from gn_auth.app import create_app +from gn_auth import create_app @pytest.fixture(scope="session") def fxtr_app(): @@ -16,7 +16,8 @@ def fxtr_app(): f'testdb_{datetime.now().strftime("%Y%m%dT%H%M%S")}') app = create_app({ "TESTING": True, "AUTH_DB": testdb, - "OAUTH2_ACCESS_TOKEN_GENERATOR": "tests.unit.auth.test_token.gen_token" + "OAUTH2_ACCESS_TOKEN_GENERATOR": "tests.unit.auth.test_token.gen_token", + "SECRET_KEY": "qQIrgiK29kXZU6v8D09y4uw_sk8I4cqgNZniYUrRoUk" }) app.testing = True yield app |