示例#1
0
    def testpopulate_dir(self):
        fspath = self.root + '/'
        entry = GopherEntry('/', self.config)
        entry.populatefromfs('/')

        conditions = {
            'selector': '/',
            'config': self.config,
            'fspath': '/',
            'type': '1',
            'name': '',
            'host': None,
            'port': None,
            'mimetype': 'application/gopher-menu',
            'encodedmimetype': None,
            'encoding': None,
            'populated': 1,
            'language': None,
            'gopherpsupport': 1
        }

        self.assertEntryMatches(conditions, entry, "testpopulate_dir")
        self.assertEqual(
            entry.geteadict(),
            {'ABSTRACT': 'This is the abstract for the testdata directory.'})
示例#2
0
    def testpopulate_dir(self):
        entry = GopherEntry("/", self.config)
        entry.populatefromfs("/")

        conditions = {
            "selector": "/",
            "config": self.config,
            "fspath": "/",
            "type": "1",
            "name": "",
            "host": None,
            "port": None,
            "mimetype": "application/gopher-menu",
            "encodedmimetype": None,
            "encoding": None,
            "populated": 1,
            "language": None,
            "gopherpsupport": 1,
        }

        self.assertEntryMatches(conditions, entry, "testpopulate_dir")
        self.assertEqual(
            entry.geteadict(),
            {"ABSTRACT": "This is the abstract for the testdata directory."},
        )
示例#3
0
    def testpopulate_encoded(self):
        fspath = '/testfile.txt.gz'
        entry = GopherEntry('/testfile.txt.gz', self.config)
        entry.populatefromfs(fspath)

        self.assertEqual(entry.gettype(), '9')
        self.assertEqual(entry.getmimetype(), 'application/octet-stream')
        self.assertEqual(entry.getencoding(), 'gzip')
        self.assertEqual(entry.getencodedmimetype(), 'text/plain')
        self.assertEqual(entry.geteadict(),
                          {'ABSTRACT': "This is the abstract\nfor testfile.txt.gz"})
示例#4
0
    def testpopulate_encoded(self):
        fspath = "/testfile.txt.gz"
        entry = GopherEntry("/testfile.txt.gz", self.config)
        entry.populatefromfs(fspath)

        self.assertEqual(entry.gettype(), "9")
        self.assertEqual(entry.getmimetype(), "application/octet-stream")
        self.assertEqual(entry.getencoding(), "gzip")
        self.assertEqual(entry.getencodedmimetype(), "text/plain")
        self.assertEqual(
            entry.geteadict(),
            {"ABSTRACT": "This is the abstract\nfor testfile.txt.gz"},
        )