-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
feat: blacklist e2e tests for fiattokenfactory #370
Conversation
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
}, | ||
} | ||
require.Equal(t, expectedGetBlacklisterResponse.Blacklister, showBlacklisterRes.Blacklister) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a happy path test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added in: 06a3995
(#370)
e2e/fiat_tf_test.go
Outdated
|
||
pauseFiatTF(t, ctx, val, nw.fiatTfRoles.Pauser) | ||
|
||
blacklistAccount(t, ctx, val, nw.fiatTfRoles.Blacklister, toBlacklist1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing verification that toBlacklist1
has been successfully blacklisted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @xngln , we do this check in the blacklistAccount function:
Lines 392 to 402 in 149a7f6
var showBlacklistedResponse fiattokenfactorytypes.QueryGetBlacklistedResponse | |
err = json.Unmarshal(res, &showBlacklistedResponse) | |
require.NoError(t, err, "failed to unmarshal show-blacklisted response") | |
expectedBlacklistResponse := fiattokenfactorytypes.QueryGetBlacklistedResponse{ | |
Blacklisted: fiattokenfactorytypes.Blacklisted{ | |
AddressBz: toBlacklist.Address(), | |
}, | |
} | |
require.Equal(t, expectedBlacklistResponse.Blacklisted, showBlacklistedResponse.Blacklisted) |
require.NoError(t, err, "failed to query list-blacklisted") | ||
|
||
var preFailedBlacklist, postFailedBlacklist fiattokenfactorytypes.QueryAllBlacklistedResponse | ||
_ = json.Unmarshal(res, &preFailedBlacklist) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to be extra thorough, could we also verify that preFailedBlacklist
does not contain toBlacklist2
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add in: b634d34
(#370)
e2e/fiat_tf_test.go
Outdated
|
||
blacklistAccount(t, ctx, val, nw.fiatTfRoles.Blacklister, nw.fiatTfRoles.Blacklister) | ||
|
||
blacklistAccount(t, ctx, val, nw.fiatTfRoles.Blacklister, toBlacklist2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing verification that toBlacklist2
is successfully blacklisted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See: #370 (comment)
}, | ||
} | ||
require.Equal(t, expectedBlacklistResponse.Blacklisted, showBlacklistedRes.Blacklisted) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a happy path test here too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added in: 06a3995
(#370)
e2e/fiat_tf_test.go
Outdated
|
||
pauseFiatTF(t, ctx, val, nw.fiatTfRoles.Pauser) | ||
|
||
unblacklistAccount(t, ctx, val, nw.fiatTfRoles.Blacklister, blacklistedUser1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing verification that blacklistedUser1
is unblacklisted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do this check inside of the unblacklistAccount function:
Lines 411 to 412 in 149a7f6
_, _, err = val.ExecQuery(ctx, "fiat-tokenfactory", "show-blacklisted", unBlacklist.FormattedAddress()) | |
require.Error(t, err, "query succeeded, blacklisted account should not exist") |
e2e/fiat_tf_test.go
Outdated
|
||
blacklistAccount(t, ctx, val, nw.fiatTfRoles.Blacklister, nw.fiatTfRoles.Blacklister) | ||
|
||
unblacklistAccount(t, ctx, val, nw.fiatTfRoles.Blacklister, blacklistedUser1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing verification that blacklistedUser
is unblacklisted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See: #370 (comment)
|
||
_, err = showBlacklisted(ctx, val, blacklistedUser1) | ||
require.Error(t, err, "query succeeded, blacklisted account should not exist") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add the happy path test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added in: 06a3995
(#370)
Co-authored-by: Dan Kanefsky <dan@noble.xyz>
06a3995
to
834fd2e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Includes:
TestFiatTFUpdateBlacklister
TestFiatTFBlacklist
TestFiatTFUnblacklist