Skip to content
Snippets Groups Projects
Select Git revision
  • master default protected
  • network/gdev-800 protected
  • cgeek/issue-297-cpu
  • gdev-800-tests
  • update-docker-compose-rpc-squid-names
  • fix-252
  • 1000i100-test
  • hugo/tmp-0.9.1
  • network/gdev-803 protected
  • hugo/endpoint-gossip
  • network/gdev-802 protected
  • hugo/distance-precompute
  • network/gdev-900 protected
  • tuxmain/anonymous-tx
  • debug/podman
  • hugo/195-doc
  • hugo/195-graphql-schema
  • hugo-tmp-dockerfile-cache
  • release/client-800.2 protected
  • release/runtime-800 protected
  • gdev-900-0.10.1 protected
  • gdev-900-0.10.0 protected
  • gdev-900-0.9.2 protected
  • gdev-800-0.8.0 protected
  • gdev-900-0.9.1 protected
  • gdev-900-0.9.0 protected
  • gdev-803 protected
  • gdev-802 protected
  • runtime-801 protected
  • gdev-800 protected
  • runtime-800-bis protected
  • runtime-800 protected
  • runtime-800-backup protected
  • runtime-701 protected
  • runtime-700 protected
  • runtime-600 protected
  • runtime-500 protected
  • v0.4.1 protected
  • runtime-401 protected
  • v0.4.0 protected
40 results

integration_tests.rs

Blame
  • 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>(),