25
import provisioningserver.boot.install_bootloader
26
25
from provisioningserver.boot.install_bootloader import (
27
26
install_bootloader,
30
from provisioningserver.boot.tftppath import locate_tftp_path
31
from provisioningserver.testing.config import set_tftp_root
32
from provisioningserver.utils import MainScript
33
29
from testtools.matchers import (
40
35
class TestInstallBootloader(MAASTestCase):
42
37
def test_integration(self):
43
tftproot = self.make_dir()
44
config_fixture = self.useFixture(set_tftp_root(tftproot))
46
loader = self.make_file()
48
action = factory.make_name("action")
49
script = MainScript(action)
50
script.register(action, provisioningserver.boot.install_bootloader)
52
("--config-file", config_fixture.filename, action,
55
bootloader_filename = os.path.basename(loader)
58
bootloader_filename, tftproot=tftproot),
38
loader_contents = factory.getRandomString()
39
loader = self.make_file(contents=loader_contents)
40
destination = self.make_file()
41
install_bootloader(loader, destination)
42
self.assertThat(destination, FileContains(loader_contents))
61
44
def test_make_destination_creates_directory_if_not_present(self):
62
45
tftproot = self.make_dir()