-
Notifications
You must be signed in to change notification settings - Fork 5
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
5 changed files
with
199 additions
and
12 deletions.
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
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,37 @@ | ||
import unittest | ||
from pymempool import MempoolAPI | ||
|
||
class TestAddresses(unittest.TestCase): | ||
@classmethod | ||
def setUpClass(cls): | ||
cls.address = "1wiz18xYmhRX6xStj2b9t1rwWX4GKUgpv" | ||
|
||
def test_address(self): | ||
api = MempoolAPI() | ||
|
||
ret = api.get_address(self.address) | ||
self.assertIsInstance(ret, dict) | ||
|
||
def test_address_transactions(self): | ||
api = MempoolAPI() | ||
|
||
ret = api.get_address_transactions(self.address) | ||
self.assertIsInstance(ret, list) | ||
|
||
def test_address_transactions_chain(self): | ||
api = MempoolAPI() | ||
|
||
ret = api.get_address_transactions_chain(self.address) | ||
self.assertIsInstance(ret, list) | ||
|
||
def test_address_transactions_mempool(self): | ||
api = MempoolAPI() | ||
|
||
ret = api.get_address_transactions_mempool(self.address) | ||
self.assertIsInstance(ret, list) | ||
|
||
def test_address_transactions_utxo(self): | ||
api = MempoolAPI() | ||
|
||
ret = api.get_address_utxo(self.address) | ||
self.assertIsInstance(ret, list) |
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,86 @@ | ||
import unittest | ||
|
||
from pymempool import MempoolAPI | ||
|
||
|
||
class TestBlocks(unittest.TestCase): | ||
@classmethod | ||
def setUpClass(cls): | ||
cls.hash = "000000000000000015dc777b3ff2611091336355d3f0ee9766a2cf3be8e4b1ce" | ||
cls.index = "216" | ||
cls.height = "363366" | ||
|
||
def test_block(self): | ||
api = MempoolAPI() | ||
|
||
ret = api.get_block(self.hash) | ||
self.assertIsInstance(ret, dict) | ||
self.assertEqual(ret["height"], int(self.height)) | ||
|
||
def test_block_header(self): | ||
api = MempoolAPI() | ||
|
||
ret = api.get_block_header(self.hash) | ||
self.assertIsInstance(ret, str) | ||
|
||
def test_block_height(self): | ||
api = MempoolAPI() | ||
|
||
ret = api.get_block_height(self.height) | ||
self.assertIsInstance(ret, str) | ||
self.assertEqual(ret, self.hash) | ||
|
||
def test_block_raw(self): | ||
api = MempoolAPI() | ||
|
||
ret = api.get_block_raw(self.hash) | ||
self.assertIsInstance(ret, bytes) | ||
|
||
def test_block_status(self): | ||
api = MempoolAPI() | ||
|
||
ret = api.get_block_status(self.hash) | ||
self.assertIsInstance(ret, dict) | ||
self.assertEqual(ret["height"], int(self.height)) | ||
|
||
def test_block_tip_height(self): | ||
api = MempoolAPI() | ||
|
||
ret = api.get_block_tip_height() | ||
self.assertIsInstance(ret, int) | ||
|
||
def test_block_tip_hash(self): | ||
api = MempoolAPI() | ||
|
||
ret = api.get_block_tip_hash() | ||
self.assertIsInstance(ret, str) | ||
|
||
def test_block_transaction_id(self): | ||
api = MempoolAPI() | ||
|
||
ret = api.get_block_transaction_id(self.hash, self.index) | ||
self.assertIsInstance(ret, str) | ||
|
||
def test_block_transaction_ids(self): | ||
api = MempoolAPI() | ||
|
||
ret = api.get_block_transaction_ids(self.hash) | ||
self.assertIsInstance(ret, list) | ||
|
||
def test_block_transactions(self): | ||
api = MempoolAPI() | ||
|
||
ret = api.get_block_transactions(self.hash) | ||
self.assertIsInstance(ret, list) | ||
|
||
def test_blocks(self): | ||
api = MempoolAPI() | ||
|
||
ret = api.get_blocks(self.height) | ||
self.assertIsInstance(ret, list) | ||
|
||
# def test_blocks_bulk(self): | ||
# api = MempoolAPI() | ||
# | ||
# ret = api.get_blocks_bulk(self.height, self.height) | ||
# self.assertIsInstance(ret, list) |
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,8 @@ | ||
import unittest | ||
from pymempool import MempoolAPI | ||
|
||
class TestGeneral(unittest.TestCase): | ||
def test_difficulty(self): | ||
api = MempoolAPI() | ||
ret = api.get_difficulty_adjustment() | ||
self.assertTrue(len(ret) > 0) |