Files
pezkuwi-sdk/pezcumulus/teyrchains/pezpallets/perwerde/src/mock.rs
T
pezkuwichain 65b7f5e640 fix: Resolve cargo clippy errors and add CI workflow plan
## Changes

### Clippy Fixes
- Fixed deprecated `cargo_bin` usage in 27 test files (added #![allow(deprecated)])
- Fixed uninlined_format_args in zombienet-sdk-tests
- Fixed subxt API changes in revive/rpc/tests.rs (fetch signature, StorageValue)
- Fixed dead_code warnings in validator-pool and identity-kyc mocks
- Fixed field name `i` -> `_i` in tasks example

### CI Infrastructure
- Added .claude/WORKFLOW_PLAN.md for tracking CI fix progress
- Updated lychee.toml and taplo.toml configs

### Files Modified
- 27 test files with deprecated cargo_bin fix
- bizinikiwi/pezframe/revive/rpc/src/tests.rs (subxt API)
- pezkuwi/pezpallets/validator-pool/src/{mock,tests}.rs
- pezcumulus/teyrchains/pezpallets/identity-kyc/src/mock.rs
- bizinikiwi/pezframe/examples/tasks/src/tests.rs

## Status
- cargo clippy: PASSING
- Next: cargo fmt, zepter, workspace checks
2025-12-23 09:37:11 +03:00

148 lines
4.8 KiB
Rust
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
use crate as pezpallet_perwerde;
use pezframe_support::{
construct_runtime, parameter_types,
traits::{ConstU128, ConstU16, ConstU32, ConstU64, Everything, SortedMembers},
};
use pezframe_system::EnsureRoot;
use pezsp_core::H256;
use pezsp_runtime::{
traits::{BlakeTwo256, IdentityLookup},
BuildStorage,
};
// Temel tipleri tanımlıyoruz.
pub type AccountId = u64;
pub type Balance = u128;
pub type BlockNumber = u64;
pub type Block = pezframe_system::mocking::MockBlock<Test>;
// Test runtime'ımızı kuruyoruz.
construct_runtime!(
pub enum Test
{
System: pezframe_system,
Balances: pezpallet_balances,
Perwerde: pezpallet_perwerde,
Council: pezpallet_collective::<Instance1>,
}
);
// pezframe_system için implementasyon.
impl pezframe_system::Config for Test {
type BaseCallFilter = Everything;
type BlockWeights = ();
type BlockLength = ();
type DbWeight = ();
type RuntimeOrigin = RuntimeOrigin;
type RuntimeCall = RuntimeCall;
type Nonce = u64;
type Hash = H256;
type Hashing = BlakeTwo256;
type AccountId = AccountId;
type Lookup = IdentityLookup<Self::AccountId>;
type Block = Block;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type Version = ();
type PalletInfo = PalletInfo;
type AccountData = pezpallet_balances::AccountData<Balance>;
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = ();
type SS58Prefix = ConstU16<42>;
type OnSetCode = ();
type MaxConsumers = ConstU32<16>;
type RuntimeTask = ();
type ExtensionsWeightInfo = ();
type SingleBlockMigrations = ();
type MultiBlockMigrator = ();
type PreInherents = ();
type PostInherents = ();
type PostTransactions = ();
}
// pezpallet_balances için implementasyon.
impl pezpallet_balances::Config for Test {
type Balance = Balance;
type DustRemoval = ();
type RuntimeEvent = RuntimeEvent;
type ExistentialDeposit = ConstU128<1>;
type AccountStore = System;
type WeightInfo = ();
type MaxLocks = ConstU32<50>;
type MaxReserves = ();
type ReserveIdentifier = [u8; 8];
type FreezeIdentifier = ();
type MaxFreezes = ConstU32<1>;
type RuntimeHoldReason = ();
type RuntimeFreezeReason = ();
type DoneSlashHandler = ();
}
parameter_types! {
pub const MaxCourseNameLength: u32 = 100;
pub const MaxCourseDescLength: u32 = 500;
pub const MaxCourseLinkLength: u32 = 200;
pub const MaxStudentsPerCourse: u32 = 100; // Reduced for test performance
pub const MaxCoursesPerStudent: u32 = 50; // Max courses a student can enroll in
}
// --- KESİN ÇÖZÜM BURADA BAŞLIYOR ---
// AdminOrigin'i test etmek için kendi özel yetki sağlayıcımızı oluşturuyoruz.
use pezframe_system::EnsureSignedBy;
// Bu struct, derleyicinin talep ettiği `SortedMembers` trait'ini manuel olarak uygular.
// Bu, harici ve versiyona bağımlı araçlara olan ihtiyacı ortadan kaldırır.
pub struct TestAdminProvider;
impl SortedMembers<AccountId> for TestAdminProvider {
fn sorted_members() -> Vec<AccountId> {
// Test için admin olarak sadece 0 ID'li hesabı yetkili kılıyoruz.
vec![0]
}
}
impl pezpallet_perwerde::Config for Test {
// AdminOrigin'i, kendi yazdığımız ve sadece 0'ı admin kabul eden sağlayıcıya bağlıyoruz.
type AdminOrigin = EnsureSignedBy<TestAdminProvider, AccountId>;
type WeightInfo = ();
type MaxCourseNameLength = MaxCourseNameLength;
type MaxCourseDescLength = MaxCourseDescLength;
type MaxCourseLinkLength = MaxCourseLinkLength;
type MaxStudentsPerCourse = MaxStudentsPerCourse;
type MaxCoursesPerStudent = MaxCoursesPerStudent;
}
// Council Paletinin Mock Kurulumu (construct_runtime'da gerekli olduğu için kalıyor)
use pezpallet_collective::Instance1;
parameter_types! {
pub const CouncilMotionDuration: BlockNumber = 5 * 60; // 5 minutes
pub const CouncilMaxProposals: u32 = 100;
pub const CouncilMaxMembers: u32 = 100;
pub MaxProposalWeight: pezframe_support::weights::Weight = pezframe_support::weights::Weight::from_parts(1_000_000_000, 0);
}
impl pezpallet_collective::Config<Instance1> for Test {
type RuntimeOrigin = RuntimeOrigin;
type Proposal = RuntimeCall;
type RuntimeEvent = RuntimeEvent;
type MotionDuration = CouncilMotionDuration;
type MaxProposals = CouncilMaxProposals;
type MaxMembers = CouncilMaxMembers;
type DefaultVote = pezpallet_collective::PrimeDefaultVote;
type WeightInfo = ();
type SetMembersOrigin = EnsureRoot<AccountId>;
type MaxProposalWeight = MaxProposalWeight;
type DisapproveOrigin = EnsureRoot<AccountId>;
type KillOrigin = EnsureRoot<AccountId>;
type Consideration = ();
}
pub fn new_test_ext() -> pezsp_io::TestExternalities {
let t = pezframe_system::GenesisConfig::<Test>::default().build_storage().unwrap();
// `pezpallet-collective`'in genesis'ini de kurmamıza gerek kalmadı çünkü artık testimiz ona
// bağlı değil.
let mut ext = pezsp_io::TestExternalities::new(t);
ext.execute_with(|| System::set_block_number(1));
ext
}