File: url_parsing_test.py

package info (click to toggle)
python-awscurl 0.36-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 260 kB
  • sloc: python: 967; sh: 90; makefile: 18
file content (49 lines) | stat: -rw-r--r-- 1,774 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env python


from unittest import TestCase

from awscurl import awscurl

__author__ = 'iokulist'


class TestUriParsing(TestCase):
    maxDiff = None

    def test(self, *args, **kvargs):
        self.assertEqual(awscurl.url_path_to_dict("http://google.com"),
                         {'host': 'google.com',
                          'password': None,
                          'path': '/',
                          'port': None,
                          'query': '',
                          'schema': 'http',
                          'user': None})

        self.assertEqual(awscurl.url_path_to_dict("http://user:password@google.com"),
                         {'host': 'google.com',
                          'password': 'password',
                          'path': '/',
                          'port': None,
                          'query': '',
                          'schema': 'http',
                          'user': 'user'})

        self.assertEqual(awscurl.url_path_to_dict("http://user:password@google.com/path1/path2"),
                         {'host': 'google.com',
                          'password': 'password',
                          'path': '/path1/path2',
                          'port': None,
                          'query': '',
                          'schema': 'http',
                          'user': 'user'})

        self.assertEqual(awscurl.url_path_to_dict("http://google.com/path1/path2/@weird"),
                         {'host': 'google.com',
                          'password': None,
                          'path': '/path1/path2/@weird',
                          'port': None,
                          'query': '',
                          'schema': 'http',
                          'user': None})