<div dir="ltr"><div><div>Hi,<br><br><br></div>I&#39;m trying to create a mock wrapper around a requests Response object, so that I can check the calls to both methods and attributes, while still using the underlying Response object.<br><br></div>However I&#39;m struggling to ensure that access of a custom dict class that is an attribute of the Response object works as expected and I&#39;m wondering if I&#39;m missing something or perhaps mock doesn&#39;t support my desired usage?<br><div><br>see <a href="https://gist.github.com/electrofelix/40f4c38cf28bb701dba3">https://gist.github.com/electrofelix/40f4c38cf28bb701dba3</a> for an example with some asserts that ideally should work but fails in membership tests.<br><div><br></div><div>The Response object headers attribute, is of type CaseInsensitiveDict, but there doesn&#39;t seem to be an easy way to wrap that object so that various tests for membership against the mock will work as expected. Though certain key access works correctly.<br></div><div><br><br></div><div>My first assumption is I&#39;m doing something wrong, but it might just be a bug or missing desirable behaviour?<br clear="all"></div><div><div><br>-- <br><div>Darragh Bailey<br>&quot;Nothing is foolproof to a sufficiently talented fool&quot;</div>
</div></div></div></div>