Beispiel #1
0
    def setUp(self):
        super(TestCliCommand, self).setUp()
        self.cc = self.command_class()
        # neuter the _do_command, since this is mostly
        # for testing arg parsing
        self._orig_do_command = self.cc._do_command
        self.cc._do_command = self._do_command
        #        self.cc.assert_should_be_registered = self._asert_should_be_registered

        self.mock_stdout = MockStderr()
        self.mock_stderr = MockStderr()
        sys.stderr = self.mock_stderr
    def test_consumerid_with_distributor_id(self):
        def get_consumer(self, *args, **kwargs):
            pass

        StubUEP.getConsumer = get_consumer
        connection.UEPConnection = StubUEP
        self._inject_mock_invalid_consumer()
        cmd = RegisterCommand()
        connection.UEPConnection.getConsumer = Mock(return_value={
            'uuid': '123123',
            'type': {
                'manifest': True
            }
        })
        self._inject_ipm()
        sys.stderr = MockStderr()

        try:
            cmd.main([
                'register', '--consumerid=TaylorSwift', '--username=testuser1',
                '--password=password', '--org=test_org'
            ])
            self.fail("No Exception Raised")
        except SystemExit, e:
            self.assertEquals(e.code, os.EX_USAGE)
Beispiel #3
0
    def setUp(self):
        self.cc = self.command_class(ent_dir=StubEntitlementDirectory([]),
                                     prod_dir=StubProductDirectory([]))
        # neuter the _do_command, since this is mostly
        # for testing arg parsing
        self.cc._do_command = self._do_command
        self.cc.assert_should_be_registered = self._asert_should_be_registered

        # stub out uep
        managercli.connection.UEPConnection = self._uep_connection
        sys.stdout = MockStdout()
        sys.stderr = MockStderr()
    def setUp(self):
        SubManFixture.setUp(self)
        self.cc = self.command_class()
        # neuter the _do_command, since this is mostly
        # for testing arg parsing
        self._orig_do_command = self.cc._do_command
        self.cc._do_command = self._do_command
        self.cc.assert_should_be_registered = self._asert_should_be_registered

        # stub out uep
        managercli.connection.UEPConnection = self._uep_connection
        self.mock_stdout = MockStdout()
        self.mock_stderr = MockStderr()
        sys.stdout = self.mock_stdout
        sys.stderr = self.mock_stderr
    def test_cat_manifest(self):
        catman = CatManifestCommand()
        catman.args = [_build_valid_manifest()]

        mock_out = MockStdout()
        mock_err = MockStderr()
        sys.stdout = mock_out
        sys.stderr = mock_err

        catman._do_command()

        self.assertEquals("", mock_err.buffer)
        self.assert_string_equals(manifestdata.correct_manifest_output, mock_out.buffer)

        sys.stdout = sys.__stdout__
        sys.stderr = sys.__stderr__
 def setUp(self):
     super(CatCertCommandTests, self).setUp()
     self.mock_stdout = MockStdout()
     self.mock_stderr = MockStderr()
     sys.stdout = self.mock_stdout
     sys.stderr = self.mock_stderr
 def setUp(self):
     self.msg = "some thing to log home about"
     self.formatted_msg = "some thing else like: %s"
     sys.stderr = MockStderr()
     sys.stdout = MockStdout()
     managercli.log = FakeLogger()
 def setUp(self):
     sys.stderr = MockStderr()
Beispiel #9
0
 def setUp(self):
     self._setupLang("ja_JP.UTF-8")
     sys.stderr = MockStderr()
Beispiel #10
0
 def setUp(self):
     self.mock_stdout = MockStdout()
     self.mock_stderr = MockStderr()
     sys.stdout = self.mock_stdout
     sys.stderr = self.mock_stderr