示例#1
0
 def setUp(self):
     super(TestCommand, self).setUp()
     # Build up a fake app
     self.fake_stdout = fakes.FakeStdout()
     self.fake_log = fakes.FakeLog()
     self.app = fakes.FakeApp(self.fake_stdout, self.fake_log)
     self.app.client_manager = fakes.FakeClientManager()
     self.app.options = fakes.FakeOptions()
    def test_validate_os_beta_command_enabled(self):
        cmd = FakeCommand(mock.Mock(), mock.Mock())
        cmd.app = mock.Mock()
        cmd.app.options = test_fakes.FakeOptions()

        # No exception is raised when enabled.
        cmd.app.options.os_beta_command = True
        cmd.validate_os_beta_command_enabled()

        cmd.app.options.os_beta_command = False
        self.assertRaises(exceptions.CommandError,
                          cmd.validate_os_beta_command_enabled)