summaryrefslogtreecommitdiff
path: root/tests/conftest.py
diff options
context:
space:
mode:
authorTom Harley2021-07-07 15:41:42 +0000
committerTom Harley2021-07-07 15:41:42 +0000
commit6e58d1e712068de46f68a1188328d68273605f5b (patch)
tree9df3ed956ecc6fba0aac1b2f121188ef7b5b2811 /tests/conftest.py
parentBegin work on adding user interaction (diff)
downloadswap-6e58d1e712068de46f68a1188328d68273605f5b.tar.gz
swap-6e58d1e712068de46f68a1188328d68273605f5b.zip

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.

Diffstat (limited to 'tests/conftest.py')
-rw-r--r--tests/conftest.py6
1 files changed, 5 insertions, 1 deletions
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):