Skip to content

Commit deac87d

Browse files
committed
feat(testing): add set_account_as_security_governor function
1 parent 6603f2e commit deac87d

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

packages/testing/src/constants.cairo

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ pub const WRONG_ADMIN: ContractAddress = 'WRONG_ADMIN'.try_into().unwrap();
44
pub const INITIAL_ROOT_ADMIN: ContractAddress = 'INITIAL_ROOT_ADMIN'.try_into().unwrap();
55
pub const GOVERNANCE_ADMIN: ContractAddress = 'GOVERNANCE_ADMIN'.try_into().unwrap();
66
pub const SECURITY_ADMIN: ContractAddress = 'SECURITY_ADMIN'.try_into().unwrap();
7+
pub const SECURITY_GOVERNOR: ContractAddress = 'SECURITY_GOVERNOR'.try_into().unwrap();
78
pub const APP_ROLE_ADMIN: ContractAddress = 'APP_ROLE_ADMIN'.try_into().unwrap();
89
pub const APP_GOVERNOR: ContractAddress = 'APP_GOVERNOR'.try_into().unwrap();
910
pub const OPERATOR: ContractAddress = 'OPERATOR'.try_into().unwrap();

packages/testing/src/test_utils.cairo

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,14 @@ pub fn set_account_as_security_agent(
3535
roles_dispatcher.register_security_agent(:account);
3636
}
3737

38+
pub fn set_account_as_security_governor(
39+
contract: ContractAddress, account: ContractAddress, security_admin: ContractAddress,
40+
) {
41+
let roles_dispatcher = IRolesDispatcher { contract_address: contract };
42+
cheat_caller_address_once(contract_address: contract, caller_address: security_admin);
43+
roles_dispatcher.register_security_governor(:account);
44+
}
45+
3846
pub fn set_account_as_app_role_admin(
3947
contract: ContractAddress, account: ContractAddress, governance_admin: ContractAddress,
4048
) {
@@ -105,6 +113,11 @@ pub fn set_default_roles(contract: ContractAddress, governance_admin: ContractAd
105113
account: testing_constants::SECURITY_AGENT,
106114
security_admin: testing_constants::SECURITY_ADMIN,
107115
);
116+
set_account_as_security_governor(
117+
:contract,
118+
account: testing_constants::SECURITY_GOVERNOR,
119+
security_admin: testing_constants::SECURITY_ADMIN,
120+
);
108121
}
109122

110123
pub fn cheat_caller_address_once(

0 commit comments

Comments
 (0)