1
// Copyright (C) Moondance Labs Ltd.
2
// This file is part of Tanssi.
3

            
4
// Tanssi is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8

            
9
// Tanssi is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
// GNU General Public License for more details.
13

            
14
// You should have received a copy of the GNU General Public License
15
// along with Tanssi.  If not, see <http://www.gnu.org/licenses/>
16
use {
17
    crate::{
18
        mock::*, ActiveCollatorsForCurrentSession, ActiveContainerChainsForCurrentSession,
19
        ActivityTrackingStatus, AuthorNotingHook, Config, CurrentActivityTrackingStatus, Error,
20
        Event, InactiveCollators, NodeActivityTrackingHelper, OfflineCollators, Pallet,
21
    },
22
    frame_support::{assert_noop, assert_ok, pallet_prelude::Get},
23
    sp_core::ConstU32,
24
    sp_runtime::{BoundedBTreeSet, DispatchError::BadOrigin},
25
    tp_traits::{AuthorNotingInfo, GetSessionIndex},
26
};
27
mod inactivity_tracking;
28
mod offline_marking;
29
26
fn get_max_inactive_sessions() -> u32 {
30
26
    <Test as Config>::MaxInactiveSessions::get()
31
26
}
32

            
33
26
fn get_collator_set(
34
26
    collators: Vec<AccountId>,
35
26
) -> BoundedBTreeSet<AccountId, <Test as Config>::MaxCollatorsPerSession> {
36
26
    let mut collator_set = BoundedBTreeSet::new();
37
53
    for collator in collators {
38
27
        let _ = collator_set.try_insert(collator);
39
27
    }
40
26
    collator_set
41
26
}