예제 #1
0
 def test_barebox_run(self, target_with_fakeconsole, mocker):
     t = target_with_fakeconsole
     d = BareboxDriver(t, "barebox")
     d = t.get_driver(BareboxDriver)
     d.run = mocker.MagicMock(return_value=[['success'],[],0])
     res = d.run_check("test")
     assert res == ['success']
예제 #2
0
 def test_barebox_run_error(self, target_with_fakeconsole, mocker):
     t = target_with_fakeconsole
     d = BareboxDriver(t, "barebox")
     d = t.get_driver(BareboxDriver)
     d.run = mocker.MagicMock(return_value=[['error'],[],1])
     with pytest.raises(ExecutionError):
         res = d.run_check("test")
예제 #3
0
 def test_create(self):
     t = Target('dummy')
     cp = FakeConsoleDriver(t, "console")
     d = BareboxDriver(t, "barebox")
     assert (isinstance(d, BareboxDriver))
     assert (isinstance(d, CommandProtocol))
     assert (isinstance(d, LinuxBootProtocol))
예제 #4
0
def test_create_barebox(target):
    console = FakeConsoleDriver(target, "console")
    power = FakePowerDriver(target, "power")
    barebox = BareboxDriver(target, "barebox")
    shell = ShellDriver(target, "shell", prompt='root@dummy', login_prompt='login:'******'root')
    s = BareboxStrategy(target, "strategy")

    assert isinstance(s, Strategy)
    assert target.get_driver(BareboxStrategy) is s
    assert target.get_driver(Strategy) is s

    assert s.state is BindingState.bound