api: Add validateamount command

This commit is contained in:
tecnovert
2024-02-17 00:01:28 +02:00
parent 42421321f6
commit a1bcf8d4b9
6 changed files with 49 additions and 5 deletions

View File

@@ -507,7 +507,7 @@ class Test(unittest.TestCase):
possible_bids = get_possible_bids(rv_stdout)
possible_bids = get_possible_bids(rv_stdout)
assert (len(possible_bids) == 1)
assert (float(possible_bids[0]['amount_from'] < 20.0))
assert (float(possible_bids[0]['amount_from']) < 20.0)
logging.info('Adding mock data to node1 db for tests')
rows = []

View File

@@ -185,6 +185,15 @@ class Test(BaseTest):
rv = read_json_api(1800, 'wallets/part')
assert ('locked_utxos' in rv)
rv = read_json_api(1800, 'validateamount', {'coin': 'part', 'amount': 0.000000015})
assert ('Mantissa too long' in rv['error'])
rv = read_json_api(1800, 'validateamount', {'coin': 'part', 'amount': 0.000000015, 'method': 'roundoff'})
assert (rv == '0.00000002')
rv = read_json_api(1800, 'validateamount', {'coin': 'part', 'amount': 0.000000015, 'method': 'rounddown'})
assert (rv == '0.00000001')
def test_004_validateSwapType(self):
logging.info('---------- Test validateSwapType')