From 6e58d1e712068de46f68a1188328d68273605f5b Mon Sep 17 00:00:00 2001 From: Tom Harley Date: Wed, 7 Jul 2021 15:41:42 +0000 Subject: Add testing for authorisation decorators Test addition commits always look big lmao As mentioned in the previous commit, this commit adds a check for the correct user when accessing someone's /inbox. --- tests/conftest.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'tests/conftest.py') diff --git a/tests/conftest.py b/tests/conftest.py index fb8c751..c18f9de 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,7 +1,9 @@ import os import tempfile +import json import pytest + from sw import create_app from sw.db import get_db, init_db @@ -41,7 +43,9 @@ class AuthActions(object): def login(self, username="test", password="test"): return self._client.post( - "/auth/login", data=jsonify({"username": username, "password": password,}) + "/auth/login", + data=json.dumps({"username": username, "password": password,}), + headers={"content-type": "application/json"}, ) def logout(self): -- cgit v1.2.1