Skip to content

Commit

Permalink
Create test_defi.py
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH authored Dec 1, 2024
1 parent 5d52e08 commit 9ce9bc3
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/test_defi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import unittest
from defi import DeFiManager # Assuming you have a DeFiManager class

class TestDeFiManager(unittest.TestCase):
def setUp(self):
self.defi_manager = DeFiManager()

def test_stake_tokens(self):
result = self.defi_manager.stake_tokens("Alice", 100)
self.assertTrue(result)

def test_withdraw_tokens(self):
self.defi_manager.stake_tokens("Bob", 200)
result = self.defi_manager.withdraw_tokens("Bob", 100)
self.assertTrue(result)

def test_insufficient_balance(self):
with self.assertRaises(ValueError):
self.defi_manager.withdraw_tokens("Charlie", 100)

if __name__ == "__main__":
unittest.main()

0 comments on commit 9ce9bc3

Please sign in to comment.