48 lines
1.6 KiB
Python
48 lines
1.6 KiB
Python
# SPDX-FileCopyrightText: WTF Kooperative eG <https://wtf-eg.de/>
|
|
#
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
import unittest
|
|
|
|
from ki.test.ApiTest import ApiTest
|
|
|
|
|
|
class TestContactTypesEndpoint(ApiTest):
|
|
def test_skills_options(self):
|
|
print("test_skills_options")
|
|
#with app.app_context():
|
|
response = self.client.options("/contacttypes")
|
|
self.assertEqual(response.status_code, 200)
|
|
self.assertIn("Access-Control-Allow-Origin", response.headers)
|
|
self.assertEqual(response.headers["Access-Control-Allow-Origin"], "*")
|
|
|
|
# def test_get_contacttypes_unauthorised(self):
|
|
# print("test_get_contacttypes_unauthorised")
|
|
# response = self.client.get("/contacttypes?search=m")
|
|
# self.assertEqual(response.status_code, 401)
|
|
|
|
# def test_get_contacttypes(self):
|
|
# token = self.login("peter", "geheim")["token"]
|
|
|
|
# response = self.client.get("/contacttypes?search=m", headers={"Authorization": "Bearer " + token})
|
|
# self.assertEqual(response.status_code, 200)
|
|
# self.assertEqual(
|
|
# {
|
|
# "contacttypes": [{
|
|
# "id": 5,
|
|
# "name": "Mastodon"
|
|
# }, {
|
|
# "id": 4,
|
|
# "name": "Matrix"
|
|
# }, {
|
|
# "id": 2,
|
|
# "name": "Mobiltelefon"
|
|
# }]
|
|
# }, response.json)
|
|
# self.assertIn("Access-Control-Allow-Origin", response.headers)
|
|
# self.assertEqual(response.headers["Access-Control-Allow-Origin"], "*")
|
|
|
|
|
|
if __name__ == "main":
|
|
unittest.main()
|