Onionr/tests/test_toggle_bootstrap.py

23 lines
754 B
Python
Raw Normal View History

2019-08-30 00:37:39 +00:00
from unittest.mock import patch
import sys, os
sys.path.append(".")
2019-11-21 09:26:23 +00:00
sys.path.append("src/")
2019-08-30 00:37:39 +00:00
import unittest, uuid
TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
print("Test directory:", TEST_DIR)
os.environ["ONIONR_HOME"] = TEST_DIR
from onionrcommands import parser
2019-12-29 17:33:47 +00:00
from onionrsetup import setup_config
setup_config()
import config
2019-12-29 17:21:18 +00:00
class TestToggleBootstrap(unittest.TestCase):
def test_toggle_bootstrap(self):
testargs = ["onionr.py", "togglebootstrap"]
self.assertTrue(config.get('general.use_bootstrap_list'))
2019-08-30 00:37:39 +00:00
with patch.object(sys, 'argv', testargs):
parser.register()
2019-12-29 17:21:18 +00:00
config.reload()
self.assertFalse(config.get('general.use_bootstrap_list'))
2019-08-30 00:37:39 +00:00
2019-09-13 02:22:25 +00:00
unittest.main()