1
# Copyright 2012 Canonical Ltd. This software is licensed under the
2
# GNU Affero General Public License version 3 (see the file LICENSE).
4
"""Tests for the generate-enlistment-pxe command."""
6
from __future__ import (
15
from django.core.management import call_command
16
from maasserver.enum import ARCHITECTURE_CHOICES
17
from maasserver.testing.factory import factory
18
from maasserver.testing.testcase import TestCase
19
from provisioningserver.pxe.pxeconfig import PXEConfig
20
from provisioningserver.pxe.tftppath import (
25
from testtools.matchers import (
31
class TestGenerateEnlistmentPXE(TestCase):
33
def test_generates_default_pxe_config(self):
34
arch = factory.getRandomChoice(ARCHITECTURE_CHOICES)
37
tftproot = self.make_dir()
38
self.patch(PXEConfig, 'target_basedir', tftproot)
40
'generate_enlistment_pxe', arch=arch, release=release,
42
# This produces a "default" PXE config file in the right place.
43
# It refers to the kernel and initrd for the requested
44
# architecture and release.
45
result_path = locate_tftp_path(
46
compose_config_path(arch, subarch, 'default'),
50
FileContains(matcher=Contains(
51
compose_image_path(arch, subarch, release, 'install') +