Пример #1
0
 def parseOptions(cls):
     opts = ClientOptions()
     opts.parseOptions()
     url = opts["url"]
     host = opts["host"]
     cls.debug = bool(opts["debug"])
     cls.withBanner = not bool(opts["no-banner"])
     if host:
         cls.type = opts["type"]
         cls.selector = opts["selector"]
         cls.host = opts["host"]
         cls.port = opts["port"]
         cls.query = opts["query"]
     else:
         cls.type, cls.selector, cls.host, cls.port, cls.query = (
             utils.getClientParams(url))
Пример #2
0
 def parseOptions(cls):
     opts = ClientOptions()
     opts.parseOptions()
     url = opts["url"]
     host = opts["host"]
     cls.debug = bool(opts["debug"])
     cls.withBanner = not bool(opts["no-banner"])
     if host:
         cls.type = opts["type"]
         cls.selector = opts["selector"]
         cls.host = opts["host"]
         cls.port = opts["port"]
         cls.query = opts["query"]
     else:
         cls.type, cls.selector, cls.host, cls.port, cls.query = (
             utils.getClientParams(url))
Пример #3
0
 def test_getClientParamsNoURL(self):
     result = utils.getClientParams()
     expected = ('1', '/', 'sdf.lonestar.org', 70, '')
     self.assertEqual(result, expected)
Пример #4
0
 def test_getClientParamsWithSearchAndQuery(self):
     url = "gopher://hostname:9999/7?search text"
     result = utils.getClientParams(url)
     expected = ('7', '/', 'hostname', '9999', 'search text')
     self.assertEqual(result, expected)
Пример #5
0
 def test_getClientParamsWithoutItemType(self):
     url = "gopher://hostname:9999/path/to/a/file.txt"
     result = utils.getClientParams(url)
     expected = ('1', '/path/to/a/file.txt', 'hostname', '9999', '')
     self.assertEqual(result, expected)