From b3181a267ec1a461c4da2ec61360ded119bfa096 Mon Sep 17 00:00:00 2001 From: hyades Date: Fri, 2 Aug 2013 02:36:34 +0530 Subject: [PATCH] Unittest - controller.py - set_composite_mode --- python-api/gstswitch/test_controller.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/python-api/gstswitch/test_controller.py b/python-api/gstswitch/test_controller.py index 53b69e1..e227466 100644 --- a/python-api/gstswitch/test_controller.py +++ b/python-api/gstswitch/test_controller.py @@ -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): @@ -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 + + +