Select Git revision
integration_tests.rs
-
Hugo Trentesaux authoredHugo Trentesaux authored
integration_tests.rs 62.15 KiB
// Copyright 2021 Axiom-Team
//
// This file is part of Duniter-v2S.
//
// Duniter-v2S is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, version 3 of the License.
//
// Duniter-v2S is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>.
mod common;
use common::*;
use frame_support::traits::StoredMap;
use frame_support::traits::{Get, PalletInfo, StorageInfo, StorageInfoTrait};
use frame_support::{assert_err, assert_noop, assert_ok};
use frame_support::{StorageHasher, Twox128};
use gdev_runtime::*;
use pallet_identity::{RevocationPayload, REVOCATION_PAYLOAD_PREFIX};
use pallet_membership::MembershipRemovalReason;
use pallet_smith_members::{SmithMeta, SmithStatus};
use sp_core::Encode;
use sp_keyring::AccountKeyring;
use sp_runtime::MultiAddress;
#[test]
fn verify_treasury_account() {
// println!("{}", Treasury::account_id());
}
#[test]
fn verify_pallet_prefixes() {
let prefix = |pallet_name, storage_name| {
let mut res = [0u8; 32];
res[0..16].copy_from_slice(&Twox128::hash(pallet_name));
res[16..32].copy_from_slice(&Twox128::hash(storage_name));
res.to_vec()
};
assert_eq!(
<Timestamp as StorageInfoTrait>::storage_info(),
vec![
StorageInfo {
pallet_name: b"Timestamp".to_vec(),
storage_name: b"Now".to_vec(),
prefix: prefix(b"Timestamp", b"Now"),
max_values: Some(1),
max_size: Some(8),
},
StorageInfo {
pallet_name: b"Timestamp".to_vec(),
storage_name: b"DidUpdate".to_vec(),
prefix: prefix(b"Timestamp", b"DidUpdate"),
max_values: Some(1),
max_size: Some(1),
}
]
);
}
#[test]
fn verify_pallet_indices() {
fn is_pallet_index<P: 'static>(index: usize) {
assert_eq!(
<Runtime as frame_system::Config>::PalletInfo::index::<P>(),