~ubuntu-branches/ubuntu/natty/miro/natty

« back to all changes in this revision

Viewing changes to portable/test/parseurltest.py

  • Committer: Bazaar Package Importer
  • Author(s): Bryce Harrington
  • Date: 2011-01-22 02:46:33 UTC
  • mfrom: (1.4.10 upstream) (1.7.5 experimental)
  • Revision ID: james.westby@ubuntu.com-20110122024633-kjme8u93y2il5nmf
Tags: 3.5.1-1ubuntu1
* Merge from debian.  Remaining ubuntu changes:
  - Use python 2.7 instead of python 2.6
  - Relax dependency on python-dbus to >= 0.83.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
from miro.test.framework import MiroTestCase
2
 
from miro.download_utils import parse_url
3
 
 
4
 
class TestParseURL(MiroTestCase):
5
 
    def check(self, url, scheme, host, port, path):
6
 
        result = parse_url(url)
7
 
        self.assertEquals(result[0], scheme)
8
 
        self.assertEquals(result[1], host)
9
 
        self.assertEquals(result[2], port)
10
 
        self.assertEquals(result[3], path)
11
 
 
12
 
    def test_file_urls(self):
13
 
        self.check('file:///abc', 'file', '', None, '/abc')
14
 
        self.check('file://abc', 'file', '', None, '/abc')
15
 
        self.check('file:///C:\\Program%20Files', 'file', '', None, 
16
 
                   'C:/Program%20Files')
17
 
        self.check('file:///C:/Program%20Files', 'file', '', None, 
18
 
                   'C:/Program%20Files')
19
 
        self.check('file://C:/abc', 'file', '', None, 'C:/abc')
20
 
        self.check('file://C|/abc', 'file', '', None, 'C:/abc')
21
 
        self.check('file://abc', 'file', '', None, '/abc')
22
 
 
23
 
    def test_http_urls(self):
24
 
        self.check('http://foo.com/index.html?a=3', 'http', 'foo.com', 80,
25
 
                   '/index.html?a=3')
26
 
        self.check('http://foo.com:123:123/', 'http', 'foo.com', 123, '/')
27
 
        self.check('https://foo.com/', 'https', 'foo.com', 443, '/')