cord icon indicating copy to clipboard operation
cord copied to clipboard

[C4GT] Chain-Space: Add tests for `DelegateNotFound`

Open vatsa287 opened this issue 1 year ago • 4 comments

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 DelegateNotFound for pallet/chain-space

Expected Outcome

  • [ ] Test should assert for DelegateNotFound being 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]

vatsa287 avatar Feb 05 '24 11:02 vatsa287

Just opened a pr for Adding tests for DelegateNotFound

Savio629 avatar Mar 20 '24 20:03 Savio629

Hey @vatsa287 , @amarts , I am interested in contributing to this project, and reviewed the code base. Can you please assign me this ticket ?

Sohajawdekar avatar Mar 20 '24 20:03 Sohajawdekar

Hey @amarts @vatsa287 @Savio629 @Sohajawdekar @sankarshanmukhopadhyay , My self Santosh, I am interested to contributing this project can you please assign me ticket ?

Santosh130602 avatar Apr 05 '24 12:04 Santosh130602

Hello @Santosh130602 Are you currently open to contributing to the issue? If yes, pls respond or directly raise the PR. Thanks.

VedantKhairnar avatar Aug 23 '24 06:08 VedantKhairnar

hello @Santosh130602 can you assign me this.

Acuspeedster avatar Nov 24 '24 20:11 Acuspeedster

hi @vatsa287, since it still open, can you assign it to me?

Ashu999 avatar Jan 05 '25 12:01 Ashu999

Hi @vatsa287 can you assign this issue to me?

prathmesh703 avatar Feb 04 '25 18:02 prathmesh703

Hi @vatsa287 can you assign this issue to me?

Arun181989 avatar Feb 26 '25 15:02 Arun181989

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 -

  1. Set up a valid space: Creating and approving a space normally so that both the space record and its associated authorization are in place.

  2. Adding a delegate normally: Calling the dispatchable (for example, add_delegate) to add a delegate so that the authorization exists.

  3. 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.

  1. 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?

ritankarsaha avatar Mar 08 '25 14:03 ritankarsaha

Hi @vatsa287 , can you please assign me this issue ?, I would be very grateful

Mandalorian7773 avatar Apr 11 '25 06:04 Mandalorian7773

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.

amarts avatar Apr 21 '25 01:04 amarts