Skip to content

Commit

Permalink
test: add necessary mocked call in access control unit testing
Browse files Browse the repository at this point in the history
  • Loading branch information
xorsal committed Nov 6, 2024
1 parent c6912b0 commit 1955be4
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion solidity/test/unit/modules/dispute/BondEscalationModule.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {Helpers} from '../../../utils/Helpers.sol';
import {IAccessController} from '@defi-wonderland/prophet-core/solidity/interfaces/IAccessController.sol';
import {IModule} from '@defi-wonderland/prophet-core/solidity/interfaces/IModule.sol';

import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol';
import {IOracle, IOracleAccessController} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol';
import {IAccessModule} from '@defi-wonderland/prophet-core/solidity/interfaces/modules/accessControl/IAccessModule.sol';
import {ValidatorLib} from '@defi-wonderland/prophet-core/solidity/libraries/ValidatorLib.sol';
import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';
Expand Down Expand Up @@ -1532,6 +1532,13 @@ contract BondEscalationModule_Unit_AccessControl is BaseTest {
uint256 _numAgainstPledgers = _numForPledgers + 1;
_setBondEscalation(_requestId, _numForPledgers, _numAgainstPledgers);

// expect a call checking whether the access module has been approved by the user
_mockAndExpect(
address(oracle),
abi.encodeCall(IOracleAccessController.isAccessModuleApproved, (_user, _accessModule)),
abi.encode(true)
);

IAccessController.AccessControl memory _accessControl = IAccessController.AccessControl({user: _user, data: _data});

// Mock and expect call to access control module
Expand Down Expand Up @@ -1590,6 +1597,13 @@ contract BondEscalationModule_Unit_AccessControl is BaseTest {

_setBondEscalation(_requestId, _numForPledgers, _numAgainstPledgers);

// todo: extract to helper when we add tests for the other access controlled functions
_mockAndExpect(
address(oracle),
abi.encodeCall(IOracleAccessController.isAccessModuleApproved, (_user, _accessModule)),
abi.encode(true)
);

_mockAndExpect(
address(_params.accountingExtension),
abi.encodeCall(
Expand Down

0 comments on commit 1955be4

Please sign in to comment.