示例#1
0
    def test_update_presentation_status_to_layout_works(self):
        with patch.object(self.layout, 'notify', return_value=None) as mock_method:
            connection_mock = Mock(RemuTCP)
            slave_connection_mock = SlaveConnection(self.mock_master)
            slave_connection_mock.set_connection(connection_mock)
            self.mock_master.add_slave_connection(slave_connection_mock)
            self.mock_master.notify(Notification.PRESENTATION_UPDATE, "localhost:8000")

        mock_method.assert_called_once_with(Notification.PRESENTATION_UPDATE, "localhost:8000")
示例#2
0
    def test_update_connection_works2(self):
        with patch.object(self.layout, 'notify', return_value=None) as mock_method:
            connection_mock = Mock(RemuTCP)
            slave_connection_mock = SlaveConnection(self.mock_master)
            slave_connection_mock.set_connection(connection_mock)
            self.mock_master.add_slave_connection(slave_connection_mock)
            self.mock_master.notify(Notification.CONNECTION_ESTABLISHED, "localhost:8000")

        mock_method.assert_called_once_with(Notification.CONNECTION_ESTABLISHED, slave_connection_mock)
示例#3
0
    def test_close_connections(self):
        with patch.object(RemuTCP, 'end_connection', return_value=None) as mock_method:
            connection_mock = RemuTCP(self.mock_master, True, "")
            slave_connection_mock = SlaveConnection(self.mock_master)
            slave_connection_mock.set_connection(connection_mock)
            self.mock_master.add_slave_connection(slave_connection_mock)
            self.mock_master.close_TCP_connections()

        mock_method.assert_called_once_with()