forked from timvideos/gst-switch
-
Notifications
You must be signed in to change notification settings - Fork 1
/
test_BaseServer.py
47 lines (38 loc) · 1.17 KB
/
test_BaseServer.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
38
39
40
41
42
43
44
45
46
47
from server import BaseServer
import pytest
class TestSetVideoPort(object):
def test_negative(self):
port = -3
instance = BaseServer()
with pytest.raises(ValueError):
instance.set_video_port(port)
def test_zero(self):
port = 0
instance = BaseServer()
with pytest.raises(ValueError):
instance.set_video_port(port)
def test_huge(self):
port = 1e6
instance = BaseServer()
with pytest.raises(ValueError):
instance.set_video_port(port)
def test_none(self):
port = None
instance = BaseServer()
with pytest.raises(TypeError):
instance.set_video_port(port)
def test_string(self):
port = ""
instance = BaseServer()
with pytest.raises(TypeError):
instance.set_video_port(port)
def test_dict(self):
port = {}
instance = BaseServer()
with pytest.raises(TypeError):
instance.set_video_port(port)
def test_normal(self):
port = 3000
instance = BaseServer()
instance.set_video_port(port)
assert port == int(instance.VIDEO_PORT)