NEWTON
Asked
6 months ago
12
views
0
I built a module with Cairo language and I would like to unit test it. The contract is pretty simple : it manages a list of authorized addresses and provide some "modifier" functions to help.
I have taken the sample unit testing code from the documentation but nothing is referring about sending an account address to a function with python.
How should I proceed ?
Thanks in advance
ㅤ This question was originally posted on Stack Overflow
0
You can spoof an account by providing the caller address to the invoke function like this:
await contract.function(
arg1=felt,
arg2=felt2,
).invoke(caller_address=private_to_stark_key(123))
If you want a more detailed example of how the python unit testing framework works you can check these 2 links
https://github.com/starknet-edu/basecamp/blob/main/camp_4/buidl/tests/test_contract.py https://github.com/starknet-edu/starknet-debug/tree/master/python
ㅤ This answer was originally posted on Stack Overflow
answered
5 months ago
Does writing it to zero actually do something?
Is there any blockchain project contract supporting web2 scripts executable on VIa EVM?
ApeWorX: Why am I getting an "account __execute__" error message?
How to make Bitwise operations in Cairo Lang using %builtins bitwise, bitwise_xor?
Where can i get test tokens in StarkNet?
Cairo v. Solidity
What does it mean to declare a 'local' variable inside a 'let'?