コード例 #1
0
class ConsumerExceptionHandlerTests(base.PulpClientTests):

    def setUp(self):
        super(ConsumerExceptionHandlerTests, self).setUp()

        self.handler = ConsumerExceptionHandler(self.prompt, self.config)

    def test_permission(self):
        """
        Tests a client-side error when the connection is rejected due to auth reasons.
        """

        # Test
        e = exceptions.PermissionsException()
        code = self.handler.handle_permission(e)

        # Verify
        self.assertEqual(code, exceptions.CODE_PERMISSIONS_EXCEPTION)
        self.assertTrue('Authentication' in self.recorder.lines[0])
        self.assertEqual(TAG_FAILURE, self.prompt.get_write_tags()[0])
        self.assertTrue('A valid' in self.recorder.lines[2]) # skip blank line
        self.assertEqual(TAG_PARAGRAPH, self.prompt.get_write_tags()[1])
コード例 #2
0
class ConsumerExceptionHandlerTests(base.PulpClientTests):
    def setUp(self):
        super(ConsumerExceptionHandlerTests, self).setUp()

        self.handler = ConsumerExceptionHandler(self.prompt, self.config)

    def test_permission(self):
        """
        Tests a client-side error when the connection is rejected due to auth reasons.
        """

        # Test
        response_body = auth_utils.generate_failure_response(
            auth_utils.CODE_FAILED)
        e = exceptions.PermissionsException(response_body)
        code = self.handler.handle_permission(e)

        # Verify
        self.assertEqual(code, exceptions.CODE_PERMISSIONS_EXCEPTION)
        self.assertTrue('Authentication' in self.recorder.lines[0])
        self.assertEqual(TAG_FAILURE, self.prompt.get_write_tags()[0])
        self.assertTrue('A valid' in self.recorder.lines[2])  # skip blank line
        self.assertEqual(TAG_PARAGRAPH, self.prompt.get_write_tags()[1])
コード例 #3
0
    def setUp(self):
        super(ConsumerExceptionHandlerTests, self).setUp()

        self.handler = ConsumerExceptionHandler(self.prompt, self.config)
コード例 #4
0
    def setUp(self):
        super(ConsumerExceptionHandlerTests, self).setUp()

        self.handler = ConsumerExceptionHandler(self.prompt, self.config)