Files
pezkuwi-sdk/pezcumulus/teyrchains/integration-tests/emulated/tests/governance/zagros/src/common.rs
T

55 lines
2.0 KiB
Rust

// Copyright (C) Parity Technologies and the various Pezkuwi contributors, see Contributions.md
// for a list of specific contributors.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
use crate::imports::*;
/// CollectivesZagros dispatches `pezpallet_xcm::send` with `OriginKind:Xcm` to the dest with
/// encoded whitelist call.
#[cfg(test)]
pub fn collectives_send_whitelist(
dest: Location,
encoded_whitelist_call: impl FnOnce() -> Vec<u8>,
) {
CollectivesZagros::execute_with(|| {
type RuntimeEvent = <CollectivesZagros as Chain>::RuntimeEvent;
type RuntimeCall = <CollectivesZagros as Chain>::RuntimeCall;
type RuntimeOrigin = <CollectivesZagros as Chain>::RuntimeOrigin;
type Runtime = <CollectivesZagros as Chain>::Runtime;
let send_whitelist_call = RuntimeCall::PezkuwiXcm(pezpallet_xcm::Call::<Runtime>::send {
dest: bx!(VersionedLocation::from(dest)),
message: bx!(VersionedXcm::from(Xcm(vec![
UnpaidExecution { weight_limit: Unlimited, check_origin: None },
Transact {
origin_kind: OriginKind::Xcm,
fallback_max_weight: None,
call: encoded_whitelist_call().into(),
}
]))),
});
use collectives_zagros_runtime::fellowship::pezpallet_fellowship_origins::Origin::Fellows as FellowsOrigin;
let fellows_origin: RuntimeOrigin = FellowsOrigin.into();
assert_ok!(send_whitelist_call.dispatch(fellows_origin));
assert_expected_events!(
CollectivesZagros,
vec![
RuntimeEvent::PezkuwiXcm(pezpallet_xcm::Event::Sent { .. }) => {},
]
);
});
}