remove first run prompt - fix tests
remove first run prompt, default to generate certs fix tests
This commit is contained in:
parent
d5db3b696c
commit
6b2ed31c9e
3 changed files with 20 additions and 42 deletions
|
|
@ -41,7 +41,7 @@ async def test_start_stop():
|
|||
await asyncio.sleep(0.1)
|
||||
l.check_present(("bumper", "INFO", "Starting Bumper"))
|
||||
l.clear()
|
||||
assert b.shutting_down == False
|
||||
|
||||
asyncio.create_task(b.shutdown())
|
||||
await asyncio.sleep(0.1)
|
||||
l.check_present(
|
||||
|
|
|
|||
|
|
@ -13,29 +13,10 @@ from testfixtures import LogCapture
|
|||
import sys
|
||||
|
||||
|
||||
@patch("bumper.firstrun_input")
|
||||
@patch("bumper.create_certs")
|
||||
def test_firstrun(mock_input, mock_create):
|
||||
with LogCapture() as l:
|
||||
|
||||
bumper.firstrun_input.return_value = "n"
|
||||
bumper.first_run()
|
||||
l.check_present(
|
||||
(
|
||||
"root",
|
||||
"CRITICAL",
|
||||
"Can't continue without certificates, please create some then try again.",
|
||||
)
|
||||
)
|
||||
|
||||
bumper.firstrun_input.return_value = "y"
|
||||
bumper.first_run()
|
||||
assert mock_create.called == True
|
||||
|
||||
|
||||
def mock_subrun(*args):
|
||||
return args
|
||||
|
||||
|
||||
@patch("bumper.start")
|
||||
def test_argparse(mock_start):
|
||||
bumper.ca_cert = "tests/test_certs/ca.crt"
|
||||
|
|
@ -70,23 +51,35 @@ def test_createcert(mock_run, mock_platform, mock_machine, mock_exec):
|
|||
platform.system.return_value = "darwin"
|
||||
bumper.create_certs()
|
||||
assert mock_run.called == True
|
||||
assert os.path.join("..", "create_certs", "create_certs_osx") in mock_exec.call_args.args[0]
|
||||
assert (
|
||||
os.path.join("..", "create_certs", "create_certs_osx")
|
||||
in mock_exec.call_args.args[0]
|
||||
)
|
||||
|
||||
platform.system.return_value = "windows"
|
||||
bumper.create_certs()
|
||||
assert mock_run.called == True
|
||||
assert os.path.join("..", "create_certs", "create_certs_windows.exe") in mock_exec.call_args.args[0]
|
||||
assert (
|
||||
os.path.join("..", "create_certs", "create_certs_windows.exe")
|
||||
in mock_exec.call_args.args[0]
|
||||
)
|
||||
|
||||
platform.system.return_value = "linux"
|
||||
bumper.create_certs()
|
||||
assert mock_run.called == True
|
||||
assert os.path.join("..", "create_certs","create_certs_linux") in mock_exec.call_args.args[0]
|
||||
assert (
|
||||
os.path.join("..", "create_certs", "create_certs_linux")
|
||||
in mock_exec.call_args.args[0]
|
||||
)
|
||||
|
||||
platform.system.return_value = "linux"
|
||||
platform.machine.return_value = "arm"
|
||||
bumper.create_certs()
|
||||
assert mock_run.called == True
|
||||
assert os.path.join("..", "create_certs", "create_certs_rpi") in mock_exec.call_args.args[0]
|
||||
assert (
|
||||
os.path.join("..", "create_certs", "create_certs_rpi")
|
||||
in mock_exec.call_args.args[0]
|
||||
)
|
||||
|
||||
with LogCapture() as l:
|
||||
platform.system.return_value = "nixbad"
|
||||
|
|
@ -101,7 +94,6 @@ def test_createcert(mock_run, mock_platform, mock_machine, mock_exec):
|
|||
)
|
||||
|
||||
|
||||
|
||||
@patch("bumper.first_run")
|
||||
def test_main(mock_firstrun):
|
||||
bumper.ca_cert = "sf"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue