Skip to content

Commit

Permalink
Unittest - controller.py - set_composite_mode
Browse files Browse the repository at this point in the history
  • Loading branch information
hyades committed Aug 1, 2013
1 parent 13455e4 commit b3181a2
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions python-api/gstswitch/test_controller.py
Expand Up @@ -117,6 +117,12 @@ def get_preview_ports(self):
else:
return (0,)

def set_composite_mode(self, m):
if self.mode is False:
return GLib.Variant('(b)', (True,))
else:
return (0,)


class TestGetComposePort(object):

Expand Down Expand Up @@ -175,3 +181,19 @@ def test_normal_unpack(self):
assert controller.get_preview_ports() == [3001, 3002]


class TestSetCompositeMode(object):

def test_unpack(self):
controller = Controller(address='unix:abstract=abcdefghijk')
controller.connection = MockConnection(True)
with pytest.raises(ConnectionError):
controller.set_composite_mode(1)

def test_normal_unpack(self):
controller = Controller(address='unix:abstract=abcdef')
controller.establish_connection = Mock(return_value=None)
controller.connection = MockConnection(False)
assert controller.set_composite_mode(1) == True



0 comments on commit b3181a2

Please sign in to comment.