def test_checkKeyAsRoot(self):
        keyFile = self.sshDir.child("authorized_keys")
        keyFile.setContent(self.content)
        # Fake permission error by changing the mode
        keyFile.chmod(0000)
        self.addCleanup(keyFile.chmod, 0777)
        # And restore the right mode when seteuid is called
        savedSeteuid = self.mockos.seteuid
        def seteuid(euid):
            keyFile.chmod(0777)
            return savedSeteuid(euid)
        self.mockos.euid = 2345
        self.mockos.egid = 1234
        self.patch(self.mockos, "seteuid", seteuid)
        self.patch(checkers, 'os', self.mockos)
        self.patch(util, 'os', self.mockos)
        user = UsernamePassword("user", "password")
        user.blob = "foobar"
        self.assertTrue(self.checker.checkKey(user))
        self.assertEqual(self.mockos.seteuidCalls, [0, 1, 0, 2345])
        self.assertEqual(self.mockos.setegidCalls, [2, 1234])
Download poety from all the given sockets.
dataset/ETHPy150Open nlloyd/SubliminalCollaborator/libs/twisted/conch/test/test_checkers.py/SSHPublicKeyDatabaseTestCase.test_checkKeyAsRoot--crossover with--dataset/ETHPy150Open jdavisp3/twisted-intro/async-client/get-poetry.py/get_poetry