~ubuntu-branches/ubuntu/raring/maas/raring-proposed

« back to all changes in this revision

Viewing changes to src/maasserver/tests/test_commands_generate_enlistment_pxe.py

  • Committer: Package Import Robot
  • Author(s): Andres Rodriguez
  • Date: 2012-07-17 08:28:36 UTC
  • mfrom: (1.1.16)
  • Revision ID: package-import@ubuntu.com-20120717082836-ucb2vou8tqg353eq
Tags: 0.1+bzr777+dfsg-0ubuntu1
* New upstream release
* Only run 'maas' command as root. (LP: #974046)
  - debian/extras/maas: Check id.
  - debian/maas.install: Install in 'sbin'.
* debian/maas.postinst:
  - restart apache2 after everything gets processed.
  - Update version to handle upgrades.
* debian/extras/maas-provision: Add wrapper to access 'maasprovisiong'
  command line.
* debian/patches/99_temporary_fix_path.patch: Dropped. No longer needed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright 2012 Canonical Ltd.  This software is licensed under the
2
 
# GNU Affero General Public License version 3 (see the file LICENSE).
3
 
 
4
 
"""Tests for the generate-enlistment-pxe command."""
5
 
 
6
 
from __future__ import (
7
 
    absolute_import,
8
 
    print_function,
9
 
    unicode_literals,
10
 
    )
11
 
 
12
 
__metaclass__ = type
13
 
__all__ = []
14
 
 
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 (
21
 
    compose_config_path,
22
 
    compose_image_path,
23
 
    locate_tftp_path,
24
 
    )
25
 
from testtools.matchers import (
26
 
    Contains,
27
 
    FileContains,
28
 
    )
29
 
 
30
 
 
31
 
class TestGenerateEnlistmentPXE(TestCase):
32
 
 
33
 
    def test_generates_default_pxe_config(self):
34
 
        arch = factory.getRandomChoice(ARCHITECTURE_CHOICES)
35
 
        subarch = 'generic'
36
 
        release = 'precise'
37
 
        tftproot = self.make_dir()
38
 
        self.patch(PXEConfig, 'target_basedir', tftproot)
39
 
        call_command(
40
 
            'generate_enlistment_pxe', arch=arch, release=release,
41
 
            tftproot=tftproot)
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'),
47
 
            tftproot=tftproot)
48
 
        self.assertThat(
49
 
            result_path,
50
 
            FileContains(matcher=Contains(
51
 
                compose_image_path(arch, subarch, release, 'install') +
52
 
                    '/linux')))