I have a contract A that is restricted to be called by another contract B which is of type ‘ContractID’.
But I want to test it quickly without spinning up both A and B, currently, I am only aware of making calls as ‘Identity::Address’.
Is there a way to pretend to be a ContractID in a rust integration test instead of just a wallet identity?
This will greatly simplify the testing process without needing to get B to the proper state to call A.
Ethereum doesn’t make a strong distinction between contracts and eoa’s wrt to testing, so I’m wondering if Fuel has plans to do this as well
Hi there!
You may take a look into this
https://rust.fuel.network/v0.41.0/testing/the-setup-program-test-macro.html
Please let me know if it solves your question.
1 Like
opened 04:04AM - 04 May 23 UTC
I have a contract A that is restricted to be called by another contract B which … is of type ‘ContractID’.
But I want to test A quickly without spinning up both A and B, currently, I am only aware of making calls as ‘Identity::Address’.
Is there a way to pretend to be a ContractID in a rust integration test instead of just a wallet identity?
This will greatly simplify the testing process without needing to get B to the proper state to call A.
Ethereum doesn’t make a strong distinction between contracts and eoa’s wrt to testing, so I’m wondering if Fuel has plans to do this as well
```
storage {
adminID: Identity = Identity(...),
adminCID: ContractId = ContractId(...),
}
```
In this case it's easier to run an integration test if the admin is an identity since you can use wallet unlocked class to test it easily, but the production it should be a ContractId since it's a contract
Is the recommendation to always use Identity for easier testing? that would make using the contract's abi more complicated since you would need to cast the Identity to a ContractId
```
let admin_contract = abi(Admin, storage.adminCID.value);
```
I don’t believe this solves the issue, can you check this github issue for more context I could be wrong, but that suggestions is more or less what I’m doing currently