def setUp(self):
        self.fakeFile = FakeFile()
        self.patch(default, "_open", self.patchedOpen)
        self.hostsOption = self.mktemp()
        knownHostsFile = KnownHostsFile(FilePath(self.hostsOption))
        knownHostsFile.addHostKey("exists.example.com", Key.fromString(sampleKey))
        knownHostsFile.addHostKey("4.3.2.1", Key.fromString(sampleKey))
        knownHostsFile.save()
        self.fakeTransport = FakeObject()
        self.fakeTransport.factory = FakeObject()
        self.options = self.fakeTransport.factory.options = {
            'host': "exists.example.com",
            'known-hosts': self.hostsOption
            }
Patch 'open' in verifyHostKey.
dataset/ETHPy150Open kuri65536/python-for-android/python-modules/twisted/twisted/conch/test/test_knownhosts.py/DefaultAPITests.setUp