[C4GT] Chain-Space: Add tests for `DelegateNotFound`
Description
Subtask under : https://github.com/cord-network/community/issues/7
New testcase can be tested under cargo test -p pallet-chain-space after adding it in the code.
Goals
- [ ] Add tests for
DelegateNotFoundfor pallet/chain-space
Expected Outcome
- [ ] Test should assert for
DelegateNotFoundbeing returned properly in all the possible calls. - [ ] If there are more than one function returning this error code, all of them should be validated either as one test case or as multiple test cases. ## Acceptance Criteria NA
Implementation Details
Look at other test cases, and add a test case for the same.
Ex: creating_a_duplicate_space_should_fail which validates error code SpaceAlreadyAnchored
Mockups / Wireframes
NA
Product Name
CORD
Organization Name
Dhiway
Domain
Blockchain
Tech Skills Needed
Rust
Mentor(s)
@amarts
Complexity
[Medium]
Category
[Test]
Sub Category
[Beginner friendly]
Just opened a pr for Adding tests for DelegateNotFound
Hey @vatsa287 , @amarts , I am interested in contributing to this project, and reviewed the code base. Can you please assign me this ticket ?
Hey @amarts @vatsa287 @Savio629 @Sohajawdekar @sankarshanmukhopadhyay , My self Santosh, I am interested to contributing this project can you please assign me ticket ?
Hello @Santosh130602 Are you currently open to contributing to the issue? If yes, pls respond or directly raise the PR. Thanks.
hello @Santosh130602 can you assign me this.
hi @vatsa287, since it still open, can you assign it to me?
Hi @vatsa287 can you assign this issue to me?
Hi @vatsa287 can you assign this issue to me?
To test for the DelegateNotFound error we need to force a situation where an authorization exists (so the call isn’t failing because of a missing authorization) but the associated delegate isn’t present in the stored list of delegates. One common approach according to me will be to -
-
Set up a valid space: Creating and approving a space normally so that both the space record and its associated authorization are in place.
-
Adding a delegate normally: Calling the dispatchable (for example, add_delegate) to add a delegate so that the authorization exists.
-
Removing the delegate manually: Directly modifying the Delegates storage for that space so that the delegate is removed (or not found) even though the authorization record remains.
4 .Calling the removal function: Now calling the dispatchable (for example, remove_delegate) that expects to find the delegate. Because the delegate is missing from the Delegates storage, the function should return the error DelegateNotFound.
- Asserting the error: Use the testing macro (for example, assert_err!) to confirm that the function call fails with the DelegateNotFound error.
@vatsa287 this according to me will be my approach. Can I work on this issue?
Hi @vatsa287 , can you please assign me this issue ?, I would be very grateful
We are moving away from the 'chain-space' pallet. Hence, closing this issue.
Refer to https://github.com/dhiway/cord/blob/develop/docs/cord-features.md to get more idea about what features you can contribute on.