Mocking twisted.web.http_headers.Headers responseHeaders not working

Solution for Mocking twisted.web.http_headers.Headers responseHeaders not working
is Given Below:

I am trying to mock headers of an incoming twisted.web.http request using mock but it looks like the headers are not getting mocked instead mock returns an object. for example <MagicMock name="mock.responseHeaders.getHeader()" id='130005618999994'>

from __future__ import absolute_import
import mock
import simplejson
from twisted.internet import defer
from twisted.trial import unittest
from twisted.web.http_headers import Headers
import klein_app

class AppTest(unittest.TestCase):
    def post(self, func, data={}, headers={}, **kwargs):
            request = mock.MagicMock()
            request.method = b'POST'
            request.responseHeaders.return_value = Headers(headers)
   = simplejson.dumps(data, namedtuple_as_object=True)

            return, request, **kwargs)
            resp = yield'someapi', data={}, headers={'someheader': 'some_value'})

            self.assertEquals(resp.status_code, 201)
            self.assertEquals(somefunction.call_args[1]['a'], 'some_value')

def api_call():
    // make the api call
    if request.responseHeaders.hasHeader('someheader'):
        some_value = request.responseHeaders.getHeader('someheader')

Can someone please suggest a good way to mock request.responseHeaders.getHeader()