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)
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)