-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfix_remaining_tests.py
More file actions
73 lines (62 loc) · 2.41 KB
/
Copy pathfix_remaining_tests.py
File metadata and controls
73 lines (62 loc) · 2.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import os
# Fix stablecoin_lifecycle_test.go setup
file_path = "tests/integration/stablecoin_lifecycle_test.go"
if os.path.exists(file_path):
with open(file_path, "r") as f:
content = f.read()
# Add import
if 'github.com/cosmos/cosmos-sdk/codec/address' not in content:
content = content.replace(
'\t"github.com/cosmos/cosmos-sdk/codec"',
'\t"github.com/cosmos/cosmos-sdk/codec"\n\t"github.com/cosmos/cosmos-sdk/codec/address"'
)
# Remove banktypes.TransientKey usage
content = content.replace(
'\t// Create transient store keys\n\ttKeys := storetypes.NewTransientStoreKeys(banktypes.TransientKey)\n\n',
''
)
content = content.replace(
'\tfor _, tKey := range tKeys {\n\t\tstateStore.MountStoreWithDB(tKey, storetypes.StoreTypeTransient, db)\n\t}\n',
''
)
# Remove usage in DefaultContextWithDB
content = content.replace(
'testutil.DefaultContextWithDB(s.T(), storeKeys[authtypes.StoreKey], tKeys[banktypes.TransientKey])',
'testutil.DefaultContextWithDB(s.T(), storeKeys[authtypes.StoreKey], storetypes.NewTransientStoreKey("transient_test"))'
)
# Update authkeeper.NewAccountKeeper
old_call = """s.accountKeeper = authkeeper.NewAccountKeeper(
s.cdc,
runtime.NewKVStoreService(storeKeys[authtypes.StoreKey]),
authtypes.ProtoBaseAccount,
maccPerms,
"stateset",
s.authority.String(),
)"""
new_call = """s.accountKeeper = authkeeper.NewAccountKeeper(
s.cdc,
runtime.NewKVStoreService(storeKeys[authtypes.StoreKey]),
authtypes.ProtoBaseAccount,
maccPerms,
address.NewBech32Codec("stateset"),
"stateset",
s.authority.String(),
)"""
content = content.replace(old_call, new_call)
with open(file_path, "w") as f:
f.write(content)
print(f"Updated {file_path}")
# Fix circuit_breaker_test.go logic
file_path = "tests/integration/circuit_breaker_test.go"
if os.path.exists(file_path):
with open(file_path, "r") as f:
content = f.read()
# Fix Params struct literal
if 'Enabled: true,' in content:
content = content.replace('Enabled: true,\n', '')
# Fix loop variable type mismatch
if 'for i := uint32(0);' in content:
content = content.replace('for i := uint32(0);', 'for i := uint64(0);')
with open(file_path, "w") as f:
f.write(content)
print(f"Updated {file_path}")