File: testvfs.py

package info (click to toggle)
gnome-python 2.28.1%2Bdfsg-1.1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 3,288 kB
  • ctags: 1,032
  • sloc: sh: 10,219; ansic: 7,997; xml: 2,464; python: 1,886; makefile: 394
file content (24 lines) | stat: -rw-r--r-- 696 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import unittest
import pygtk; pygtk.require("2.0")
import common
import tempfile
from common import gnomevfs

class VfsTest(unittest.TestCase):
    def testUri(self):
        uri=gnomevfs.URI("http://www.gnome.org/index.html")
        self.assertEqual(uri.scheme, "http")
        self.assertEqual(uri.host_name, "www.gnome.org")
        self.assertEqual(uri.short_name, "index.html")

    def testRead(self):
        tmpfile = tempfile.NamedTemporaryFile()
        written = "Tristitia"
        tmpfile.write(written)
        tmpfile.flush()
        read = gnomevfs.read_entire_file("file:" + tmpfile.name)
        self.assertEqual(read, written)


if __name__ == '__main__':
    unittest.main()