-
Notifications
You must be signed in to change notification settings - Fork 121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add test for PeerIdTooLong and clean up code #541
base: develop
Are you sure you want to change the base?
Conversation
@HasanZaigam |
Hi @vatsa287, I am confused now about what I have to do. Please tell me, if possible, if you can take a Google Meet. I didn't understand what I had to do next. |
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.
Looks good overall! The function is clear, and the length check for peer_id
is well-implemented. Just noticed some minor indentation issues—fixing that would make it more readable. Nice work!
@HasanZaigam @Hasan2k5 |
Cargo.toml
Outdated
@@ -20,6 +20,7 @@ members = [ | |||
"pallets/did", |
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.
Changes made here is not required as well.
@@ -178,7 +178,7 @@ where | |||
interval.tick().await; | |||
|
|||
if full_nodes.iter().all(|(id, service, _, _)| full_predicate(*id, service)) { | |||
break | |||
break; |
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.
This change is not required as it is the last statement in the block in Rust.
deleted the extra break command.
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.
I have made all the changes and improved the test.rs code to make the test for PeerIdTooLong more comprehensive, as per your guidance. Please review it again, sir.
Removed the network-authorization Module,so that the code remove smoothly.
@vatsa287, please check the changes and let me know , what next changes I have to make in it, please guide me . |
@HasanZaigam |
@HasanZaigam ^^ |
ok , i makes all changes write and add the test case in test only and let you know, after making the changes. |
@vatsa287 makes the changes please review it |
PR Title:
Add Test for PeerIdTooLong Error and Clean Up Code in Network Authorization Pallet
Description:
This PR enhances the
pallet-network-authorization
module by adding tests for thePeerIdTooLong
error scenario and refactoring the code to improve readability and maintainability.Approach:
PeerIdTooLong
error, validating the correct error handling.Why This Matters:
How to Test:
To run the tests, use the following command:
cargo test -p pallet-network-authorization -- --nocapture
This will verify that the error handling and successful authorization logic are working correctly.
By merging this PR, the code becomes more robust and easier to maintain, while laying the foundation for additional tests in the future.