示例#1
0
 def testLocalhostExpandUser(self):
     urlparser = URLParser()
     logname = os.environ.get('LOGNAME')
     home = os.environ.get('HOME')
     self.assertEqual(
         urlparser.abspath('file://localhost/~%s/public' % logname),
         'file://localhost%s/public' % home)
示例#2
0
 def testIdempotence(self):
     urlparser = URLParser()
     self.assertEqual(
         urlparser.to_ssh_url('[email protected]:var/dist/public'),
         '[email protected]:var/dist/public')
     self.assertEqual(
         urlparser.to_ssh_url('[email protected]:/var/dist/public'),
         '[email protected]:/var/dist/public')
示例#3
0
 def testSlashBeforeColon(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.is_ssh_url('/foo:'), False)
示例#4
0
 def testFileUrl(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.is_url('file://'), True)
示例#5
0
 def testLocalhostExpandUser(self):
     urlparser = URLParser()
     logname = os.environ.get('LOGNAME')
     home = os.environ.get('HOME')
     self.assertEqual(urlparser.abspath('file://localhost/~%s/public' % logname),
                      'file://localhost%s/public' % home)
示例#6
0
 def testWhitespace(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.is_url(' http://'), False)
示例#7
0
 def testLocalhostWithTilde(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.is_url('file://localhost/~stefan/public'), True)
示例#8
0
 def testGitUrl(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.is_url('git://'), True)
示例#9
0
 def testSvn(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.is_url('svn://jarn.com/public'), True)
示例#10
0
 def testSftp(self):
     urlparser = URLParser()
     self.assertEqual(
         urlparser.to_ssh_url('sftp://[email protected]/var/dist/public'),
         '[email protected]:/var/dist/public')
示例#11
0
 def testWhitespace(self):
     urlparser = URLParser()
     self.assertEqual(
         urlparser.is_ssh_url(' [email protected]:Jarn/jarn.mkrelease'), False)
示例#12
0
 def testBadUrl(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.is_ssh_url('ssh'), False)
示例#13
0
 def testNonConsecutive(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.is_ssh_url('f o:'), False)
示例#14
0
 def testNonAlphanumeric(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.is_ssh_url('$&%:'), True)
示例#15
0
 def testColonOnly(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.is_ssh_url(':'), False)
示例#16
0
 def testSplitLocalhostWithTilde(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.split('file://localhost/~stefan/public'),
                      ('file', '', 'localhost', '/~stefan/public', '', ''))
示例#17
0
 def testSplitUnsupported(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.split('ftp://jarn.com/public'),
                      ('ftp', '', 'jarn.com', '/public', '', ''))
示例#18
0
 def testBadUrl(self):
     urlparser = URLParser()
     self.assertEqual(
         urlparser.to_ssh_url('https://[email protected]/var/dist/public'),
         'https://[email protected]/var/dist/public')
示例#19
0
 def testRsync(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.is_url('rsync://jarn.com/public'), True)
示例#20
0
 def testHttpsUrl(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.is_url('https://'), True)
示例#21
0
 def testRelativeFile(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.is_url('file:var/dist/public'), True)
示例#22
0
 def testWhitespace(self):
     urlparser = URLParser()
     self.assertEqual(
         urlparser.to_ssh_url(' ssh://[email protected]/var/dist/public'),
         ' ssh://[email protected]/var/dist/public')
示例#23
0
 def testUnsupported(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.is_url('ftp://jarn.com/public'), True)
示例#24
0
 def testEmptyString(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.to_ssh_url(''), '')
示例#25
0
 def testRelativeFile(self):
     urlparser = URLParser()
     cwd = os.getcwd()
     self.assertEqual(urlparser.abspath('file:var/dist/public'),
                      'file://%s/var/dist/public' % cwd)
示例#26
0
 def testRelativeFile(self):
     urlparser = URLParser()
     cwd = os.getcwd()
     self.assertEqual(urlparser.abspath('file:var/dist/public'),
                      'file://%s/var/dist/public' % cwd)
示例#27
0
 def testSshUrl(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.is_url('ssh://'), True)
示例#28
0
 def testLocalhost(self):
     urlparser = URLParser()
     cwd = os.getcwd()
     self.assertEqual(
         urlparser.abspath('file://localhost%s/var/dist/public' % cwd),
         'file://localhost%s/var/dist/public' % cwd)
