From 36e76beb7d80d48a04f449b789dcb8c420fa0d17 Mon Sep 17 00:00:00 2001 From: Harry Date: Thu, 17 Jul 2025 16:34:46 +0800 Subject: [PATCH] test: add comprehensive tests for SystemOAuthEncrypter and related functions --- .../oauth_encryption/test_system_oauth_encryption.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/api/tests/unit_tests/utils/oauth_encryption/test_system_oauth_encryption.py b/api/tests/unit_tests/utils/oauth_encryption/test_system_oauth_encryption.py index b1a488276b..30990f8d50 100644 --- a/api/tests/unit_tests/utils/oauth_encryption/test_system_oauth_encryption.py +++ b/api/tests/unit_tests/utils/oauth_encryption/test_system_oauth_encryption.py @@ -115,10 +115,10 @@ class TestSystemOAuthEncrypter: """Test encryption with invalid input types""" encrypter = SystemOAuthEncrypter("test_secret") - with pytest.raises(Exception): + with pytest.raises(Exception): # noqa: B017 encrypter.encrypt_oauth_params(None) # type: ignore - with pytest.raises(Exception): + with pytest.raises(Exception): # noqa: B017 encrypter.encrypt_oauth_params("not_a_dict") # type: ignore def test_decrypt_oauth_params_basic(self): @@ -162,7 +162,11 @@ class TestSystemOAuthEncrypter: def test_decrypt_oauth_params_unicode_data(self): """Test decryption with unicode data""" encrypter = SystemOAuthEncrypter("test_secret") - original_params = {"client_id": "test_id", "client_secret": "test_secret", "description": "This is a test case 🚀"} + original_params = { + "client_id": "test_id", + "client_secret": "test_secret", + "description": "This is a test case 🚀", + } encrypted = encrypter.encrypt_oauth_params(original_params) decrypted = encrypter.decrypt_oauth_params(encrypted) @@ -456,7 +460,7 @@ class TestConvenienceFunctions: def test_convenience_functions_with_errors(self): """Test convenience functions with error conditions""" # Test encryption with invalid input - with pytest.raises(Exception): + with pytest.raises(Exception): # noqa: B017 encrypt_system_oauth_params(None) # type: ignore # Test decryption with invalid input