def _verifyWithBody(self, body, response):
        problems = []

        if self.code != response.code:
            problems.append(
                "response code: %r != %r" % (self.code, response.code))

        for name, expected in self.headers.getAllRawHeaders():
            received = response.headers.getRawHeaders(name)
            if expected != received:
                problems.append(
                    "header %r: %r != %r" % (name, expected, received))

        if self.body != body:
            problems.append("body: %r != %r" % (self.body, body))

        if problems:
            raise Exception("\n    ".join([""] + problems))
Do the actual comparison.
dataset/ETHPy150Open ClusterHQ/flocker/flocker/restapi/testtools.py/CloseEnoughResponse._verifyWithBody