-
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
blockchain_integration/pi_network/pinnacle/tests/test_cross_chain_bridge.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import unittest | ||
from unittest.mock import MagicMock, patch | ||
from pinnacle.interfaces.cross_chain_bridge_interface import CrossChainBridgeInterface | ||
from pinnacle.cross_chain_bridges.poly_network_bridge import PolyNetworkBridge | ||
|
||
class TestCrossChainBridge(unittest.TestCase): | ||
def setUp(self): | ||
self.cross_chain_bridge = PolyNetworkBridge() | ||
|
||
def test_bridge_tokens(self): | ||
# Mock the Poly Network API response | ||
response = {'txHash': '0x...'} | ||
with patch('requests.post', return_value=MagicMock(json=MagicMock(return_value=response))): | ||
tx_hash = self.cross_chain_bridge.bridge_tokens(['ETH', 'BTC'], 1.0) | ||
self.assertEqual(tx_hash, '0x...') | ||
|
||
def test_get_bridge_fee(self): | ||
# Mock the Poly Network API response | ||
response = {'fee': '0.01'} | ||
with patch('requests.get', return_value=MagicMock(json=MagicMock(return_value=response))): | ||
fee = self.cross_chain_bridge.get_bridge_fee(['ETH', 'BTC'], 1.0) | ||
self.assertEqual(fee, 0.01) | ||
|
||
def test_get_supported_chains(self): | ||
# Mock the Poly Network API response | ||
response = {'chains': ['Ethereum', 'Binance Smart Chain']} | ||
with patch('requests.get', return_value=MagicMock(json=MagicMock(return_value=response))): | ||
supported_chains = self.cross_chain_bridge.get_supported_chains() | ||
self.assertEqual(supported_chains, ['Ethereum', 'Binance Smart Chain']) | ||
|
||
def test_get_supported_tokens(self): | ||
# Mock the Poly Network API response | ||
response = {'tokens': ['ETH', 'BTC', 'LTC']} | ||
with patch('requests.get', return_value=MagicMock(json=MagicMock(return_value=response))): | ||
supported_tokens = self.cross_chain_bridge.get_supported_tokens() | ||
self.assertEqual(supported_tokens, ['ETH', 'BTC', 'LTC']) |