6
6
from pythclient .pythaccounts import PythAccount , PythAccountType , PythProductAccount
7
7
8
8
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" )
11
12
12
- PRODUCT_ACCOUNT_B64_DATA = ('1MOyoQIAAAACAAAAlwAAADAClHlZh5cpDjY4oXEsKb3iNn0OynlPd4sltaRy8ZLeBnN5bWJvbAdCQ0gv'
13
- 'VVNECmFzc2V0X3R5cGUGQ3J5cHRvDnF1b3RlX2N1cnJlbmN5A1VTRAtkZXNjcmlwdGlvbgdCQ0gvVVNE'
14
- 'DmdlbmVyaWNfc3ltYm9sBkJDSFVTRARiYXNlA0JDSA==' )
13
+
14
+ @pytest .fixture
15
+ def product_account_pubkey () -> SolanaPublicKey :
16
+ return SolanaPublicKey ("89GseEmvNkzAMMEXcW9oTYzqRPXTsJ3BmNerXmgA1osV" )
15
17
16
18
17
19
@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==' )
20
29
21
30
22
31
@pytest .fixture
@@ -28,9 +37,11 @@ def pyth_account(solana_pubkey: SolanaPublicKey, solana_client: SolanaClient) ->
28
37
29
38
30
39
@ 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 :
32
43
product_account = PythProductAccount (
33
- key = SolanaPublicKey ( BCH_PRODUCT_ACCOUNT_KEY_DEVNET ) ,
44
+ key = product_account_pubkey ,
34
45
solana = solana_client ,
35
46
)
36
47
product_account .slot = 96866599
@@ -42,15 +53,14 @@ def product_account(solana_client: SolanaClient) -> PythProductAccount:
42
53
'generic_symbol' : 'BCHUSD' ,
43
54
'base' : 'BCH'
44
55
}
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
48
57
return product_account
49
58
50
59
51
60
def test_product_account_update_with_rpc_response_with_data (
52
61
solana_client : SolanaClient ,
53
- product_account : PythProductAccount
62
+ product_account : PythProductAccount ,
63
+ product_account_b64 : str
54
64
):
55
65
actual = PythProductAccount (
56
66
key = product_account .key ,
@@ -62,7 +72,7 @@ def test_product_account_update_with_rpc_response_with_data(
62
72
value = {
63
73
'lamports' : 1000000000 ,
64
74
'data' : [
65
- PRODUCT_ACCOUNT_B64_DATA ,
75
+ product_account_b64 ,
66
76
'base64'
67
77
]
68
78
}
@@ -78,13 +88,14 @@ def test_product_account_update_with_rpc_response_with_data(
78
88
79
89
def test_pyth_account_update_with_rpc_response_wrong_type (
80
90
pyth_account : PythAccount ,
81
- caplog : LogCaptureFixture
91
+ caplog : LogCaptureFixture ,
92
+ product_account_b64 : str
82
93
):
83
94
slot = 96866600
84
95
value = {
85
96
'lamports' : 1000000000 ,
86
97
'data' : [
87
- PRODUCT_ACCOUNT_B64_DATA ,
98
+ product_account_b64 ,
88
99
'base64'
89
100
]
90
101
}
0 commit comments