コード例 #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)