-
-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cannot init blockfrost chain context (#358)
* Update blockfrost.py * Add tests * Fix format --------- Co-authored-by: Jerry <jerrycgh@gmail.com>
- Loading branch information
Showing
2 changed files
with
23 additions
and
1 deletion.
There are no files selected for viewing
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
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,22 @@ | ||
from unittest.mock import MagicMock, patch | ||
|
||
from blockfrost import ApiUrls | ||
|
||
from pycardano.backend.blockfrost import BlockFrostChainContext | ||
from pycardano.network import Network | ||
|
||
|
||
@patch("pycardano.backend.blockfrost.BlockFrostApi") | ||
def test_blockfrost_chain_context(mock_api): | ||
mock_api.return_value = MagicMock() | ||
chain_context = BlockFrostChainContext("project_id", base_url=ApiUrls.mainnet.value) | ||
assert chain_context.network == Network.MAINNET | ||
|
||
chain_context = BlockFrostChainContext("project_id", base_url=ApiUrls.testnet.value) | ||
assert chain_context.network == Network.TESTNET | ||
|
||
chain_context = BlockFrostChainContext("project_id", base_url=ApiUrls.preprod.value) | ||
assert chain_context.network == Network.TESTNET | ||
|
||
chain_context = BlockFrostChainContext("project_id", base_url=ApiUrls.preview.value) | ||
assert chain_context.network == Network.TESTNET |