77
88from dipdup .config import ContractConfig
99from dipdup .config import DipDupConfig
10+ from dipdup .config import HasuraConfig
11+ from dipdup .config import PostgresDatabaseConfig
1012from dipdup .config import TzktDatasourceConfig
1113from dipdup .datasources .subscription import OriginationSubscription
1214from dipdup .datasources .subscription import TransactionSubscription
1517
1618
1719class ConfigTest (IsolatedAsyncioTestCase ):
18- async def asyncSetUp (self ):
20+ async def asyncSetUp (self ) -> None :
1921 self .path = join (dirname (__file__ ), 'dipdup.yml' )
2022
21- async def test_load_initialize (self ):
23+ async def test_load_initialize (self ) -> None :
2224 config = DipDupConfig .load ([self .path ])
2325
2426 config .initialize ()
@@ -59,15 +61,15 @@ async def test_subscriptions(self) -> None:
5961 config .indexes ['hen_mainnet' ].subscriptions , # type: ignore
6062 )
6163
62- async def test_validators (self ):
64+ async def test_validators (self ) -> None :
6365 with self .assertRaises (ConfigurationError ):
6466 ContractConfig (address = 'KT1lalala' )
6567 with self .assertRaises (ConfigurationError ):
6668 ContractConfig (address = 'lalalalalalalalalalalalalalalalalala' )
6769 with self .assertRaises (ConfigurationError ):
6870 TzktDatasourceConfig (kind = 'tzkt' , url = 'not_an_url' )
6971
70- async def test_dump (self ):
72+ async def test_dump (self ) -> None :
7173 config = DipDupConfig .load ([self .path ])
7274 config .initialize ()
7375
@@ -77,3 +79,18 @@ async def test_dump(self):
7779
7880 config = DipDupConfig .load ([tmp ], environment = False )
7981 config .initialize ()
82+
83+ async def test_secrets (self ) -> None :
84+ db_config = PostgresDatabaseConfig (
85+ kind = 'postgres' ,
86+ host = 'localhost' ,
87+ password = 'SeCrEt=)' ,
88+ )
89+ hasura_config = HasuraConfig (
90+ url = 'https://localhost' ,
91+ admin_secret = 'SeCrEt=)' ,
92+ )
93+ self .assertIn ('localhost' , str (db_config ))
94+ self .assertNotIn ('SeCrEt=)' , str (db_config ))
95+ self .assertIn ('localhost' , str (db_config ))
96+ self .assertNotIn ('SeCrEt=)' , str (hasura_config ))
0 commit comments