2020-07-16 10:12:03 +00:00
|
|
|
# Copyright (C) 2020 by Christian Hagenest <c.hagenest@pm.me>
|
2020-07-07 01:16:23 +00:00
|
|
|
# Copyright (C) 2020 by Thomas Lindner <tom@dl6tom.de>
|
2020-09-28 22:39:32 +00:00
|
|
|
# Copyright (C) 2020 by Martin Rey <martin.rey@mailbox.org>
|
2020-07-07 01:16:23 +00:00
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: 0BSD
|
|
|
|
|
|
|
|
from fastapi import status
|
|
|
|
|
|
|
|
|
|
|
|
def test_hood_read_all(client):
|
|
|
|
response = client.get('/api/hoods/')
|
|
|
|
assert response.status_code == status.HTTP_200_OK
|
|
|
|
|
|
|
|
|
|
|
|
def test_hood_create_unauthorized(client, hood_id):
|
|
|
|
response = client.post('/api/hoods/')
|
|
|
|
assert response.status_code == status.HTTP_401_UNAUTHORIZED
|
|
|
|
|
|
|
|
|
2020-08-18 21:44:13 +00:00
|
|
|
def test_hood_read(client, hood_id):
|
2020-09-28 22:39:32 +00:00
|
|
|
response = client.get('/api/hoods/{0}'.format(hood_id))
|
2020-08-18 21:44:13 +00:00
|
|
|
assert response.status_code == status.HTTP_200_OK
|
2020-07-07 01:16:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_hood_update_unauthorized(client, hood_id):
|
2020-09-28 22:39:32 +00:00
|
|
|
response = client.put('/api/hoods/{0}'.format(hood_id))
|
2020-07-07 01:16:23 +00:00
|
|
|
assert response.status_code == status.HTTP_401_UNAUTHORIZED
|
|
|
|
|
|
|
|
|
|
|
|
def test_hood_delete_unauthorized(client, hood_id):
|
2020-09-28 22:39:32 +00:00
|
|
|
response = client.delete('/api/hoods/{0}'.format(hood_id))
|
2020-07-07 01:16:23 +00:00
|
|
|
assert response.status_code == status.HTTP_401_UNAUTHORIZED
|
|
|
|
|
|
|
|
|
|
|
|
def test_trigger_read_all_unauthorized(client, hood_id):
|
2020-09-28 22:39:32 +00:00
|
|
|
response = client.get('/api/hoods/{0}/triggers/'.format(hood_id))
|
2020-07-07 01:16:23 +00:00
|
|
|
assert response.status_code == status.HTTP_401_UNAUTHORIZED
|
|
|
|
|
|
|
|
|
|
|
|
def test_trigger_create_unauthorized(client, hood_id):
|
2020-09-28 22:39:32 +00:00
|
|
|
response = client.post('/api/hoods/{0}/triggers/'.format(hood_id))
|
2020-07-07 01:16:23 +00:00
|
|
|
assert response.status_code == status.HTTP_401_UNAUTHORIZED
|
|
|
|
|
|
|
|
|
|
|
|
def test_trigger_read_unauthorized(client, hood_id, trigger_id):
|
2020-09-28 22:39:32 +00:00
|
|
|
response = client.get('/api/hoods/{0}/triggers/{1}'.format(hood_id, trigger_id))
|
2020-07-07 01:16:23 +00:00
|
|
|
assert response.status_code == status.HTTP_401_UNAUTHORIZED
|
|
|
|
|
|
|
|
|
|
|
|
def test_trigger_update_unauthorized(client, hood_id, trigger_id):
|
2020-09-28 22:39:32 +00:00
|
|
|
response = client.put('/api/hoods/{0}/triggers/{1}'.format(hood_id, trigger_id))
|
2020-07-07 01:16:23 +00:00
|
|
|
assert response.status_code == status.HTTP_401_UNAUTHORIZED
|
|
|
|
|
|
|
|
|
|
|
|
def test_trigger_delete_unauthorized(client, hood_id, trigger_id):
|
2020-09-28 22:39:32 +00:00
|
|
|
response = client.delete('/api/hoods/{0}/triggers/{1}'.format(hood_id, trigger_id))
|
2020-07-07 01:16:23 +00:00
|
|
|
assert response.status_code == status.HTTP_401_UNAUTHORIZED
|
|
|
|
|
|
|
|
|
|
|
|
def test_badword_read_all_unauthorized(client, hood_id):
|
2020-09-28 22:39:32 +00:00
|
|
|
response = client.get('/api/hoods/{0}/badwords/'.format(hood_id))
|
2020-07-07 01:16:23 +00:00
|
|
|
assert response.status_code == status.HTTP_401_UNAUTHORIZED
|
|
|
|
|
|
|
|
|
|
|
|
def test_badword_create_unauthorized(client, hood_id):
|
2020-09-28 22:39:32 +00:00
|
|
|
response = client.post('/api/hoods/{0}/badwords/'.format(hood_id))
|
2020-07-07 01:16:23 +00:00
|
|
|
assert response.status_code == status.HTTP_401_UNAUTHORIZED
|
|
|
|
|
|
|
|
|
|
|
|
def test_badword_read_unauthorized(client, hood_id, badword_id):
|
2020-09-28 22:39:32 +00:00
|
|
|
response = client.get('/api/hoods/{0}/badwords/{1}'.format(hood_id, badword_id))
|
2020-07-07 01:16:23 +00:00
|
|
|
assert response.status_code == status.HTTP_401_UNAUTHORIZED
|
|
|
|
|
|
|
|
|
|
|
|
def test_badword_update_unauthorized(client, hood_id, badword_id):
|
2020-09-28 22:39:32 +00:00
|
|
|
response = client.put('/api/hoods/{0}/badwords/{1}'.format(hood_id, badword_id))
|
2020-07-07 01:16:23 +00:00
|
|
|
assert response.status_code == status.HTTP_401_UNAUTHORIZED
|
|
|
|
|
|
|
|
|
|
|
|
def test_badword_delete_unauthorized(client, hood_id, badword_id):
|
2020-09-28 22:39:32 +00:00
|
|
|
response = client.delete('/api/hoods/{0}/badwords/{1}'.format(hood_id, badword_id))
|
2020-07-07 01:16:23 +00:00
|
|
|
assert response.status_code == status.HTTP_401_UNAUTHORIZED
|