22Additional coverage tests for payments and MCP modules.
33"""
44
5- import pytest
6- from decimal import Decimal
75from solana_ai_registries .payments import PaymentManager
86from solana_ai_registries .mcp import McpServerRegistry
97from solana_ai_registries .agent import AgentRegistry
@@ -15,33 +13,37 @@ class TestPaymentManagerBasics:
1513 def test_payment_manager_init_devnet (self ):
1614 """Test PaymentManager initialization for devnet."""
1715 from solana_ai_registries .client import SolanaAIRegistriesClient
16+
1817 client = SolanaAIRegistriesClient ()
1918 manager = PaymentManager (client , use_mainnet = False )
20-
19+
2120 assert manager .client == client
2221
2322 def test_payment_manager_init_mainnet (self ):
2423 """Test PaymentManager initialization for mainnet."""
2524 from solana_ai_registries .client import SolanaAIRegistriesClient
25+
2626 client = SolanaAIRegistriesClient ()
2727 manager = PaymentManager (client , use_mainnet = True )
28-
28+
2929 assert manager .client == client
3030
3131 def test_get_token_mint_devnet (self ):
3232 """Test getting token mint for devnet."""
3333 from solana_ai_registries .client import SolanaAIRegistriesClient
34+
3435 client = SolanaAIRegistriesClient ()
3536 manager = PaymentManager (client , use_mainnet = False )
36-
37+
3738 assert manager .token_mint is not None
3839
3940 def test_get_token_mint_mainnet (self ):
4041 """Test getting token mint for mainnet."""
4142 from solana_ai_registries .client import SolanaAIRegistriesClient
43+
4244 client = SolanaAIRegistriesClient ()
4345 manager = PaymentManager (client , use_mainnet = True )
44-
46+
4547 assert manager .token_mint is not None
4648
4749
@@ -51,9 +53,10 @@ class TestMcpServerRegistryBasics:
5153 def test_mcp_registry_init (self ):
5254 """Test McpServerRegistry initialization."""
5355 from solana_ai_registries .client import SolanaAIRegistriesClient
56+
5457 client = SolanaAIRegistriesClient ()
5558 registry = McpServerRegistry (client )
56-
59+
5760 assert registry .client == client
5861
5962
@@ -63,9 +66,10 @@ class TestAgentRegistryBasics:
6366 def test_agent_registry_init (self ):
6467 """Test AgentRegistry initialization."""
6568 from solana_ai_registries .client import SolanaAIRegistriesClient
69+
6670 client = SolanaAIRegistriesClient ()
6771 registry = AgentRegistry (client )
68-
72+
6973 assert registry .client == client
7074
7175
@@ -77,17 +81,17 @@ def test_import_constants(self):
7781 from solana_ai_registries .constants import (
7882 MAX_AGENT_ID_LEN ,
7983 MAX_AGENT_NAME_LEN ,
80- A2AMPL_BASE_UNIT
84+ A2AMPL_BASE_UNIT ,
8185 )
82-
86+
8387 assert MAX_AGENT_ID_LEN > 0
84- assert MAX_AGENT_NAME_LEN > 0
88+ assert MAX_AGENT_NAME_LEN > 0
8589 assert A2AMPL_BASE_UNIT > 0
8690
8791 def test_validation_functions (self ):
8892 """Test validation functions."""
8993 from solana_ai_registries .constants import validate_string_length , validate_url
90-
94+
9195 # These should not raise
9296 validate_string_length ("test" , 10 , "test field" )
9397 validate_url ("https://example.com" , "test url" )
@@ -101,14 +105,14 @@ def test_exception_creation(self):
101105 from solana_ai_registries .exceptions import (
102106 SolanaAIRegistriesError ,
103107 AgentNotFoundError ,
104- McpServerNotFoundError
108+ McpServerNotFoundError ,
105109 )
106-
110+
107111 base_error = SolanaAIRegistriesError ("Base error" )
108112 assert str (base_error ) == "Base error"
109-
113+
110114 agent_error = AgentNotFoundError ("test_agent" , "test_owner" )
111115 assert "test_agent" in str (agent_error )
112-
116+
113117 mcp_error = McpServerNotFoundError ("test_server" , "test_owner" )
114- assert "test_server" in str (mcp_error )
118+ assert "test_server" in str (mcp_error )
0 commit comments