lbry-sdk/tests/unit/lbrynet_daemon/test_DaemonCLI.py

39 lines
1.5 KiB
Python
Raw Normal View History

from twisted.trial import unittest
2016-09-26 03:35:37 +02:00
from lbrynet.lbrynet_daemon import DaemonCLI
2016-09-26 03:35:37 +02:00
class DaemonCLITests(unittest.TestCase):
def test_guess_type(self):
2016-09-26 03:35:37 +02:00
self.assertEqual('0.3.8', DaemonCLI.guess_type('0.3.8'))
self.assertEqual(0.3, DaemonCLI.guess_type('0.3'))
self.assertEqual(3, DaemonCLI.guess_type('3'))
self.assertEqual('VdNmakxFORPSyfCprAD/eDDPk5TY9QYtSA==', DaemonCLI.guess_type('VdNmakxFORPSyfCprAD/eDDPk5TY9QYtSA=='))
self.assertEqual(0.3, DaemonCLI.guess_type('0.3'))
2017-03-23 22:44:06 +01:00
self.assertEqual(True, DaemonCLI.guess_type('TRUE'))
self.assertEqual(True, DaemonCLI.guess_type('true'))
self.assertEqual(True, DaemonCLI.guess_type('True'))
self.assertEqual(False, DaemonCLI.guess_type('FALSE'))
self.assertEqual(False, DaemonCLI.guess_type('false'))
self.assertEqual(False, DaemonCLI.guess_type('False'))
def test_get_params(self):
test_params = [
'b64address=VdNmakxFORPSyfCprAD/eDDPk5TY9QYtSA==',
'name=test',
'amount=5.3',
'n=5',
2017-03-23 22:44:06 +01:00
'address=bY13xeAjLrsjP4KGETwStK2a9UgKgXVTXu',
't=true',
'f=False',
]
test_r = {
'b64address': 'VdNmakxFORPSyfCprAD/eDDPk5TY9QYtSA==',
'name': 'test',
'amount': 5.3,
'n': 5,
2017-03-23 22:44:06 +01:00
'address': 'bY13xeAjLrsjP4KGETwStK2a9UgKgXVTXu',
't': True,
'f': False,
}
2016-09-26 03:35:37 +02:00
self.assertDictEqual(test_r, DaemonCLI.get_params_from_kwargs(test_params))