/usr/lib/python2.7/dist-packages/pygopherd/pipeTest.py is in pygopherd 2.0.18.5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | import unittest, os
from pygopherd import pipe, testutil
class PipeTestCase(unittest.TestCase):
def setUp(self):
self.config = testutil.getconfig()
self.root = self.config.get("pygopherd", "root")
self.testdata = self.root + "/pygopherd/pipetestdata"
self.testprog = self.root + "/pygopherd/pipetest.sh"
def testWorkingPipe(self):
outputfd = os.tmpfile()
inputfd = open(self.testdata, "rt")
retval = pipe.pipedata(self.testprog, [self.testprog],
childstdin = inputfd,
childstdout = outputfd)
outputfd.seek(0)
self.assertEquals(outputfd.read(),
"Starting\nGot [Word1]\nGot [Word2]\nGot [Word3]\nEnding\n")
self.assert_(os.WIFEXITED(retval), "WIFEXITED was not true")
self.assertEquals(os.WEXITSTATUS(retval), 0)
self.assertEquals(retval, 0)
outputfd.close()
def testFailingPipe(self):
outputfd = os.tmpfile()
|