示例#1
0
文件: utiltest.py 项目: pombr/conary
 def testNormURL(self):
     urls = (('http://example.com//a/b/c', 'http://example.com/a/b/c'),
             ('http://example.com:123/a//b/', 'http://example.com:123/a/b/'),
             ('http://example.com/a//index.html', 'http://example.com/a/index.html'),
             ('http://example.com', 'http://example.com/'),
             ('http://example.com/', 'http://example.com/'),
             ('https://conary-commits.rpath.com:443//conary/?tmpuAq85R.ccs',
              'https://conary-commits.rpath.com:443/conary/?tmpuAq85R.ccs'))
     for input, expected in urls:
         self.assertEqual(util.normurl(input), expected)
示例#2
0
文件: utiltest.py 项目: sweptr/conary
 def testNormURL(self):
     urls = (('http://example.com//a/b/c', 'http://example.com/a/b/c'),
             ('http://example.com:123/a//b/', 'http://example.com:123/a/b/'),
             ('http://example.com/a//index.html', 'http://example.com/a/index.html'),
             ('http://example.com', 'http://example.com/'),
             ('http://example.com/', 'http://example.com/'),
             ('https://conary-commits.rpath.com:443//conary/?tmpuAq85R.ccs',
              'https://conary-commits.rpath.com:443/conary/?tmpuAq85R.ccs'))
     for input, expected in urls:
         self.assertEqual(util.normurl(input), expected)
示例#3
0
    def commitChangeSet(self, chgSet, callback = None, mirror = False,
                        hidden = False):
        trvCs = chgSet.iterNewTroveList().next()
        newLabel = trvCs.getNewVersion().trailingLabel()

        if not isinstance(self.c[newLabel], ShimServerProxy):
            return netclient.NetworkRepositoryClient.commitChangeSet(self,
                chgSet, callback = callback, mirror = False, hidden = False)

        (fd, path) = tempfile.mkstemp(dir = self.c[newLabel]._server.tmpPath,
                                      suffix = '.ccs-in')
        os.close(fd)
        chgSet.writeToFile(path)
        base = os.path.basename(path)[:-3]
        url = util.normurl(self.c[newLabel]._server.basicUrl) + "?" + base

        self.c[newLabel].commitChangeSet(url, mirror = mirror,
                                         hidden = hidden)