Example #1
0
    def _get_credentials(self, method_frame):
        """Get credentials for authentication.

        :param pika.frame.MethodFrame method_frame: The Connection.Start frame
        :rtype: tuple(str, str)

        """
        (auth_type,
         response) = self.params.credentials.response_for(method_frame.method)
        if not auth_type:
            raise exceptions.AuthenticationError(self.params.credentials.TYPE)
        self.params.credentials.erase_credentials()
        return auth_type, response
Example #2
0
 def test_authentication_error_repr(self):
     self.assertEqual(
         repr(exceptions.AuthenticationError('PLAIN')),
         'AuthenticationError: Server and client could not negotiate use of '
         'the PLAIN authentication mechanism')