add has_identity (#11197)

* add has_identity

* Update frame/identity/src/lib.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* update

* update

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
Xiliang Chen
2022-04-12 17:26:34 +12:00
committed by GitHub
parent 8351ada6a3
commit f84fc59892
4 changed files with 61 additions and 1 deletions
+17
View File
@@ -500,3 +500,20 @@ fn setting_account_id_should_work() {
assert_ok!(Identity::set_account_id(Origin::signed(4), 0, 3));
});
}
#[test]
fn test_has_identity() {
new_test_ext().execute_with(|| {
assert_ok!(Identity::set_identity(Origin::signed(10), Box::new(ten())));
assert!(Identity::has_identity(&10, IdentityField::Display as u64));
assert!(Identity::has_identity(&10, IdentityField::Legal as u64));
assert!(Identity::has_identity(
&10,
IdentityField::Display as u64 | IdentityField::Legal as u64
));
assert!(!Identity::has_identity(
&10,
IdentityField::Display as u64 | IdentityField::Legal as u64 | IdentityField::Web as u64
));
});
}