@@ -20,14 +20,14 @@ use frame_support::{assert_noop, assert_ok, traits::fungible::InspectHold};
2020use kilt_support:: mock:: mock_origin:: DoubleOrigin ;
2121use sp_runtime:: traits:: Zero ;
2222
23- use crate :: { self as attestation, mock:: * , AttesterOf , Config , Event , HoldReason } ;
23+ use crate :: { self as attestation, mock:: * , AttesterOf , Config , HoldReason } ;
2424
2525#[ test]
2626fn test_remove ( ) {
2727 let attester: AttesterOf < Test > = sr25519_did_from_public_key ( & ALICE_SEED ) ;
2828 let claim_hash = claim_hash_from_seed ( CLAIM_HASH_SEED_01 ) ;
2929 let attestation = generate_base_attestation :: < Test > ( attester. clone ( ) , ACCOUNT_00 ) ;
30- let ctype_hash = attestation . ctype_hash ;
30+ let authorization_info = None ;
3131
3232 ExtBuilder :: default ( )
3333 . with_balances ( vec ! [ ( ACCOUNT_00 , <Test as Config >:: Deposit :: get( ) * 100 ) ] )
@@ -37,57 +37,9 @@ fn test_remove() {
3737 assert_ok ! ( Attestation :: remove(
3838 DoubleOrigin ( ACCOUNT_00 , attester. clone( ) ) . into( ) ,
3939 claim_hash,
40- None
41- ) ) ;
42- assert ! ( Attestation :: attestations( claim_hash) . is_none( ) ) ;
43- assert_eq ! (
44- events( ) ,
45- vec![
46- Event :: AttestationRevoked {
47- attester: attester. clone( ) ,
48- claim_hash,
49- authorized_by: attestation:: authorized_by:: AuthorizedBy :: Attester ( attester. clone( ) ) ,
50- ctype_hash,
51- } ,
52- Event :: AttestationRemoved {
53- attester: attester. clone( ) ,
54- claim_hash,
55- authorized_by: attestation:: authorized_by:: AuthorizedBy :: Attester ( attester. clone( ) ) ,
56- ctype_hash,
57- }
58- ]
59- ) ;
60- } ) ;
61- }
62-
63- #[ test]
64- fn test_remove_revoked ( ) {
65- let attester: AttesterOf < Test > = sr25519_did_from_public_key ( & ALICE_SEED ) ;
66- let claim_hash = claim_hash_from_seed ( CLAIM_HASH_SEED_01 ) ;
67- let mut attestation = generate_base_attestation :: < Test > ( attester. clone ( ) , ACCOUNT_00 ) ;
68- attestation. revoked = true ;
69- let ctype_hash = attestation. ctype_hash ;
70-
71- ExtBuilder :: default ( )
72- . with_balances ( vec ! [ ( ACCOUNT_00 , <Test as Config >:: Deposit :: get( ) * 100 ) ] )
73- . with_ctypes ( vec ! [ ( attestation. ctype_hash, attester. clone( ) ) ] )
74- . with_attestations ( vec ! [ ( claim_hash, attestation) ] )
75- . build_and_execute_with_sanity_tests ( || {
76- assert_ok ! ( Attestation :: remove(
77- DoubleOrigin ( ACCOUNT_00 , attester. clone( ) ) . into( ) ,
78- claim_hash,
79- None
40+ authorization_info
8041 ) ) ;
8142 assert ! ( Attestation :: attestations( claim_hash) . is_none( ) ) ;
82- assert_eq ! (
83- events( ) ,
84- vec![ Event :: AttestationRemoved {
85- attester: attester. clone( ) ,
86- claim_hash,
87- ctype_hash,
88- authorized_by: attestation:: authorized_by:: AuthorizedBy :: Attester ( attester. clone( ) )
89- } ]
90- ) ;
9143 } ) ;
9244}
9345
@@ -96,10 +48,9 @@ fn test_remove_authorized() {
9648 let attester: AttesterOf < Test > = sr25519_did_from_public_key ( & ALICE_SEED ) ;
9749 let revoker: AttesterOf < Test > = sr25519_did_from_public_key ( & BOB_SEED ) ;
9850 let claim_hash = claim_hash_from_seed ( CLAIM_HASH_SEED_01 ) ;
99- let mut attestation = generate_base_attestation :: < Test > ( attester. clone ( ) , ACCOUNT_00 ) ;
51+ let mut attestation = generate_base_attestation :: < Test > ( attester, ACCOUNT_00 ) ;
10052 attestation. authorization_id = Some ( revoker. clone ( ) ) ;
10153 let authorization_info = Some ( MockAccessControl ( revoker. clone ( ) ) ) ;
102- let ctype_hash = attestation. ctype_hash ;
10354
10455 ExtBuilder :: default ( )
10556 . with_balances ( vec ! [ ( ACCOUNT_00 , <Test as Config >:: Deposit :: get( ) * 100 ) ] )
@@ -113,23 +64,6 @@ fn test_remove_authorized() {
11364 ) ) ;
11465 assert ! ( Attestation :: attestations( claim_hash) . is_none( ) ) ;
11566 assert ! ( !Attestation :: external_attestations( revoker. clone( ) , claim_hash) ) ;
116- assert_eq ! (
117- events( ) ,
118- vec![
119- Event :: AttestationRevoked {
120- attester: attester. clone( ) ,
121- claim_hash,
122- ctype_hash,
123- authorized_by: attestation:: authorized_by:: AuthorizedBy :: Authorization ( revoker. clone( ) )
124- } ,
125- Event :: AttestationRemoved {
126- attester: attester. clone( ) ,
127- claim_hash,
128- ctype_hash,
129- authorized_by: attestation:: authorized_by:: AuthorizedBy :: Authorization ( revoker. clone( ) )
130- }
131- ]
132- ) ;
13367 } ) ;
13468}
13569
0 commit comments