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