예제 #1
0
 def test_normal(self):
     """Test if valid"""
     controller = Controller(address='unix:abstract=abcde')
     test = '[(1, 2, 3), (2, 2, 2)]'
     assert controller.parse_preview_ports(test) == [1, 2]
예제 #2
0
 def test_value_error(self):
     """Test if invalid"""
     controller = Controller(address='unix:abstract=abcde')
     test = 1234
     with pytest.raises(ConnectionReturnError):
         controller.parse_preview_ports(test)
예제 #3
0
 def test_syntax_error(self):
     """Test if syntax error detected"""
     controller = Controller(address='unix:abstract=abcde')
     test = '{}[]'
     with pytest.raises(ConnectionReturnError):
         controller.parse_preview_ports(test)
예제 #4
0
 def test_normal_unpack(self):
     """Test if valid"""
     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]
예제 #5
0
 def test_normal(self):
     """Test if valid"""
     controller = Controller(address='unix:abstract=abcde')
     test = '[(1, 2, 3), (2, 2, 2)]'
     assert controller.parse_preview_ports(test) == [1, 2]
예제 #6
0
 def test_syntax_error(self):
     """Test if syntax error detected"""
     controller = Controller(address='unix:abstract=abcde')
     test = '{}[]'
     with pytest.raises(ConnectionReturnError):
         controller.parse_preview_ports(test)
예제 #7
0
 def test_value_error(self):
     """Test if invalid"""
     controller = Controller(address='unix:abstract=abcde')
     test = 1234
     with pytest.raises(ConnectionReturnError):
         controller.parse_preview_ports(test)
예제 #8
0
 def test_normal_unpack(self):
     """Test if valid"""
     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]