Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Duniter v2S
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nodes
rust
Duniter v2S
Commits
f6766760
Commit
f6766760
authored
1 year ago
by
Cédric Moreau
Browse files
Options
Downloads
Patches
Plain Diff
test(smith-members): test_smith_member_can_revoke_its_idty
parent
f4da450b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
runtime/gdev/tests/integration_tests.rs
+58
-1
58 additions, 1 deletion
runtime/gdev/tests/integration_tests.rs
with
58 additions
and
1 deletion
runtime/gdev/tests/integration_tests.rs
+
58
−
1
View file @
f6766760
...
...
@@ -23,6 +23,7 @@ use frame_support::traits::{Get, PalletInfo, StorageInfo, StorageInfoTrait};
use
frame_support
::{
assert_err
,
assert_noop
,
assert_ok
};
use
frame_support
::{
StorageHasher
,
Twox128
};
use
gdev_runtime
::
*
;
use
pallet_identity
::{
RevocationPayload
,
REVOCATION_PAYLOAD_PREFIX
};
use
pallet_membership
::
MembershipRemovalReason
;
use
pallet_smith_members
::{
SmithMeta
,
SmithStatus
};
use
sp_core
::
Encode
;
...
...
@@ -1335,6 +1336,63 @@ fn test_change_owner_key() {
})
}
/// members of the smith subwot can revoke their identity
#[test]
fn
test_smith_member_can_revoke_its_idty
()
{
ExtBuilder
::
new
(
1
,
3
,
4
)
.build
()
.execute_with
(||
{
run_to_block
(
2
);
// Charlie goes online
frame_system
::
Pallet
::
<
Runtime
>
::
inc_providers
(
&
AccountKeyring
::
Charlie
.to_account_id
());
assert_ok!
(
AuthorityMembers
::
set_session_keys
(
frame_system
::
RawOrigin
::
Signed
(
AccountKeyring
::
Charlie
.to_account_id
())
.into
(),
create_dummy_session_keys
()
));
assert_ok!
(
AuthorityMembers
::
go_online
(
frame_system
::
RawOrigin
::
Signed
(
AccountKeyring
::
Charlie
.to_account_id
())
.into
()
));
run_to_block
(
25
);
// Charlie is in the authority members
System
::
assert_has_event
(
RuntimeEvent
::
AuthorityMembers
(
pallet_authority_members
::
Event
::
IncomingAuthorities
{
members
:
vec!
[
3
]
},
));
// Charlie is not going out
assert_eq!
(
pallet_authority_members
::
OutgoingAuthorities
::
<
Runtime
>
::
get
()
.contains
(
&
3
),
false
);
let
revocation_payload
=
RevocationPayload
{
idty_index
:
3u32
,
genesis_hash
:
System
::
block_hash
(
0
),
};
let
signature
=
AccountKeyring
::
Charlie
.sign
(
&
(
REVOCATION_PAYLOAD_PREFIX
,
revocation_payload
)
.encode
());
assert_ok!
(
Identity
::
revoke_identity
(
frame_system
::
RawOrigin
::
Signed
(
AccountKeyring
::
Charlie
.to_account_id
())
.into
(),
3
,
AccountKeyring
::
Charlie
.to_account_id
(),
signature
.into
()
));
// membership should be removed
System
::
assert_has_event
(
RuntimeEvent
::
Membership
(
pallet_membership
::
Event
::
MembershipRemoved
{
member
:
3
,
reason
:
MembershipRemovalReason
::
Revoked
,
},
));
// smith membership should be removed as well
System
::
assert_has_event
(
RuntimeEvent
::
SmithMembers
(
pallet_smith_members
::
Event
::
SmithExcluded
{
idty_index
:
3
},
));
// Now Charlie is going out
assert!
(
pallet_authority_members
::
OutgoingAuthorities
::
<
Runtime
>
::
get
()
.contains
(
&
3
));
});
}
/// test genesis account of identity is linked to identity
// (and account without identity is not linked)
#[test]
...
...
@@ -1446,7 +1504,6 @@ fn test_killed_account() {
})
}
// TODO: test_smith_member_can_revoke_its_idty
// TODO: test_revoke_idty
// TODO: test_non_smith_can_not_issue_smith_cert
// TODO: test_non_smith_can_not_issue_smith_cert
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment