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'>

test_app.py

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
import app.py

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

            return klein_app.app.execute_endpoint(func, request, **kwargs)
    test_01(self):
            resp = yield self.post('someapi', data={}, headers={'someheader': 'some_value'})

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

app.py

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

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