1 # Copyright (C) 2013 Stratosphere Inc.
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
16 # vim: tabstop=4 shiftwidth=4 softtabstop=4
19 from socket import error as SocketError
23 from ryu.app.ws_topology import WebSocketTopology
26 class Test_ws_topology(unittest.TestCase):
28 def test_when_sock_error(self):
32 app = WebSocketTopology(**args)
34 rpc_client_mock1 = mock.Mock()
36 'get_proxy.return_value.event_link_add.side_effect': SocketError,
38 rpc_client_mock1.configure_mock(**config)
40 rpc_client_mock2 = mock.Mock()
48 app._event_link_add_handler(ev_mock)
50 rpc_client_mock1.get_proxy.assert_called_once_with()
51 rpc_client_mock2.get_proxy.assert_called_once_with()
54 if __name__ == "__main__":