66from pythclient .pythaccounts import PythAccount , PythAccountType , PythProductAccount
77
88
9- BCH_PRODUCT_ACCOUNT_KEY_DEVNET = '89GseEmvNkzAMMEXcW9oTYzqRPXTsJ3BmNerXmgA1osV'
10- BCH_PRICE_ACCOUNT_KEY_DEVNET = '4EQrNZYk5KR1RnjyzbaaRbHsv8VqZWzSUtvx58wLsZbj'
9+ @pytest .fixture
10+ def solana_pubkey () -> SolanaPublicKey :
11+ return SolanaPublicKey ("AHtgzX45WTKfkPG53L6WYhGEXwQkN1BVknET3sVsLL8J" )
1112
12- PRODUCT_ACCOUNT_B64_DATA = ('1MOyoQIAAAACAAAAlwAAADAClHlZh5cpDjY4oXEsKb3iNn0OynlPd4sltaRy8ZLeBnN5bWJvbAdCQ0gv'
13- 'VVNECmFzc2V0X3R5cGUGQ3J5cHRvDnF1b3RlX2N1cnJlbmN5A1VTRAtkZXNjcmlwdGlvbgdCQ0gvVVNE'
14- 'DmdlbmVyaWNfc3ltYm9sBkJDSFVTRARiYXNlA0JDSA==' )
13+
14+ @pytest .fixture
15+ def product_account_pubkey () -> SolanaPublicKey :
16+ return SolanaPublicKey ("89GseEmvNkzAMMEXcW9oTYzqRPXTsJ3BmNerXmgA1osV" )
1517
1618
1719@pytest .fixture
18- def solana_pubkey ():
19- return SolanaPublicKey ("AHtgzX45WTKfkPG53L6WYhGEXwQkN1BVknET3sVsLL8J" )
20+ def price_account_pubkey () -> SolanaPublicKey :
21+ return SolanaPublicKey ("4EQrNZYk5KR1RnjyzbaaRbHsv8VqZWzSUtvx58wLsZbj" )
22+
23+
24+ @pytest .fixture
25+ def product_account_b64 () -> str :
26+ return ('1MOyoQIAAAACAAAAlwAAADAClHlZh5cpDjY4oXEsKb3iNn0OynlPd4sltaRy8ZLeBnN5bWJvbAdCQ0gv'
27+ 'VVNECmFzc2V0X3R5cGUGQ3J5cHRvDnF1b3RlX2N1cnJlbmN5A1VTRAtkZXNjcmlwdGlvbgdCQ0gvVVNE'
28+ 'DmdlbmVyaWNfc3ltYm9sBkJDSFVTRARiYXNlA0JDSA==' )
2029
2130
2231@pytest .fixture
@@ -28,9 +37,11 @@ def pyth_account(solana_pubkey: SolanaPublicKey, solana_client: SolanaClient) ->
2837
2938
3039@ pytest .fixture
31- def product_account (solana_client : SolanaClient ) -> PythProductAccount :
40+ def product_account (solana_client : SolanaClient ,
41+ product_account_pubkey : SolanaPublicKey ,
42+ price_account_pubkey : SolanaPublicKey ) -> PythProductAccount :
3243 product_account = PythProductAccount (
33- key = SolanaPublicKey ( BCH_PRODUCT_ACCOUNT_KEY_DEVNET ) ,
44+ key = product_account_pubkey ,
3445 solana = solana_client ,
3546 )
3647 product_account .slot = 96866599
@@ -42,15 +53,14 @@ def product_account(solana_client: SolanaClient) -> PythProductAccount:
4253 'generic_symbol' : 'BCHUSD' ,
4354 'base' : 'BCH'
4455 }
45- product_account .first_price_account_key = SolanaPublicKey (
46- BCH_PRICE_ACCOUNT_KEY_DEVNET ,
47- )
56+ product_account .first_price_account_key = price_account_pubkey
4857 return product_account
4958
5059
5160def test_product_account_update_with_rpc_response_with_data (
5261 solana_client : SolanaClient ,
53- product_account : PythProductAccount
62+ product_account : PythProductAccount ,
63+ product_account_b64 : str
5464):
5565 actual = PythProductAccount (
5666 key = product_account .key ,
@@ -62,7 +72,7 @@ def test_product_account_update_with_rpc_response_with_data(
6272 value = {
6373 'lamports' : 1000000000 ,
6474 'data' : [
65- PRODUCT_ACCOUNT_B64_DATA ,
75+ product_account_b64 ,
6676 'base64'
6777 ]
6878 }
@@ -78,13 +88,14 @@ def test_product_account_update_with_rpc_response_with_data(
7888
7989def test_pyth_account_update_with_rpc_response_wrong_type (
8090 pyth_account : PythAccount ,
81- caplog : LogCaptureFixture
91+ caplog : LogCaptureFixture ,
92+ product_account_b64 : str
8293):
8394 slot = 96866600
8495 value = {
8596 'lamports' : 1000000000 ,
8697 'data' : [
87- PRODUCT_ACCOUNT_B64_DATA ,
98+ product_account_b64 ,
8899 'base64'
89100 ]
90101 }
0 commit comments