forked from kompetenzinventar/ki-backend
add skills integration test
This commit is contained in:
0
ki/test/__init__.py
Normal file
0
ki/test/__init__.py
Normal file
33
ki/test/test_skills_endpoint.py
Normal file
33
ki/test/test_skills_endpoint.py
Normal file
@ -0,0 +1,33 @@
|
||||
from alembic import command
|
||||
import unittest
|
||||
|
||||
from app import app, migrate
|
||||
from ki.commands import seed
|
||||
|
||||
|
||||
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()
|
||||
|
||||
def test_get_skills1(self):
|
||||
response = self.client.get("/skills?search=p")
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertEqual( \
|
||||
{"skills": [ \
|
||||
{"id": 1, "name": "PHP"}, \
|
||||
{"id": 3, "name": "Python"}
|
||||
]}, \
|
||||
response.json \
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "main":
|
||||
unittest.main()
|
Reference in New Issue
Block a user