def test_do_get_active_description_not_running(self): """Test _do_get_active_description method when is not running.""" server_spawned = [] ac = ActivationClient(self.config) self.patch( ac, "_spawn_server", lambda *args: server_spawned.append(args)) self.patch(ac, "is_already_running", lambda: defer.succeed(False)) self.patch(ac, "_wait_server_active", lambda: defer.succeed(None)) result = yield ac._do_get_active_description() self.assertEqual(result, self.client_description) self.assertEqual(len(server_spawned), 1)
def test_do_get_active_description_running(self): """Test the _do_get_active_description method when is running.""" ac = ActivationClient(self.config) self.patch(ac, "is_already_running", lambda: defer.succeed(True)) result = yield ac._do_get_active_description() self.assertEqual(result, self.client_description)