示例#1
0
 def test_get_path_automatically_installs(self):
     BOOTTOOL_DST = "/unittest/tmp/boottool"
     host = self.create_mock_host()
     loader = bootloader.Bootloader(host)
     # mock out loader.install_boottool
     mock_install = \
             self.create_install_boottool_mock(loader, BOOTTOOL_DST)
     # set up the recording
     mock_install.expect_call()
     # run the test
     self.assertEquals(loader._get_boottool_path(), BOOTTOOL_DST)
     self.god.check_playback()
示例#2
0
 def test_installs_to_tmpdir(self):
     TMPDIR = "/unittest/tmp"
     SERVERDIR = "/unittest/server"
     BOOTTOOL_SRC = os.path.join(SERVERDIR, bootloader.BOOTTOOL_SRC)
     BOOTTOOL_SRC = os.path.abspath(BOOTTOOL_SRC)
     BOOTTOOL_DST = os.path.join(TMPDIR, "boottool")
     # set up the recording
     host = self.create_mock_host()
     host.get_tmp_dir.expect_call().and_return(TMPDIR)
     utils.get_server_dir.expect_call().and_return(SERVERDIR)
     host.send_file.expect_call(BOOTTOOL_SRC, TMPDIR)
     # run the test
     loader = bootloader.Bootloader(host)
     loader._install_boottool()
     # assert the playback is correct
     self.god.check_playback()
     # assert the final dest is correct
     self.assertEquals(loader._boottool_path, BOOTTOOL_DST)
示例#3
0
 def test_install_fails_without_host(self):
     host = self.create_mock_host()
     loader = bootloader.Bootloader(host)
     del host
     self.assertRaises(error.AutoservError, loader._install_boottool)