File: test_address_parser.py

package info (click to toggle)
python-dbus-next 0.2.3-5
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 696 kB
  • sloc: python: 6,018; makefile: 45; xml: 29
file content (31 lines) | stat: -rw-r--r-- 929 bytes parent folder | download | duplicates (3)
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
from dbus_next._private.address import parse_address


def test_valid_addresses():

    valid_addresses = {
        'unix:path=/run/user/1000/bus': [('unix', {
            'path': '/run/user/1000/bus'
        })],
        'unix:abstract=/tmp/dbus-ft9sODWpZk,guid=a7b1d5912379c2d471165e9b5cb74a03': [('unix', {
            'abstract':
            '/tmp/dbus-ft9sODWpZk',
            'guid':
            'a7b1d5912379c2d471165e9b5cb74a03'
        })],
        'unix1:key1=val1;unix2:key2=val2': [('unix1', {
            'key1': 'val1'
        }), ('unix2', {
            'key2': 'val2'
        })],
        'unix:escaped=hello%20world': [('unix', {
            'escaped': 'hello world'
        })],
        'tcp:host=127.0.0.1,port=55556': [('tcp', {
            'host': '127.0.0.1',
            'port': '55556'
        })]
    }

    for address, parsed in valid_addresses.items():
        assert parse_address(address) == parsed