예제 #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 testSplitFile(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.urlsplit('file:///var/dist/public'),
                      ('file', '', '', '/var/dist/public', '', ''))
예제 #5
0
 def testSplitHttp(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.urlsplit('http://jarn.com/public'),
                      ('http', '', 'jarn.com', '/public', '', ''))
예제 #6
0
 def testSvnUrl(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.is_url('svn://'), True)
예제 #7
0
 def testSplitGit(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.urlsplit('git://jarn.com/public'),
                      ('git', '', 'jarn.com', '/public', '', ''))
예제 #8
0
 def testEmptyString(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.is_url(''), False)
예제 #9
0
 def testRelativeFileUrl(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.is_url('file:'), 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 testBadUrl(self):
     urlparser = URLParser()
     self.assertEqual(
         urlparser.to_ssh_url('https://[email protected]/var/dist/public'),
         'https://[email protected]/var/dist/public')
예제 #17
0
 def testNonFile(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.abspath('svn://jarn.com/public'),
                      'svn://jarn.com/public')
예제 #18
0
 def testHttpsUrl(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.is_url('https://'), True)
예제 #19
0
 def testBadScheme(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.is_url('ftp//'), False)
예제 #20
0
 def testWhitespace(self):
     urlparser = URLParser()
     self.assertEqual(
         urlparser.to_ssh_url(' ssh://[email protected]/var/dist/public'),
         ' ssh://[email protected]/var/dist/public')
예제 #21
0
 def testSplitSvn(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.urlsplit('svn://jarn.com/public'),
                      ('svn', '', 'jarn.com', '/public', '', ''))
예제 #22
0
 def testEmptyString(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.to_ssh_url(''), '')
예제 #23
0
 def testSplitRsync(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.urlsplit('rsync://jarn.com/public'),
                      ('rsync', '', 'jarn.com', '/public', '', ''))
예제 #24
0
 def testRelativeFile(self):
     urlparser = URLParser()
     cwd = os.getcwd()
     self.assertEqual(urlparser.abspath('file:var/dist/public'),
                      'file://%s/var/dist/public' % cwd)
예제 #25
0
 def testSplitSsh(self):
     urlparser = URLParser()
     self.assertEqual(
         urlparser.urlsplit('ssh://[email protected]//hg/public'),
         ('ssh', 'stefan', 'jarn.com', '//hg/public', '', ''))
예제 #26
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)
예제 #27
0
 def testSplitHttps(self):
     urlparser = URLParser()
     self.assertEqual(
         urlparser.urlsplit('https://*****:*****@jarn.com/public'),
         ('https', 'stefan:secret', 'jarn.com', '/public', '', ''))
예제 #28
0
 def testFileUrl(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.is_url('file://'), True)
예제 #29
0
 def testSplitRelativeFile(self):
     urlparser = URLParser()
     self.assertEqual(urlparser.urlsplit('file:var/dist/public'),
                      ('file', '', '', 'var/dist/public', '', ''))
예제 #30
0
 def testFalsePositives(self):
     # Everything with a colon matches the regex...
     urlparser = URLParser()
     self.assertEqual(urlparser.is_ssh_url('foo:'), True)