-
Notifications
You must be signed in to change notification settings - Fork 16
feat: add integration tests for WIP's transferFrom and approve methods #106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Add the 3rd test wallet to be the receiver - Add comprehensive test coverage for WIP token approval functionality - Add integration tests for transferFrom with various scenarios (basic, insufficient allowance, insufficient balance, invalid inputs) - Fix import issue with wallet_address_3 in setup_for_integration.py
chore chore
049c1f4 to
5bac040
Compare
| return {"tx_hash": response["tx_hash"]} | ||
|
|
||
| except Exception as e: | ||
| raise ValueError(f"Failed to withdraw WIP: {str(e)}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why need to remove the prefix? The prefix can give a detail on which method fails.
| if sender_wip_before < transfer_amount: | ||
| story_client.WIP.deposit( | ||
| amount=transfer_amount - sender_wip_before, | ||
| tx_options={"waitForTransaction": True}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Python SDK doesn't have an option for waitForTransaction.
| with pytest.raises(Exception) as exc_info: | ||
| story_client.WIP.transfer( | ||
| to=contract_address, | ||
| amount=web3.to_wei("0.01", "ether"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a large amount, could we consider a small amount? Because it will spend many native token when it run.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
web3.to_wei("0.01", "ether") =1 wei
| pass | ||
|
|
||
| def teardown_method(self): | ||
| """Teardown method called after each test""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we use fixture instead of setup_method and teardown_method methods?
Description
Test
All tests passed on my MAC.
Related Issue
Close #83