Пример #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)