Example #1
0
  def testMainNoCmd(self):
    self.CreateBootstrap('1.2.3')
    self.CreateWorkspace('1.2.3')
    self.mock_workspace_path.return_value = None
    self.mock_repo_root.return_value = None

    with self.assertRaises(cros_build_lib.DieSystemExit):
      brillo.main(['flash', '--help'])

    self.assertEqual([], self.mock_exec.call_args_list)
Example #2
0
  def testMainSdkCmd(self):
    self.CreateBootstrap('1.2.3')
    self.CreateWorkspace('1.2.3')
    self.mock_workspace_path.return_value = None
    self.mock_repo_root.return_value = None

    brillo.main(['sdk', '--help'])

    expected_cmd = os.path.join(self.bootstrap_path, 'bin/brillo')

    self.assertEqual(
        [mock.call(expected_cmd, [expected_cmd, 'sdk', '--help'])],
        self.mock_exec.call_args_list)
Example #3
0
  def testMainInRepo(self):
    self.CreateBootstrap('1.2.3')
    self.CreateWorkspace('1.2.3')
    self.mock_workspace_path.return_value = None
    self.mock_repo_root.return_value = '/repo'

    brillo.main(['flash', '--help'])

    expected_cmd = '/repo/chromite/bin/brillo'

    self.assertEqual(
        [mock.call(expected_cmd, [expected_cmd, 'flash', '--help'])],
        self.mock_exec.call_args_list)
Example #4
0
  def testMainInActiveWorkspace(self):
    self.CreateBootstrap('1.2.3')
    self.CreateWorkspace('1.2.3')
    self.mock_repo_root.return_value = None

    brillo.main(['flash', '--help'])

    expected_cmd = os.path.join(
        self.bootstrap_path, 'sdk_checkouts/1.2.3/chromite/bin/brillo')

    self.assertEqual(
        [mock.call(expected_cmd, [expected_cmd, 'flash', '--help'])],
        self.mock_exec.call_args_list)