From 13455e4757a0f192642120a612f29b44568784dc Mon Sep 17 00:00:00 2001 From: hyades Date: Fri, 2 Aug 2013 02:23:26 +0530 Subject: [PATCH] Unittest - controller.py - get_preview_ports --- python-api/gstswitch/test_controller.py | 27 ++++++++++++++----------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/python-api/gstswitch/test_controller.py b/python-api/gstswitch/test_controller.py index 1b73d52..53b69e1 100644 --- a/python-api/gstswitch/test_controller.py +++ b/python-api/gstswitch/test_controller.py @@ -160,15 +160,18 @@ def test_normal_unpack(self): assert controller.get_audio_port() == 4000 -# class TestGetPreviewPorts(object): - -# def test_unpack(self): -# controller = Controller(address='unix:abstract=abcdefghijk') -# controller.connection = MockConnection(True) -# with pytest.raises(ConnectionError): -# controller.get_preview_ports() - -# def test_normal_unpack(self): -# controller = Controller(address='unix:abstract=abcdef') -# controller.connection = MockConnection(False) -# assert controller.get_preview_ports() == '[(3002, 1, 7), (3003, 1, 8)]' +class TestGetPreviewPorts(object): + + def test_unpack(self): + controller = Controller(address='unix:abstract=abcdefghijk') + controller.connection = MockConnection(True) + with pytest.raises(ConnectionError): + controller.get_preview_ports() + + def test_normal_unpack(self): + controller = Controller(address='unix:abstract=abcdef') + controller.connection = MockConnection(False) + controller._parse_preview_ports = Mock(return_value=[3001, 3002]) + assert controller.get_preview_ports() == [3001, 3002] + +