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 `maascli.cli`."""
6
from __future__ import (
15
from maascli import cli
16
from maascli.parser import ArgumentParser
17
from maastesting.testcase import TestCase
20
class TestRegisterCLICommands(TestCase):
21
"""Tests for `register_cli_commands`."""
23
def test_registers_subparsers(self):
24
parser = ArgumentParser()
25
self.assertIsNone(parser._subparsers)
26
cli.register_cli_commands(parser)
27
self.assertIsNotNone(parser._subparsers)
29
def test_subparsers_have_appropriate_execute_defaults(self):
30
parser = ArgumentParser()
31
cli.register_cli_commands(parser)
32
self.assertIsInstance(
33
parser.subparsers.choices['login'].get_default('execute'),