Skip to content
Snippets Groups Projects
Commit bbf45c4f authored by Hugo Trentesaux's avatar Hugo Trentesaux
Browse files

detail the rest of identity removal

parent ac4ceede
No related branches found
No related tags found
1 merge request!181Fix consequence of certification loss
Pipeline #33144 waiting for manual action
This commit is part of merge request !181. Comments created here will be created in the context of that merge request.
......@@ -429,7 +429,7 @@ fn test_certification_expire() {
// smith cert Bob → Alice expires at block 10
run_to_block(10);
println!("{:?}", System::events());
// println!("{:?}", System::events());
System::assert_has_event(RuntimeEvent::SmithCert(
pallet_certification::Event::RemovedCert {
issuer: 2, // Bob
......@@ -452,7 +452,7 @@ fn test_certification_expire() {
// normal cert Bob → Alice expires at block 20
run_to_block(20);
println!("{:?}", System::events());
// println!("{:?}", System::events());
System::assert_has_event(RuntimeEvent::Cert(
pallet_certification::Event::RemovedCert {
issuer: 2, // Bob
......@@ -466,5 +466,35 @@ fn test_certification_expire() {
System::assert_has_event(RuntimeEvent::Membership(
pallet_membership::Event::MembershipExpired(1),
));
// --- BLOCK 21 ---
// Bob and Charlie can renew their membership
run_to_block(21);
assert_ok!(Membership::renew_membership(RuntimeOrigin::signed(2)));
assert_ok!(Membership::renew_membership(RuntimeOrigin::signed(3)));
// Alice can not renew her membership which does not exist because it is pending
assert_noop!(
Membership::renew_membership(RuntimeOrigin::signed(1)),
pallet_membership::Error::<Test, Instance1>::MembershipNotFound
);
// Alice can not claim her membership because she does not have enough certifications
assert_noop!(
Membership::claim_membership(RuntimeOrigin::signed(1)),
pallet_duniter_wot::Error::<Test, Instance1>::IdtyNotAllowedToClaimMembership
);
// --- BLOCK 23 ---
run_to_block(23);
// println!("{:?}", System::events());
// after a delay (3 blocks), the pending membership finally expires
System::assert_has_event(RuntimeEvent::Membership(
pallet_membership::Event::PendingMembershipExpired(1),
));
// and the identity is removed
System::assert_has_event(RuntimeEvent::Identity(
pallet_identity::Event::IdtyRemoved { idty_index: 1 },
));
})
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment