def test_resynchronize_calls_reset(self): plugin = BrokerClientPlugin() plugin.scope = "test" self.client.add(plugin) plugin._reset = mock.Mock() self.client_reactor.fire("resynchronize") plugin._reset.assert_called_once_with()
def test_resynchronizing_out_of_scope(self): """ When a 'reysnchronize' event happens and the plugin scope is not part of the scopes that were passed, BrokerClientPlugin succeeds. """ plugin = BrokerClientPlugin() plugin.scope = "foo" self.client.add(plugin) deferred = self.client_reactor.fire("resynchronize", scopes=["bar"])[0] self.assertIsNone(self.successResultOf(deferred))
def test_registered_plugin_uses_correct_scope(self): """ When we register a plugin we use that plugin's scope variable when getting a session id. """ test_session_id = self.successResultOf( self.client.broker.get_session_id(scope="test")) plugin = BrokerClientPlugin() plugin.scope = "test" self.client.add(plugin) self.assertEqual(test_session_id, plugin._session_id)
def test_resynchronizing_refreshes_session_id(self): """ When a 'reysnchronize' event fires a new session ID is acquired as the old one will be removed. """ plugin = BrokerClientPlugin() plugin.scope = "test" self.client.add(plugin) session_id = plugin._session_id self.mstore.drop_session_ids() self.client_reactor.fire("resynchronize") self.assertNotEqual(session_id, plugin._session_id)