コード例 #1
0
 def test_unpack(self):
     """Test if unpack fails"""
     controller = Controller(address='unix:abstract=abcde')
     controller.establish_connection = Mock(return_value=None)
     controller.connection = MockConnection(True)
     with pytest.raises(ConnectionReturnError):
         controller.new_record()
コード例 #2
0
 def test_unpack(self):
     """Test if unpack fails"""
     controller = Controller(address='unix:abstract=abcde')
     controller.establish_connection = Mock(return_value=None)
     controller.connection = MockConnection(True)
     with pytest.raises(ConnectionReturnError):
         controller.new_record()
コード例 #3
0
 def new_record(self):
     """Create a Controller object and call new_record method"""
     res = []
     controller = Controller()
     for _ in range(self.NUM * self.FACTOR):
         res.append(controller.new_record())
     return res
コード例 #4
0
ファイル: test_controller.py プロジェクト: mithro/gst-switch
 def new_record(self):
     """Create a Controller object and call new_record method"""
     res = []
     controller = Controller()
     for _ in range(self.NUM * self.FACTOR):
         res.append(controller.new_record())
     return res
コード例 #5
0
 def test_action_fails(self):
     """Test what happens if the requested action fails"""
     controller = Controller(address='unix:abstract=abcde')
     controller.establish_connection = Mock(return_value=None)
     controller.connection = MockConnection(return_variant=True,
                                            should_fail=True)
     assert controller.new_record() is False
コード例 #6
0
 def test_action_fails(self):
     """Test what happens if the requested action fails"""
     controller = Controller(address='unix:abstract=abcde')
     controller.establish_connection = Mock(return_value=None)
     controller.connection = MockConnection(
         return_variant=True, should_fail=True)
     assert controller.new_record() is False
コード例 #7
0
 def test_normal_unpack(self):
     """Test if valid"""
     controller = Controller(address='unix:abstract=abcdef')
     controller.establish_connection = Mock(return_value=None)
     controller.connection = MockConnection(False)
     assert controller.new_record() is True
コード例 #8
0
 def test_normal_unpack(self):
     """Test if valid"""
     controller = Controller(address='unix:abstract=abcdef')
     controller.establish_connection = Mock(return_value=None)
     controller.connection = MockConnection(False)
     assert controller.new_record() is True