~lutostag/ubuntu/trusty/maas/1.5.2+packagefix

« back to all changes in this revision

Viewing changes to src/provisioningserver/boot/tests/test_install_grub.py

  • Committer: Package Import Robot
  • Author(s): Andres Rodriguez
  • Date: 2014-03-28 10:43:53 UTC
  • mto: This revision was merged to the branch mainline in revision 57.
  • Revision ID: package-import@ubuntu.com-20140328104353-ekpolg0pm5xnvq2s
Tags: upstream-1.5+bzr2204
ImportĀ upstreamĀ versionĀ 1.5+bzr2204

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright 2014 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 install_grub command."""
 
5
 
 
6
from __future__ import (
 
7
    absolute_import,
 
8
    print_function,
 
9
    unicode_literals,
 
10
    )
 
11
 
 
12
str = None
 
13
 
 
14
__metaclass__ = type
 
15
__all__ = []
 
16
 
 
17
import os.path
 
18
 
 
19
from maastesting.factory import factory
 
20
from maastesting.testcase import MAASTestCase
 
21
import provisioningserver.boot.install_grub
 
22
from provisioningserver.boot.tftppath import locate_tftp_path
 
23
from provisioningserver.testing.config import set_tftp_root
 
24
from provisioningserver.utils import MainScript
 
25
from testtools.matchers import FileExists
 
26
 
 
27
 
 
28
class TestInstallGrub(MAASTestCase):
 
29
 
 
30
    def test_integration(self):
 
31
        tftproot = self.make_dir()
 
32
        config_fixture = self.useFixture(set_tftp_root(tftproot))
 
33
 
 
34
        action = factory.make_name("action")
 
35
        script = MainScript(action)
 
36
        script.register(action, provisioningserver.boot.install_grub)
 
37
        script.execute(
 
38
            ("--config-file", config_fixture.filename, action))
 
39
 
 
40
        config_filename = os.path.join('grub', 'grub.cfg')
 
41
        self.assertThat(
 
42
            locate_tftp_path(
 
43
                config_filename, tftproot=tftproot),
 
44
            FileExists())