Skip to content
Snippets Groups Projects
Commit 86298b06 authored by Hugo Trentesaux's avatar Hugo Trentesaux
Browse files

cargo cucumber ok

parent 25dcbf41
Branches release/runtime-800
Tags
1 merge request!215refac membership
Pipeline #34846 failed
...@@ -14,10 +14,10 @@ Feature: Identity creation ...@@ -14,10 +14,10 @@ Feature: Identity creation
# then next cert can be done after cert_period, which is 15 # then next cert can be done after cert_period, which is 15
When 15 block later When 15 block later
When alice creates identity for dave When alice creates identity for dave
Then dave identity should be created Then dave identity should be unconfirmed
Then dave should be certified by alice Then dave should be certified by alice
When dave confirms his identity with pseudo "dave" When dave confirms his identity with pseudo "dave"
Then dave identity should be confirmed Then dave identity should be unvalidated
When 3 block later When 3 block later
When bob certifies dave When bob certifies dave
When charlie certifies dave When charlie certifies dave
...@@ -30,5 +30,5 @@ Feature: Identity creation ...@@ -30,5 +30,5 @@ Feature: Identity creation
When alice runs distance oracle When alice runs distance oracle
When 30 blocks later When 30 blocks later
Then dave should have distance ok Then dave should have distance ok
When eve validates dave identity When dave claims membership
Then dave identity should be validated Then dave identity should be member
...@@ -72,7 +72,7 @@ pub async fn confirm_identity(client: &Client, from: AccountKeyring, pseudo: Str ...@@ -72,7 +72,7 @@ pub async fn confirm_identity(client: &Client, from: AccountKeyring, pseudo: Str
Ok(()) Ok(())
} }
pub async fn validate_identity(client: &Client, from: AccountKeyring, to: u32) -> Result<()> { pub async fn validate_identity(client: &Client, from: AccountKeyring) -> Result<()> {
let from = PairSigner::new(from.pair()); let from = PairSigner::new(from.pair());
let _events = create_block_with_extrinsic( let _events = create_block_with_extrinsic(
...@@ -80,7 +80,7 @@ pub async fn validate_identity(client: &Client, from: AccountKeyring, to: u32) - ...@@ -80,7 +80,7 @@ pub async fn validate_identity(client: &Client, from: AccountKeyring, to: u32) -
client client
.tx() .tx()
.create_signed( .create_signed(
&gdev::tx().identity().validate_identity(to), &gdev::tx().membership().claim_membership(),
&from, &from,
BaseExtrinsicParamsBuilder::new(), BaseExtrinsicParamsBuilder::new(),
) )
......
...@@ -334,15 +334,11 @@ async fn confirm_identity(world: &mut DuniterWorld, from: String, pseudo: String ...@@ -334,15 +334,11 @@ async fn confirm_identity(world: &mut DuniterWorld, from: String, pseudo: String
} }
#[allow(clippy::needless_pass_by_ref_mut)] #[allow(clippy::needless_pass_by_ref_mut)]
#[when(regex = r#"([a-zA-Z]+) validates ([a-zA-Z]+) identity"#)] #[when(regex = r#"([a-zA-Z]+) claims membership"#)]
async fn validate_identity(world: &mut DuniterWorld, from: String, to: String) -> Result<()> { async fn validate_identity(world: &mut DuniterWorld, from: String) -> Result<()> {
// input names to keyrings // input names to keyrings
let from = AccountKeyring::from_str(&from).expect("unknown from"); let from = AccountKeyring::from_str(&from).expect("unknown from");
let to: u32 = common::identity::get_identity_index(world, to) common::identity::validate_identity(world.client(), from).await
.await
.unwrap();
common::identity::validate_identity(world.client(), from, to).await
} }
#[allow(clippy::needless_pass_by_ref_mut)] #[allow(clippy::needless_pass_by_ref_mut)]
...@@ -576,9 +572,11 @@ impl FromStr for IdtyStatus { ...@@ -576,9 +572,11 @@ impl FromStr for IdtyStatus {
fn from_str(input: &str) -> std::result::Result<IdtyStatus, String> { fn from_str(input: &str) -> std::result::Result<IdtyStatus, String> {
match input { match input {
"created" => Ok(IdtyStatus::Created), "unconfirmed" => Ok(IdtyStatus::Unconfirmed),
"confirmed" => Ok(IdtyStatus::ConfirmedByOwner), "unvalidated" => Ok(IdtyStatus::Unvalidated),
"validated" => Ok(IdtyStatus::Validated), "member" => Ok(IdtyStatus::Member),
"notmember" => Ok(IdtyStatus::NotMember),
"revoked" => Ok(IdtyStatus::Revoked),
_ => Err(format!("'{input}' does not match a status")), _ => Err(format!("'{input}' does not match a status")),
} }
} }
......
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment