Skip to content
Snippets Groups Projects
Commit a1c03b00 authored by Éloïs's avatar Éloïs
Browse files

tests(gdev): add int test test_remove_identity_after_one_ud

parent d52d182c
No related branches found
No related tags found
1 merge request!83feat(runtime): create UDs manually with new call universalDividend.claim_uds
This commit is part of merge request !83. Comments created here will be created in the context of that merge request.
...@@ -229,7 +229,10 @@ common_runtime::pallets_config! { ...@@ -229,7 +229,10 @@ common_runtime::pallets_config! {
pub type MembershipPeriod = pallet_duniter_test_parameters::MembershipPeriod<Runtime>; pub type MembershipPeriod = pallet_duniter_test_parameters::MembershipPeriod<Runtime>;
pub type RenewablePeriod = pallet_duniter_test_parameters::MembershipRenewablePeriod<Runtime>; pub type RenewablePeriod = pallet_duniter_test_parameters::MembershipRenewablePeriod<Runtime>;
pub type PendingMembershipPeriod = pallet_duniter_test_parameters::PendingMembershipPeriod<Runtime>; pub type PendingMembershipPeriod = pallet_duniter_test_parameters::PendingMembershipPeriod<Runtime>;
#[cfg(not(test))]
pub type UdCreationPeriod = pallet_duniter_test_parameters::UdCreationPeriod<Runtime>; pub type UdCreationPeriod = pallet_duniter_test_parameters::UdCreationPeriod<Runtime>;
#[cfg(test)]
pub type UdCreationPeriod = frame_support::traits::ConstU32<10>;
pub type UdReevalPeriod = pallet_duniter_test_parameters::UdReevalPeriod<Runtime>; pub type UdReevalPeriod = pallet_duniter_test_parameters::UdReevalPeriod<Runtime>;
pub type WotFirstCertIssuableOn = pallet_duniter_test_parameters::WotFirstCertIssuableOn<Runtime>; pub type WotFirstCertIssuableOn = pallet_duniter_test_parameters::WotFirstCertIssuableOn<Runtime>;
pub type WotMinCertForMembership = pallet_duniter_test_parameters::WotMinCertForMembership<Runtime>; pub type WotMinCertForMembership = pallet_duniter_test_parameters::WotMinCertForMembership<Runtime>;
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
mod common; mod common;
use common::*; use common::*;
use frame_support::traits::{PalletInfo, StorageInfo, StorageInfoTrait}; use frame_support::traits::{Get, PalletInfo, StorageInfo, StorageInfoTrait};
use frame_support::{assert_noop, assert_ok}; use frame_support::{assert_noop, assert_ok};
use frame_support::{StorageHasher, Twox128}; use frame_support::{StorageHasher, Twox128};
use gdev_runtime::*; use gdev_runtime::*;
...@@ -109,6 +109,61 @@ fn test_remove_identity() { ...@@ -109,6 +109,61 @@ fn test_remove_identity() {
); );
}); });
} }
#[test]
fn test_remove_identity_after_one_ud() {
ExtBuilder::new(1, 3, 4).build().execute_with(|| {
//println!("UdCreationPeriod={}", <Runtime as pallet_universal_dividend::Config>::UdCreationPeriod::get());
run_to_block(<Runtime as pallet_universal_dividend::Config>::UdCreationPeriod::get() + 1);
assert_ok!(Identity::remove_identity(
frame_system::RawOrigin::Root.into(),
4,
None
));
// Verify events
let events = System::events();
//println!("{:?}", events);
assert_eq!(events.len(), 5);
assert_eq!(
System::events()[0].event,
Event::Membership(pallet_membership::Event::MembershipRevoked(4))
);
assert_eq!(
System::events()[1].event,
Event::Balances(pallet_balances::Event::Deposit {
who: AccountKeyring::Dave.to_account_id(),
amount: 1_000
})
);
assert_eq!(
System::events()[2].event,
Event::Balances(pallet_balances::Event::Endowed {
account: AccountKeyring::Dave.to_account_id(),
free_balance: 1_000
})
);
assert_eq!(
System::events()[3].event,
Event::UniversalDividend(pallet_universal_dividend::Event::UdsAutoPaidAtRemoval {
count: 1,
total: 1_000,
who: AccountKeyring::Dave.to_account_id(),
})
);
assert_eq!(
System::events()[4].event,
Event::Identity(pallet_identity::Event::IdtyRemoved { idty_index: 4 })
);
// Verify state
assert!(Identity::identity(4).is_none());
assert_eq!(
Balances::free_balance(AccountKeyring::Dave.to_account_id()),
1_000
);
});
}
#[test] #[test]
fn test_remove_smith_identity() { fn test_remove_smith_identity() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment