sc_consensus/import_queue/mock.rs
1// This file is part of Substrate.
2
3// Copyright (C) Parity Technologies (UK) Ltd.
4// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
5
6// This program is free software: you can redistribute it and/or modify
7// it under the terms of the GNU General Public License as published by
8// the Free Software Foundation, either version 3 of the License, or
9// (at your option) any later version.
10
11// This program is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14// GNU General Public License for more details.
15
16// You should have received a copy of the GNU General Public License
17// along with this program. If not, see <https://www.gnu.org/licenses/>.
18
19use super::*;
20
21mockall::mock! {
22 pub ImportQueueHandle<B: BlockT> {}
23
24 impl<B: BlockT> ImportQueueService<B> for ImportQueueHandle<B> {
25 fn import_blocks(&mut self, origin: BlockOrigin, blocks: Vec<IncomingBlock<B>>);
26 fn import_justifications(
27 &mut self,
28 who: RuntimeOrigin,
29 hash: B::Hash,
30 number: NumberFor<B>,
31 justifications: Justifications,
32 );
33 }
34}
35
36mockall::mock! {
37 pub ImportQueue<B: BlockT> {}
38
39 #[async_trait::async_trait]
40 impl<B: BlockT> ImportQueue<B> for ImportQueue<B> {
41 fn service(&self) -> Box<dyn ImportQueueService<B>>;
42 fn service_ref(&mut self) -> &mut dyn ImportQueueService<B>;
43 fn poll_actions<'a>(&mut self, cx: &mut futures::task::Context<'a>, link: &dyn Link<B>);
44 async fn run(self, link: &'__mockall_link dyn Link<B>);
45 }
46}