1
# Copyright 2012 Canonical Ltd. This software is licensed under the
2
# GNU Affero General Public License version 3 (see the file LICENSE).
4
"""Integration-test the `maascli` command."""
6
from __future__ import (
16
from subprocess import (
21
from maastesting.testcase import TestCase
24
def locate_dev_root():
25
"""Root of development tree that this test is in."""
27
os.path.dirname(__file__), os.pardir, os.pardir, os.pardir)
31
return os.path.join(locate_dev_root(), 'bin', 'maascli')
34
class TestMAASCli(TestCase):
36
def run_command(self, *args):
37
with open('/dev/null', 'ab') as dev_null:
39
[locate_maascli()] + list(args),
40
stdout=dev_null, stderr=dev_null)
42
def test_run_without_args_fails(self):
43
self.assertRaises(CalledProcessError, self.run_command)
45
def test_help_option_succeeds(self):
46
self.run_command('-h')
47
# The test is that we get here without error.
50
def test_list_command_succeeds(self):
51
self.run_command('list')
52
# The test is that we get here without error.