Skip to content

Commit

Permalink
Update auth tests
Browse files Browse the repository at this point in the history
  • Loading branch information
NeonDaniel committed Jan 19, 2024
1 parent c1ccb6d commit 6293603
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions tests/test_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,17 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

import unittest
from time import time
from uuid import uuid4

from fastapi import HTTPException


class TestClientManager(unittest.TestCase):
from neon_hana.auth.client_manager import ClientManager
client_manager = ClientManager({"access_token_secret": "a800445648142061fc238d1f84e96200da87f4f9f784108ac90db8b4391b117b",
"refresh_token_secret": "a800445648142061fc238d1f84e96200da87f4f9f784108ac90db8b4391b117b"})
"refresh_token_secret": "a800445648142061fc238d1f84e96200da87f4f9f784108ac90db8b4391b117b",
"disable_auth": False})

def test_check_auth_request(self):
client_1 = str(uuid4())
Expand Down Expand Up @@ -70,6 +74,14 @@ def test_validate_auth(self):
"127.0.0.1"))
self.assertFalse(self.client_manager.validate_auth(invalid_client,
"127.0.0.1"))
self.client_manager.authorized_clients.pop(valid_client)
self.assertFalse(self.client_manager.validate_auth(auth_response,

expired_token = self.client_manager._create_tokens(
{"client_id": invalid_client, "username": "test",
"password": "test", "expire": time()})['access_token']
self.assertFalse(self.client_manager.validate_auth(expired_token,
"127.0.0.1"))
# TODO: Test rate limited response

def test_check_refresh_request(self):
# TODO
pass

0 comments on commit 6293603

Please sign in to comment.