示例#29
0
 def testBadScheme(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.is_url('ftp//'), False)
示例#30
0
 def testFileUrl(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.is_url('file://'), True)
示例#31
0
 def testSplitRelativeFileWithTilde(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.split('file:~stefan/public'),
                      ('file', '', '', '~stefan/public', '', ''))
示例#32
0
 def testNonFile(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.abspath('svn://jarn.com/public'),
                      'svn://jarn.com/public')
示例#33
0
 def testSplitGitWithTilde(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.split('git://jarn.com/~stefan/public'),
                      ('git', '', 'jarn.com', '/~stefan/public', '', ''))
示例#34
0
 def testRelativeFileUrl(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.is_url('file:'), True)
示例#35
0
 def testSplitBadUrl(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.split('ssh:[email protected]/public'),
                      ('', '', '', 'ssh:[email protected]/public', '', ''))
示例#36
0
 def testBadScheme(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.is_url('ftp//'), False)
示例#37
0
 def testGit(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.is_url('git://jarn.com/public'), True)
示例#38
0
 def testEmptyString(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.is_url(''), False)
示例#39
0
 def testSsh(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.is_url('ssh://[email protected]//hg/public'), True)
示例#40
0
 def testSplitSvn(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.urlsplit('svn://jarn.com/public'),
                      ('svn', '', 'jarn.com', '/public', '', ''))
示例#41
0
 def testHttps(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.is_url('https://jarn.com/public'), True)
示例#42
0
 def testSplitGit(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.urlsplit('git://jarn.com/public'),
                      ('git', '', 'jarn.com', '/public', '', ''))
示例#43
0
 def testRelativeFileWithTilde(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.is_url('file:~stefan/public'), True)
示例#44
0
 def testSplitRsync(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.urlsplit('rsync://jarn.com/public'),
                      ('rsync', '', 'jarn.com', '/public', '', ''))
示例#45
0
 def testGitWithTilde(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.is_url('git://jarn.com/~stefan/public'), True)
示例#46
0
 def testSvnUrl(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.is_url('svn://'), True)
示例#47
0
 def testBadUrl(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.is_url('ssh:'), False)
示例#48
0
 def testSplitSsh(self):
     urlparser = URLParser()
     self.assertEqual(
         urlparser.urlsplit('ssh://[email protected]//hg/public'),
         ('ssh', 'stefan', 'jarn.com', '//hg/public', '', ''))
示例#49
0
 def testRsyncUrl(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.is_url('rsync://'), True)
示例#50
0
 def testSplitHttp(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.urlsplit('http://jarn.com/public'),
                      ('http', '', 'jarn.com', '/public', '', ''))
示例#51
0
 def testLocalhost(self):
     urlparser = URLParser()
     cwd = os.getcwd()
     self.assertEqual(urlparser.abspath('file://localhost%s/var/dist/public' % cwd),
                      'file://localhost%s/var/dist/public' % cwd)
示例#52
0
 def testSplitHttps(self):
     urlparser = URLParser()
     self.assertEqual(
         urlparser.urlsplit('https://*****:*****@jarn.com/public'),
         ('https', 'stefan:secret', 'jarn.com', '/public', '', ''))
示例#53
0
 def testNonFile(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.abspath('svn://jarn.com/public'),
                      'svn://jarn.com/public')
示例#54
0
 def testSplitFile(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.urlsplit('file:///var/dist/public'),
                      ('file', '', '', '/var/dist/public', '', ''))
示例#55
0
 def testHttpsUrl(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.is_url('https://'), True)
示例#56
0
 def testSplitRelativeFile(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.urlsplit('file:var/dist/public'),
                      ('file', '', '', 'var/dist/public', '', ''))
示例#57
0
 def testRelativeFileUrl(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.is_url('file:'), True)
示例#58
0
 def testSplitRelativeFile(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.split('file:var/dist/public'),
                      ('file', '', '', 'var/dist/public', '', ''))
示例#59
0
 def testEmptyString(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.is_url(''), False)
示例#60
0
 def testFalsePositives(self):
     # Everything with a colon matches the regex...
     urlparser = URLParser()
     self.assertEqual(urlparser.is_ssh_url('foo:'), True)