1
0
mirror of https://github.com/Rikj000/MoniGoMani.git synced 2022-03-06 00:08:05 +03:00

freqtrade_cli module covered in unit test

This commit is contained in:
topscoder
2021-07-16 09:12:32 +02:00
parent cc64469bb8
commit 7efb6c4dea
2 changed files with 59 additions and 11 deletions

View File

@@ -9,13 +9,6 @@ def test_initialisation_without_logger():
assert isinstance(fc, FreqtradeCli)
def test_initialisation_with_logger():
'''
Checks if instantiation succeeds without freqtrade installation
Todo:
- Mock logger object
- Probably mock freqtrade installation
'''
fc = __get_instance('.', use_logger = True)
assert isinstance(fc, FreqtradeCli)
@@ -23,10 +16,52 @@ def test_set_basedir():
fc = __get_instance('.', use_logger=True)
assert fc.basedir == '.'
def test_set_install_type_to_source():
fc = __get_instance('.', use_logger=True)
fc.install_type = 'source'
assert fc.install_type == 'source'
def test_set_incorrect_install_type_should_return_none():
fc = __get_instance('.', use_logger=True)
fc.install_type = 'foobar'
assert fc.install_type is None
def test_set_freqtrade_binary():
fc = __get_instance('.', use_logger=True)
fc.freqtrade_binary = 'unknown'
assert fc.freqtrade_binary == 'unknown'
def test_installation_exists_should_return_bool():
fc = __get_instance('.', use_logger=True)
# without installation type
assert type(fc.installation_exists()) is bool
def test_installation_exists_faulty_install_type():
fc = __get_instance('.', use_logger=True)
fc.install_type = 'foobar'
assert fc.installation_exists() is False
def test_installation_exists_faulty_freqtrade_binary():
fc = __get_instance('.', use_logger=True)
fc.install_type = 'source'
fc.freqtrade_binary = 'unknown'
assert fc.installation_exists() is False
def test_installation_exists_install_type_docker():
fc = __get_instance('.', use_logger=True)
fc.install_type = 'docker'
fc.freqtrade_binary = 'unknown'
assert fc.installation_exists() is True
'''
Private helper methods
'''
def __get_instance(dir, use_logger = True):
'''
Todo:
- Mock logger object
- Probably mock freqtrade installation
'''
logger = None
if use_logger is True: