forked from timvideos/gst-switch
-
Notifications
You must be signed in to change notification settings - Fork 1
/
test_connection.py
37 lines (28 loc) · 979 Bytes
/
test_connection.py
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
from connection import Connection
from exception import *
import pytest
class TestAddress(object):
def test_address_null(self):
address = ['', None, [], {}]
for x in address:
with pytest.raises(ValueError):
Connection(address=x)
def test_address_colon(self):
address = 'abcdefghijk'
with pytest.raises(ValueError):
Connection(address=address)
def test_address_normal(self):
address = ['unix:abstract=gstswitch', 'unix:temp=/tmp/abcd/xyz']
for x in address:
conn = Connection(address=x)
assert conn.address == x
class TestBusName(object):
def test_normal(self):
names = ['', 'abcd', 12345]
for bus in names:
conn = Connection(bus_name=bus)
assert conn.bus_name == str(bus)
def test_normal_none(self):
name = None
conn = Connection(bus_name=name)
assert conn.bus_name == name