Exemplo n.º 1
0
 def test1(self):
     "parse_uri2(''), parse_uri3('')"
     res = samutils.parse_uri2('')
     self.failUnlessEqual(res, ['', None],
                          "Expected ['', None], got %s" % res)
     res = samutils.parse_uri3('')
     self.failUnlessEqual(res, [None, '', None],
                          "Expected [None, '', None], got %s" % res)
Exemplo n.º 2
0
 def test1(self):
     "parse_uri2(''), parse_uri3('')"
     res = samutils.parse_uri2('')
     self.failUnlessEqual(res, ['', None],
                          "Expected ['', None], got %s" % res)
     res = samutils.parse_uri3('')
     self.failUnlessEqual(res, [None, '', None],
                          "Expected [None, '', None], got %s" % res)
Exemplo n.º 3
0
    def test2(self):
        "parse_uri2(valid_uri), parse_uri3(valid_uri)"
        proto = 'http://'; host = 'www.test.host'; port = '80'
        uri = '%s%s:%s' % (proto, host, port)

        res = samutils.parse_uri2(uri)
        self.failUnlessEqual(res, [host, port],
                             "Expected [%s, %s], got %s" % (host, port, res))
        res = samutils.parse_uri3(uri)
        self.failUnlessEqual(res, [proto, host, port],
                             "Expected [%s, %s, %s], got %s" % (proto, host,
                                                                port, res))
Exemplo n.º 4
0
    def test2(self):
        "parse_uri2(valid_uri), parse_uri3(valid_uri)"
        proto = 'http://'
        host = 'www.test.host'
        port = '80'
        uri = '%s%s:%s' % (proto, host, port)

        res = samutils.parse_uri2(uri)
        self.failUnlessEqual(res, [host, port],
                             "Expected [%s, %s], got %s" % (host, port, res))
        res = samutils.parse_uri3(uri)
        self.failUnlessEqual(
            res, [proto, host, port],
            "Expected [%s, %s, %s], got %s" % (proto, host, port, res))
Exemplo n.º 5
0
 def test5ValidAndFakeEndpoints(self):
     'Get working LDAP as IP address - valid and fake LDAP endpoints.'
     for b in [True, False]:
         gridutils.LDAP_LIB = b
         try:
             ldap_ip = gridutils.get_working_ldap(
                 ['fake.bdii.host:2170', 'ldap://lcg-bdii.cern.ch:2170'])
         except Exception, e:
             self.fail('Failed with: %s' % str(e))
         ip, _ = samutils.parse_uri2(ldap_ip)
         try:
             socket.inet_aton(ip)
         except socket.error:
             self.fail('Not an IP address returned by '+\
                             'gridutils.get_working_ldap().')