From b8c097f1fd89335ea5162d8006542722b6f07dd9 Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Sat, 1 Feb 2025 23:17:00 +0000 Subject: [PATCH] Fix issues with signup and signin (#151) --- .github/workflows/unit_tests.yml | 2 +- src/surrealdb/connections/async_http.py | 62 ++++++++------ src/surrealdb/connections/async_template.py | 38 ++++----- src/surrealdb/connections/async_ws.py | 85 +++++++++---------- src/surrealdb/connections/blocking_http.py | 50 +++++++---- src/surrealdb/connections/blocking_ws.py | 75 +++++++++------- src/surrealdb/connections/sync_template.py | 38 ++++----- tests/__init__.py | 4 + tests/unit_tests/__init__.py | 4 + .../connections/signin/test_async_http.py | 16 ++-- .../connections/signin/test_async_ws.py | 15 ++-- .../connections/signin/test_blocking_http.py | 16 ++-- .../connections/signin/test_blocking_ws.py | 13 +-- .../connections/signup/test_async_http.py | 4 +- .../connections/signup/test_async_ws.py | 4 +- .../connections/signup/test_blocking_http.py | 4 +- .../connections/signup/test_blocking_ws.py | 4 +- 17 files changed, 243 insertions(+), 191 deletions(-) diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 4cc12314..cf0dfbaa 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -1,4 +1,4 @@ -name: unit-tests +name: Unit tests on: push: diff --git a/src/surrealdb/connections/async_http.py b/src/surrealdb/connections/async_http.py index 9047f9d4..5f6ca293 100644 --- a/src/surrealdb/connections/async_http.py +++ b/src/surrealdb/connections/async_http.py @@ -98,6 +98,30 @@ def set_token(self, token: str) -> None: """ self.token = token + async def authenticate(self) -> None: + message = RequestMessage( + self.id, + RequestMethod.AUTHENTICATE, + token=token + ) + return await self._send(message, "authenticating") + + async def invalidate(self) -> None: + message = RequestMessage(self.id, RequestMethod.INVALIDATE) + await self._send(message, "invalidating") + self.token = None + + async def signup(self, vars: Dict) -> str: + message = RequestMessage( + self.id, + RequestMethod.SIGN_UP, + data=vars + ) + response = await self._send(message, "signup") + self.check_response_for_result(response, "signup") + self.token = response["result"] + return response["result"] + async def signin(self, vars: dict) -> dict: message = RequestMessage( self.id, @@ -112,9 +136,16 @@ async def signin(self, vars: dict) -> dict: response = await self._send(message, "signing in") self.check_response_for_result(response, "signing in") self.token = response["result"] - package = dict() - package["token"] = self.token - return package + return response["result"] + + async def info(self) -> dict: + message = RequestMessage( + self.id, + RequestMethod.INFO + ) + response = await self._send(message, "getting database information") + self.check_response_for_result(response, "getting database information") + return response["result"] async def use(self, namespace: str, database: str) -> None: message = RequestMessage( @@ -187,15 +218,6 @@ async def delete( self.check_response_for_result(response, "delete") return response["result"] - async def info(self) -> dict: - message = RequestMessage( - self.id, - RequestMethod.INFO - ) - response = await self._send(message, "getting database information") - self.check_response_for_result(response, "getting database information") - return response["result"] - async def insert( self, table: Union[str, Table], data: Union[List[dict], dict] ) -> Union[List[dict], dict]: @@ -222,11 +244,6 @@ async def insert_relation( self.check_response_for_result(response, "insert_relation") return response["result"] - async def invalidate(self) -> None: - message = RequestMessage(self.id, RequestMethod.INVALIDATE) - await self._send(message, "invalidating") - self.token = None - async def let(self, key: str, value: Any) -> None: self.vars[key] = value @@ -306,17 +323,6 @@ async def upsert( self.check_response_for_result(response, "upsert") return response["result"] - async def signup(self, vars: Dict) -> str: - message = RequestMessage( - self.id, - RequestMethod.SIGN_UP, - data=vars - ) - response = await self._send(message, "signup") - self.check_response_for_result(response, "signup") - self.token = response["result"] - return response["result"] - async def __aenter__(self) -> "AsyncHttpSurrealConnection": """ Asynchronous context manager entry. diff --git a/src/surrealdb/connections/async_template.py b/src/surrealdb/connections/async_template.py index af5e7246..ec8ae0ee 100644 --- a/src/surrealdb/connections/async_template.py +++ b/src/surrealdb/connections/async_template.py @@ -40,6 +40,25 @@ async def use(self, namespace: str, database: str) -> None: """ raise NotImplementedError(f"query not implemented for: {self}") + async def authenticate(self, token: str) -> None: + """Authenticate the current connection with a JWT token. + + Args: + token: The JWT authentication token. + + Example: + await db.authenticate('insert token here') + """ + raise NotImplementedError(f"authenticate not implemented for: {self}") + + async def invalidate(self) -> None: + """Invalidate the authentication for the current connection. + + Example: + await db.invalidate() + """ + raise NotImplementedError(f"invalidate not implemented for: {self}") + async def signup(self, vars: Dict) -> str: """Sign this connection up to a specific authentication scope. [See the docs](https://surrealdb.com/docs/sdk/python/methods/signup) @@ -77,25 +96,6 @@ async def signin(self, vars: Dict) -> str: """ raise NotImplementedError(f"query not implemented for: {self}") - async def invalidate(self) -> None: - """Invalidate the authentication for the current connection. - - Example: - await db.invalidate() - """ - raise NotImplementedError(f"invalidate not implemented for: {self}") - - async def authenticate(self, token: str) -> None: - """Authenticate the current connection with a JWT token. - - Args: - token: The JWT authentication token. - - Example: - await db.authenticate('insert token here') - """ - raise NotImplementedError(f"authenticate not implemented for: {self}") - async def let(self, key: str, value: Any) -> None: """Assign a value as a variable for this connection. diff --git a/src/surrealdb/connections/async_ws.py b/src/surrealdb/connections/async_ws.py index ca1b84f1..16427b9d 100644 --- a/src/surrealdb/connections/async_ws.py +++ b/src/surrealdb/connections/async_ws.py @@ -80,7 +80,28 @@ async def connect(self, url: Optional[str] = None, max_size: Optional[int] = Non subprotocols=[websockets.Subprotocol("cbor")] ) - # async def signup(self, vars: Dict[str, Any]) -> str: + async def authenticate(self, token: str) -> dict: + message = RequestMessage( + self.id, + RequestMethod.AUTHENTICATE, + token=token + ) + return await self._send(message, "authenticating") + + async def invalidate(self) -> None: + message = RequestMessage(self.id, RequestMethod.INVALIDATE) + await self._send(message, "invalidating") + self.token = None + + async def signup(self, vars: Dict) -> str: + message = RequestMessage( + self.id, + RequestMethod.SIGN_UP, + data=vars + ) + response = await self._send(message, "signup") + self.check_response_for_result(response, "signup") + return response["result"] async def signin(self, vars: Dict[str, Any]) -> str: message = RequestMessage( @@ -96,9 +117,25 @@ async def signin(self, vars: Dict[str, Any]) -> str: response = await self._send(message, "signing in") self.check_response_for_result(response, "signing in") self.token = response["result"] - if response.get("id") is None: - raise Exception(f"no id signing in: {response}") - self.id = response["id"] + return response["result"] + + async def info(self) -> Optional[dict]: + message = RequestMessage( + self.id, + RequestMethod.INFO + ) + outcome = await self._send(message, "getting database information") + self.check_response_for_result(outcome, "getting database information") + return outcome["result"] + + async def use(self, namespace: str, database: str) -> None: + message = RequestMessage( + self.id, + RequestMethod.USE, + namespace=namespace, + database=database, + ) + await self._send(message, "use") async def query(self, query: str, params: Optional[dict] = None) -> dict: if params is None: @@ -125,24 +162,6 @@ async def query_raw(self, query: str, params: Optional[dict] = None) -> dict: response = await self._send(message, "query", bypass=True) return response - async def use(self, namespace: str, database: str) -> None: - message = RequestMessage( - self.id, - RequestMethod.USE, - namespace=namespace, - database=database, - ) - await self._send(message, "use") - - async def info(self) -> Optional[dict]: - message = RequestMessage( - self.id, - RequestMethod.INFO - ) - outcome = await self._send(message, "getting database information") - self.check_response_for_result(outcome, "getting database information") - return outcome["result"] - async def version(self) -> str: message = RequestMessage( self.id, @@ -152,18 +171,6 @@ async def version(self) -> str: self.check_response_for_result(response, "getting database version") return response["result"] - async def authenticate(self, token: str) -> dict: - message = RequestMessage( - self.id, - RequestMethod.AUTHENTICATE, - token=token - ) - return await self._send(message, "authenticating") - - async def invalidate(self) -> None: - message = RequestMessage(self.id, RequestMethod.INVALIDATE) - await self._send(message, "invalidating") - async def let(self, key: str, value: Any) -> None: message = RequestMessage( self.id, @@ -331,16 +338,6 @@ async def kill(self, query_uuid: Union[str, UUID]) -> None: ) await self._send(message, "kill") - async def signup(self, vars: Dict) -> str: - message = RequestMessage( - self.id, - RequestMethod.SIGN_UP, - data=vars - ) - response = await self._send(message, "signup") - self.check_response_for_result(response, "signup") - return response["result"] - async def upsert( self, thing: Union[str, RecordID, Table], data: Optional[Dict] = None ) -> Union[List[dict], dict]: diff --git a/src/surrealdb/connections/blocking_http.py b/src/surrealdb/connections/blocking_http.py index 89ebd6cd..e0872246 100644 --- a/src/surrealdb/connections/blocking_http.py +++ b/src/surrealdb/connections/blocking_http.py @@ -51,6 +51,29 @@ def _send(self, message: RequestMessage, operation: str, bypass: bool = False) - def set_token(self, token: str) -> None: self.token = token + def authenticate(self, token: str) -> dict: + message = RequestMessage( + self.id, + RequestMethod.AUTHENTICATE, + token=token + ) + return self._send(message, "authenticating") + + def invalidate(self) -> None: + message = RequestMessage(self.id, RequestMethod.INVALIDATE) + self._send(message, "invalidating") + self.token = None + + def signup(self, vars: Dict) -> str: + message = RequestMessage( + self.id, + RequestMethod.SIGN_UP, + data=vars + ) + response = self._send(message, "signup") + self.check_response_for_result(response, "signup") + return response["result"] + def signin(self, vars: dict) -> dict: message = RequestMessage( self.id, @@ -65,9 +88,16 @@ def signin(self, vars: dict) -> dict: response = self._send(message, "signing in") self.check_response_for_result(response, "signing in") self.token = response["result"] - package = dict() - package["token"] = self.token - return package + return response["result"] + + def info(self): + message = RequestMessage( + self.id, + RequestMethod.INFO + ) + response = self._send(message, "getting database information") + self.check_response_for_result(response, "getting database information") + return response["result"] def use(self, namespace: str, database: str) -> None: message = RequestMessage( @@ -140,15 +170,6 @@ def delete( self.check_response_for_result(response, "delete") return response["result"] - def info(self): - message = RequestMessage( - self.id, - RequestMethod.INFO - ) - response = self._send(message, "getting database information") - self.check_response_for_result(response, "getting database information") - return response["result"] - def insert( self, table: Union[str, Table], data: Union[List[dict], dict] ) -> Union[List[dict], dict]: @@ -175,11 +196,6 @@ def insert_relation( self.check_response_for_result(response, "insert_relation") return response["result"] - def invalidate(self) -> None: - message = RequestMessage(self.id, RequestMethod.INVALIDATE) - self._send(message, "invalidating") - self.token = None - def let(self, key: str, value: Any) -> None: self.vars[key] = value diff --git a/src/surrealdb/connections/blocking_ws.py b/src/surrealdb/connections/blocking_ws.py index fc15580b..f9a1d824 100644 --- a/src/surrealdb/connections/blocking_ws.py +++ b/src/surrealdb/connections/blocking_ws.py @@ -65,6 +65,29 @@ def _send(self, message: RequestMessage, process: str, bypass: bool = False) -> self.check_response_for_error(response, process) return response + def authenticate(self, token: str) -> dict: + message = RequestMessage( + self.id, + RequestMethod.AUTHENTICATE, + token=token + ) + return self._send(message, "authenticating") + + def invalidate(self) -> None: + message = RequestMessage(self.id, RequestMethod.INVALIDATE) + self._send(message, "invalidating") + self.token = None + + def signup(self, vars: Dict) -> str: + message = RequestMessage( + self.id, + RequestMethod.SIGN_UP, + data=vars + ) + response = self._send(message, "signup") + self.check_response_for_result(response, "signup") + return response["result"] + def signin(self, vars: Dict[str, Any]) -> str: message = RequestMessage( self.id, @@ -79,9 +102,25 @@ def signin(self, vars: Dict[str, Any]) -> str: response = self._send(message, "signing in") self.check_response_for_result(response, "signing in") self.token = response["result"] - if response.get("id") is None: - raise Exception(f"No ID signing in: {response}") - self.id = response["id"] + return response["result"] + + def info(self) -> dict: + message = RequestMessage( + self.id, + RequestMethod.INFO + ) + response = self._send(message, "getting database information") + self.check_response_for_result(response, "getting database information") + return response["result"] + + def use(self, namespace: str, database: str) -> None: + message = RequestMessage( + self.id, + RequestMethod.USE, + namespace=namespace, + database=database, + ) + self._send(message, "use") def query(self, query: str, params: Optional[dict] = None) -> dict: if params is None: @@ -108,24 +147,6 @@ def query_raw(self, query: str, params: Optional[dict] = None) -> dict: response = self._send(message, "query", bypass=True) return response - def use(self, namespace: str, database: str) -> None: - message = RequestMessage( - self.id, - RequestMethod.USE, - namespace=namespace, - database=database, - ) - self._send(message, "use") - - def info(self) -> dict: - message = RequestMessage( - self.id, - RequestMethod.INFO - ) - response = self._send(message, "getting database information") - self.check_response_for_result(response, "getting database information") - return response["result"] - def version(self) -> str: message = RequestMessage( self.id, @@ -135,18 +156,6 @@ def version(self) -> str: self.check_response_for_result(response, "getting database version") return response["result"] - def authenticate(self, token: str) -> dict: - message = RequestMessage( - self.id, - RequestMethod.AUTHENTICATE, - token=token - ) - return self._send(message, "authenticating") - - def invalidate(self) -> None: - message = RequestMessage(self.id, RequestMethod.INVALIDATE) - self._send(message, "invalidating") - def let(self, key: str, value: Any) -> None: message = RequestMessage( self.id, diff --git a/src/surrealdb/connections/sync_template.py b/src/surrealdb/connections/sync_template.py index 0decebb5..10db2b96 100644 --- a/src/surrealdb/connections/sync_template.py +++ b/src/surrealdb/connections/sync_template.py @@ -46,6 +46,25 @@ def use(self, namespace: str, database: str) -> None: """ raise NotImplementedError(f"use not implemented for: {self}") + def authenticate(self, token: str) -> None: + """Authenticate the current connection with a JWT token. + + Args: + token: The JWT authentication token. + + Example: + db.authenticate('insert token here') + """ + raise NotImplementedError(f"authenticate not implemented for: {self}") + + def invalidate(self) -> None: + """Invalidate the authentication for the current connection. + + Example: + db.invalidate() + """ + raise NotImplementedError(f"invalidate not implemented for: {self}") + def signup(self, vars: Dict) -> str: """Sign this connection up to a specific authentication scope. [See the docs](https://surrealdb.com/docs/sdk/python/methods/signup) @@ -83,25 +102,6 @@ def signin(self, vars: Dict) -> str: """ raise NotImplementedError(f"signin not implemented for: {self}") - def invalidate(self) -> None: - """Invalidate the authentication for the current connection. - - Example: - db.invalidate() - """ - raise NotImplementedError(f"invalidate not implemented for: {self}") - - def authenticate(self, token: str) -> None: - """Authenticate the current connection with a JWT token. - - Args: - token: The JWT authentication token. - - Example: - db.authenticate('insert token here') - """ - raise NotImplementedError(f"authenticate not implemented for: {self}") - def let(self, key: str, value: Any) -> None: """Assign a value as a variable for this connection. diff --git a/tests/__init__.py b/tests/__init__.py index e69de29b..e92300d4 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -0,0 +1,4 @@ +# import sys +# import os + +# sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../src"))) \ No newline at end of file diff --git a/tests/unit_tests/__init__.py b/tests/unit_tests/__init__.py index e69de29b..8cb03c75 100644 --- a/tests/unit_tests/__init__.py +++ b/tests/unit_tests/__init__.py @@ -0,0 +1,4 @@ +# import sys +# import os + +# sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../../src"))) \ No newline at end of file diff --git a/tests/unit_tests/connections/signin/test_async_http.py b/tests/unit_tests/connections/signin/test_async_http.py index fb8c015c..c3741c2b 100644 --- a/tests/unit_tests/connections/signin/test_async_http.py +++ b/tests/unit_tests/connections/signin/test_async_http.py @@ -43,8 +43,10 @@ async def asyncSetUp(self): async def test_signin_root(self): connection = AsyncHttpSurrealConnection(self.url) - outcome = await connection.signin(self.vars_params) - self.assertIn("token", outcome) # Check that the response contains a token + response = await connection.signin(self.vars_params) + self.assertIsNotNone(response) + _ = await self.connection.query("DELETE user;") + _ = await self.connection.query("REMOVE TABLE user;") async def test_signin_namespace(self): connection = AsyncHttpSurrealConnection(self.url) @@ -53,7 +55,8 @@ async def test_signin_namespace(self): "username": "test", "password": "test", } - _ = await connection.signin(vars) + response = await connection.signin(vars) + self.assertIsNotNone(response) _ = await self.connection.query("DELETE user;") _ = await self.connection.query("REMOVE TABLE user;") @@ -65,7 +68,8 @@ async def test_signin_database(self): "username": "test", "password": "test", } - _ = await connection.signin(vars) + response = await connection.signin(vars) + self.assertIsNotNone(response) _ = await self.connection.query("DELETE user;") _ = await self.connection.query("REMOVE TABLE user;") @@ -80,8 +84,8 @@ async def test_signin_record(self): } } connection = AsyncHttpSurrealConnection(self.url) - # for below if client is HTTP then persist and attach to all headers - _ = await connection.signin(vars) + response = await connection.signin(vars) + self.assertIsNotNone(response) outcome = await connection.info() self.assertEqual(outcome["email"], "test@gmail.com") diff --git a/tests/unit_tests/connections/signin/test_async_ws.py b/tests/unit_tests/connections/signin/test_async_ws.py index d8e0ba8c..23245bdc 100644 --- a/tests/unit_tests/connections/signin/test_async_ws.py +++ b/tests/unit_tests/connections/signin/test_async_ws.py @@ -43,7 +43,10 @@ async def asyncSetUp(self): async def test_signin_root(self): connection = AsyncWsSurrealConnection(self.url) - _ = await connection.signin(self.vars_params) + response = await connection.signin(self.vars_params) + self.assertIsNotNone(response) + _ = await self.connection.query("DELETE user;") + _ = await self.connection.query("REMOVE TABLE user;") await self.connection.socket.close() await connection.socket.close() @@ -54,7 +57,8 @@ async def test_signin_namespace(self): "username": "test", "password": "test", } - _ = await connection.signin(vars) + response = await connection.signin(vars) + self.assertIsNotNone(response) _ = await self.connection.query("DELETE user;") _ = await self.connection.query("REMOVE TABLE user;") await self.connection.socket.close() @@ -68,7 +72,8 @@ async def test_signin_database(self): "username": "test", "password": "test", } - _ = await connection.signin(vars) + response = await connection.signin(vars) + self.assertIsNotNone(response) _ = await self.connection.query("DELETE user;") _ = await self.connection.query("REMOVE TABLE user;") await self.connection.socket.close() @@ -85,8 +90,8 @@ async def test_signin_record(self): } } connection = AsyncWsSurrealConnection(self.url) - # for below if client is HTTP then persist and attach to all headers - _ = await connection.signin(vars) + response = await connection.signin(vars) + self.assertIsNotNone(response) outcome = await connection.info() self.assertEqual(outcome["email"], "test@gmail.com") diff --git a/tests/unit_tests/connections/signin/test_blocking_http.py b/tests/unit_tests/connections/signin/test_blocking_http.py index 8f832fe6..58d89f41 100644 --- a/tests/unit_tests/connections/signin/test_blocking_http.py +++ b/tests/unit_tests/connections/signin/test_blocking_http.py @@ -43,8 +43,10 @@ def setUp(self): def test_signin_root(self): connection = BlockingHttpSurrealConnection(self.url) - outcome = connection.signin(self.vars_params) - self.assertIn("token", outcome) # Check that the response contains a token + response = connection.signin(self.vars_params) + self.assertIsNotNone(response) + _ = self.connection.query("DELETE user;") + _ = self.connection.query("REMOVE TABLE user;") def test_signin_namespace(self): connection = BlockingHttpSurrealConnection(self.url) @@ -53,7 +55,8 @@ def test_signin_namespace(self): "username": "test", "password": "test", } - _ = connection.signin(vars) + response = connection.signin(vars) + self.assertIsNotNone(response) _ = self.connection.query("DELETE user;") _ = self.connection.query("REMOVE TABLE user;") @@ -65,7 +68,8 @@ def test_signin_database(self): "username": "test", "password": "test", } - _ = connection.signin(vars) + response = connection.signin(vars) + self.assertIsNotNone(response) _ = self.connection.query("DELETE user;") _ = self.connection.query("REMOVE TABLE user;") @@ -80,8 +84,8 @@ def test_signin_record(self): } } connection = BlockingHttpSurrealConnection(self.url) - # for below if client is HTTP then persist and attach to all headers - _ = connection.signin(vars) + response = connection.signin(vars) + self.assertIsNotNone(response) outcome = connection.info() self.assertEqual(outcome["email"], "test@gmail.com") diff --git a/tests/unit_tests/connections/signin/test_blocking_ws.py b/tests/unit_tests/connections/signin/test_blocking_ws.py index bdc01851..c0b571da 100644 --- a/tests/unit_tests/connections/signin/test_blocking_ws.py +++ b/tests/unit_tests/connections/signin/test_blocking_ws.py @@ -43,7 +43,8 @@ def setUp(self): def test_signin_root(self): connection = BlockingWsSurrealConnection(self.url) - _ = connection.signin(self.vars_params) + response = connection.signin(self.vars_params) + self.assertIsNotNone(response) self.connection.socket.close() connection.close() @@ -54,7 +55,8 @@ def test_signin_namespace(self): "username": "test", "password": "test", } - _ = connection.signin(vars) + response = connection.signin(vars) + self.assertIsNotNone(response) _ = self.connection.query("DELETE user;") _ = self.connection.query("REMOVE TABLE user;") self.connection.socket.close() @@ -68,7 +70,8 @@ def test_signin_database(self): "username": "test", "password": "test", } - _ = connection.signin(vars) + response = connection.signin(vars) + self.assertIsNotNone(response) _ = self.connection.query("DELETE user;") _ = self.connection.query("REMOVE TABLE user;") self.connection.socket.close() @@ -85,8 +88,8 @@ def test_signin_record(self): } } connection = BlockingWsSurrealConnection(self.url) - # for below if client is HTTP then persist and attach to all headers - _ = connection.signin(vars) + response = connection.signin(vars) + self.assertIsNotNone(response) outcome = connection.info() self.assertEqual(outcome["email"], "test@gmail.com") diff --git a/tests/unit_tests/connections/signup/test_async_http.py b/tests/unit_tests/connections/signup/test_async_http.py index 7d2ff3e4..81c38e66 100644 --- a/tests/unit_tests/connections/signup/test_async_http.py +++ b/tests/unit_tests/connections/signup/test_async_http.py @@ -48,8 +48,8 @@ async def test_signup(self): } } connection = AsyncHttpSurrealConnection(self.url) - # for below if client is HTTP then persist and attach to all headers - _ = await connection.signup(vars) + response = await connection.signup(vars) + self.assertIsNotNone(response) outcome = await connection.info() self.assertEqual(outcome["email"], "test@gmail.com") diff --git a/tests/unit_tests/connections/signup/test_async_ws.py b/tests/unit_tests/connections/signup/test_async_ws.py index e9ad96a1..c7c982c4 100644 --- a/tests/unit_tests/connections/signup/test_async_ws.py +++ b/tests/unit_tests/connections/signup/test_async_ws.py @@ -48,8 +48,8 @@ async def test_signup(self): } } connection = AsyncWsSurrealConnection(self.url) - # for below if client is HTTP then persist and attach to all headers - _ = await connection.signup(vars) + response = await connection.signup(vars) + self.assertIsNotNone(response) outcome = await connection.info() self.assertEqual(outcome["email"], "test@gmail.com") diff --git a/tests/unit_tests/connections/signup/test_blocking_http.py b/tests/unit_tests/connections/signup/test_blocking_http.py index 148a7ea6..0a14b4da 100644 --- a/tests/unit_tests/connections/signup/test_blocking_http.py +++ b/tests/unit_tests/connections/signup/test_blocking_http.py @@ -48,8 +48,8 @@ def test_signup(self): } } connection = BlockingHttpSurrealConnection(self.url) - # for below if client is HTTP then persist and attach to all headers - _ = connection.signup(vars) + response = connection.signup(vars) + self.assertIsNotNone(response) outcome = connection.info() self.assertEqual(outcome["email"], "test@gmail.com") diff --git a/tests/unit_tests/connections/signup/test_blocking_ws.py b/tests/unit_tests/connections/signup/test_blocking_ws.py index cdf01eb6..32d8545c 100644 --- a/tests/unit_tests/connections/signup/test_blocking_ws.py +++ b/tests/unit_tests/connections/signup/test_blocking_ws.py @@ -48,8 +48,8 @@ def test_signup(self): } } connection = BlockingWsSurrealConnection(self.url) - # for below if client is HTTP then persist and attach to all headers - _ = connection.signup(vars) + response = connection.signup(vars) + self.assertIsNotNone(response) outcome = connection.info() self.assertEqual(outcome["email"], "test@gmail.com")