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

cargo cucumber ok

parent 25dcbf41
No related branches found
No related tags found
1 merge request!215refac membership
Pipeline #34846 failed
......@@ -14,10 +14,10 @@ Feature: Identity creation
# then next cert can be done after cert_period, which is 15
When 15 block later
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
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 bob certifies dave
When charlie certifies dave
......@@ -30,5 +30,5 @@ Feature: Identity creation
When alice runs distance oracle
When 30 blocks later
Then dave should have distance ok
When eve validates dave identity
Then dave identity should be validated
When dave claims membership
Then dave identity should be member
......@@ -72,7 +72,7 @@ pub async fn confirm_identity(client: &Client, from: AccountKeyring, pseudo: Str
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 _events = create_block_with_extrinsic(
......@@ -80,7 +80,7 @@ pub async fn validate_identity(client: &Client, from: AccountKeyring, to: u32) -
client
.tx()
.create_signed(
&gdev::tx().identity().validate_identity(to),
&gdev::tx().membership().claim_membership(),
&from,
BaseExtrinsicParamsBuilder::new(),
)
......
......@@ -334,15 +334,11 @@ async fn confirm_identity(world: &mut DuniterWorld, from: String, pseudo: String
}
#[allow(clippy::needless_pass_by_ref_mut)]
#[when(regex = r#"([a-zA-Z]+) validates ([a-zA-Z]+) identity"#)]
async fn validate_identity(world: &mut DuniterWorld, from: String, to: String) -> Result<()> {
#[when(regex = r#"([a-zA-Z]+) claims membership"#)]
async fn validate_identity(world: &mut DuniterWorld, from: String) -> Result<()> {
// input names to keyrings
let from = AccountKeyring::from_str(&from).expect("unknown from");
let to: u32 = common::identity::get_identity_index(world, to)
.await
.unwrap();
common::identity::validate_identity(world.client(), from, to).await
common::identity::validate_identity(world.client(), from).await
}
#[allow(clippy::needless_pass_by_ref_mut)]
......@@ -576,9 +572,11 @@ impl FromStr for IdtyStatus {
fn from_str(input: &str) -> std::result::Result<IdtyStatus, String> {
match input {
"created" => Ok(IdtyStatus::Created),
"confirmed" => Ok(IdtyStatus::ConfirmedByOwner),
"validated" => Ok(IdtyStatus::Validated),
"unconfirmed" => Ok(IdtyStatus::Unconfirmed),
"unvalidated" => Ok(IdtyStatus::Unvalidated),
"member" => Ok(IdtyStatus::Member),
"notmember" => Ok(IdtyStatus::NotMember),
"revoked" => Ok(IdtyStatus::Revoked),
_ => 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 register or to comment