summaryrefslogtreecommitdiff
path: root/cli/command_unittest.py
diff options
context:
space:
mode:
authorDavid Pursell <dpursell@chromium.org>2015-07-08 10:48:41 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-07-10 23:12:41 +0000
commitc7ba784494867f7fd4df44a556b2c8f80d90def4 (patch)
tree35f9d15bf3bc2bf22b498986c86ea6be5399f538 /cli/command_unittest.py
parentbfb3353ec5f07b2abaf44eb39e44b4f2b482c532 (diff)
downloadchromite-c7ba784494867f7fd4df44a556b2c8f80d90def4.tar.gz
chromite: Remove GetToolset() function.
GetToolset() was used to switch functionality between `cros` and `brillo`, so is no longer needed. BUG=chromium:507323 TEST=cbuildbot/run_tests TEST=cros --help Change-Id: I652d4e5a2abcf3e318bc0233ae3c53b6b2fd29fb Reviewed-on: https://chromium-review.googlesource.com/284169 Reviewed-by: David Pursell <dpursell@chromium.org> Tested-by: David Pursell <dpursell@chromium.org> Commit-Queue: David Pursell <dpursell@chromium.org>
Diffstat (limited to 'cli/command_unittest.py')
-rw-r--r--cli/command_unittest.py20
1 files changed, 9 insertions, 11 deletions
diff --git a/cli/command_unittest.py b/cli/command_unittest.py
index 9b1ef174e..33c072567 100644
--- a/cli/command_unittest.py
+++ b/cli/command_unittest.py
@@ -10,6 +10,7 @@ import argparse
import glob
import os
+from chromite.cbuildbot import constants
from chromite.cli import command
from chromite.lib import commandline
from chromite.lib import cros_build_lib_unittest
@@ -61,15 +62,12 @@ class TestCommandTest(cros_test_lib.MockTestCase):
else:
self.fail('Invalid command was accepted by the CommandDecorator')
- def testCrosAddDeviceArgument(self):
- """Tests CliCommand.AddDeviceArgument() for `cros`."""
- self.PatchObject(command, 'GetToolset', return_value='cros')
+ def testAddDeviceArgument(self):
+ """Tests CliCommand.AddDeviceArgument()."""
parser = argparse.ArgumentParser()
command.CliCommand.AddDeviceArgument(parser)
- # cros should have a positional device argument.
+ # Device should be a positional argument.
parser.parse_args(['device'])
- with self.assertRaises(SystemExit):
- parser.parse_args(['--device', 'device'])
class MockCommand(partial_mock.PartialMock):
@@ -112,25 +110,25 @@ class CommandTest(cros_test_lib.MockTestCase):
self.PatchObject(glob, 'glob',
return_value=[fake_command_file, filtered_file])
- self.assertEqual(command._FindModules(mydir, 'cros'), [fake_command_file])
+ self.assertEqual(command._FindModules(mydir), [fake_command_file])
def testLoadCommands(self):
"""Tests import commands correctly."""
fake_module = 'cros_command_test'
- fake_command_file = '%s.py' % fake_module
- module_path = ('chromite', 'cli', 'cros', fake_module)
+ fake_command_file = os.path.join(constants.CHROMITE_DIR, 'foo', fake_module)
+ module_path = ['chromite', 'foo', fake_module]
self.PatchObject(command, '_FindModules', return_value=[fake_command_file])
# The code doesn't use the return value, so stub it out lazy-like.
load_mock = self.PatchObject(cros_import, 'ImportModule', return_value=None)
- command._ImportCommands('cros')
+ command._ImportCommands()
load_mock.assert_called_with(module_path)
def testListCrosCommands(self):
"""Tests we get a sane `cros` list back."""
- cros_commands = command.ListCommands('cros')
+ cros_commands = command.ListCommands()
# Pick some commands that are likely to not go away.
self.assertIn('chrome-sdk', cros_commands)
self.assertIn('flash', cros_commands)