forked from kompetenzinventar/ki-backend
implement auth
This commit is contained in:
@ -1,26 +1,9 @@
|
||||
from alembic import command
|
||||
import unittest
|
||||
|
||||
from app import app, db, migrate
|
||||
from ki.actions import seed
|
||||
from ki.test.ApiTest import ApiTest
|
||||
|
||||
|
||||
class TestSkillsEndpoint(unittest.TestCase):
|
||||
def setUp(self):
|
||||
app.debug = True
|
||||
app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///:memory:"
|
||||
self.client = app.test_client()
|
||||
|
||||
with app.app_context():
|
||||
config = migrate.get_config()
|
||||
command.upgrade(config, "head")
|
||||
|
||||
seed(True)
|
||||
|
||||
def tearDown(self):
|
||||
db.drop_all()
|
||||
db.engine.dispose()
|
||||
|
||||
class TestSkillsEndpoint(ApiTest):
|
||||
def test_skills_options(self):
|
||||
response = self.client.options("/skills")
|
||||
self.assertEqual(response.status_code, 200)
|
||||
@ -28,7 +11,9 @@ class TestSkillsEndpoint(unittest.TestCase):
|
||||
self.assertEqual(response.headers["Access-Control-Allow-Origin"], "*")
|
||||
|
||||
def test_get_skills1(self):
|
||||
response = self.client.get("/skills?search=p")
|
||||
token = self.login("peter", "geheim")["token"]
|
||||
|
||||
response = self.client.get("/skills?search=p", headers={"Authorization": "Bearer " + token})
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertEqual(
|
||||
{
|
||||
|
Reference in New Issue
Block a user