示例#1
0
 def test_alias_default_location(self):
     aliases = {
         'one': ['two', 'three'],
         'three': ['four']
     }
     locations = Locations(defaults(distdefault=['one'], aliases=aliases))
     self.assertEqual(locations.get_default_location(), ['two', 'four'])
示例#2
0
 def test_alias_fan_out(self):
     aliases = {
         'one': ['two', 'three'],
         'two': ['four', 'five', 'six'],
         'five': ['seven', 'eight'],
     }
     locations = Locations(defaults(aliases=aliases))
     self.assertEqual(locations.get_location('one'), ['four', 'seven', 'eight', 'six', 'three'])
示例#3
0
 def test_check_empty_locations(self):
     locations = Locations(defaults)
     self.assertRaises(SystemExit, locations.check_empty_locations)
     self.assertRaises(SystemExit, locations.check_empty_locations, [])
     locations.extend(['foo'])
     locations.check_empty_locations()
     locations.check_empty_locations(['bar'])
     self.assertRaises(SystemExit, locations.check_empty_locations, [])
 def test_slash_before_colon(self):
     locations = Locations(defaults)
     self.assertEqual(locations.has_host('foo/bar:baz'), False)
 def test_no_colon(self):
     locations = Locations(defaults)
     self.assertEqual(locations.has_host('foo/bar/baz'), False)
 def test_slash(self):
     locations = Locations(defaults)
     self.assertEqual(locations.has_host('foo:bar/baz'), True)
示例#7
0
 def test_empty_default_location(self):
     locations = Locations(defaults)
     self.assertEqual(locations.get_default_location(), [])
示例#8
0
 def test_simple(self):
     locations = Locations(defaults)
     self.assertEqual(locations.join('foo:', 'bar'), 'foo:bar')
示例#9
0
 def test_no_colon(self):
     locations = Locations(defaults)
     self.assertEqual(locations.has_host('foo/bar/baz'), False)
示例#10
0
 def test_simple(self):
     locations = Locations(defaults)
     self.assertEqual(locations.has_host('foo:bar'), True)
示例#11
0
 def test_has_host(self):
     locations = Locations(defaults(distbase='jarn.com:eggs'))
     self.assertEqual(locations.get_location('jarn.com:foo'), ['jarn.com:foo'])
示例#12
0
 def test_empty(self):
     locations = Locations(defaults)
     self.assertEqual(locations.get_location(None), [])
     self.assertEqual(locations.get_location(''), [])
示例#13
0
 def test_simple(self):
     locations = Locations(defaults)
     self.assertEqual(locations.get_location('foo'), ['foo'])
示例#14
0
 def test_check_valid_locations(self):
     locations = Locations(defaults(servers={'pypi': None}))
     locations.check_valid_locations()
     locations.check_valid_locations([])
     locations.check_valid_locations(['pypi'])
     locations.check_valid_locations(['jarn.com:eggs'])
     locations.check_valid_locations(['sftp://jarn.com/home/stefan/eggs'])
     locations.check_valid_locations(['scp://jarn.com/home/stefan/eggs'])
     locations.extend(['foo'])
     self.assertRaises(SystemExit, locations.check_valid_locations)
     self.assertRaises(SystemExit, locations.check_valid_locations, ['bar'])
     self.assertRaises(SystemExit, locations.check_valid_locations, ['http://jarn.com'])
     self.assertRaises(SystemExit, locations.check_valid_locations, ['ssh://jarn.com'])
示例#15
0
 def test_multi_default_location(self):
     locations = Locations(defaults(distdefault=['foo', 'bar']))
     self.assertEqual(locations.get_default_location(), ['foo', 'bar'])
示例#16
0
 def test_simple(self):
     locations = Locations(defaults)
     self.assertEqual(locations.join('foo:', 'bar'), 'foo:bar')
示例#17
0
 def test_inserted_slash(self):
     locations = Locations(defaults)
     self.assertEqual(locations.join('foo:/bar', 'baz'), 'foo:/bar/baz')
示例#18
0
 def test_is_url(self):
     locations = Locations(defaults(distbase='jarn.com:eggs'))
     self.assertEqual(locations.get_location('http://jarn.com'), ['http://jarn.com'])
     self.assertEqual(locations.get_location('ssh://jarn.com'), ['ssh://jarn.com'])
示例#19
0
 def test_slash(self):
     locations = Locations(defaults)
     self.assertEqual(locations.has_host('foo:bar/baz'), True)
示例#20
0
 def test_is_server(self):
     locations = Locations(defaults(distbase='jarn.com:eggs', servers={'pypi': None}))
     self.assertEqual(locations.get_location('pypi'), ['pypi'])
示例#21
0
 def test_slash_before_colon(self):
     locations = Locations(defaults)
     self.assertEqual(locations.has_host('foo/bar:baz'), False)
示例#22
0
 def test_alias_recursive(self):
     locations = Locations(defaults(aliases={'foo': ['bar'], 'bar': ['baz']}))
     self.assertEqual(locations.get_location('foo'), ['baz'])
示例#23
0
 def test_inserted_slash(self):
     locations = Locations(defaults)
     self.assertEqual(locations.join('foo:/bar', 'baz'), 'foo:/bar/baz')
示例#24
0
 def test_simple(self):
     locations = Locations(defaults)
     self.assertEqual(locations.has_host('foo:bar'), True)