/// Submits a proposal, votes on it as instructed, and then verifies:
/// - that the proposal status, immediately after voting, is as expected
/// - that the proposal status, after proposal expiration, is as expected
///
/// To simplify test setup:
/// - The rejection fee is set to zero
/// - all votes happen at proposal creation time.
/// - uses an arbtrary duration for proposal expiration time.
Submits a proposal, votes on it as instructed, and then verifies:
that the proposal status, immediately after voting, is as expected
that the proposal status, after proposal expiration, is as expected

To simplify test setup:
The rejection fee is set to zero
all votes happen at proposal creation time.
uses an arbtrary duration for proposal expiration time.
Submits a proposal votes on it as instructed and then verifies : that the proposal status immediately after voting is as expected that the proposal status after proposal expiration is as expected To simplify test setup : The rejection fee is set to zero all votes happen at proposal creation time . uses an arbtrary duration for proposal expiration time .
fn check_proposal_status_after_voting_and_after_expiration(
    neurons: impl IntoIterator<Item = Neuron>,
    behavior: impl Into<fake::ProposalNeuronBehavior>,
    expected_after_voting: ProposalStatus,
    expected_after_expiration: ProposalStatus,
) {
    let expiration_seconds = 17; // Arbitrary duration
    let econ = NetworkEconomics {
        reject_cost_e8s: 0,          // It's the default, but specify for emphasis
        neuron_minimum_stake_e8s: 0, // It's the default, but specify for emphasis
        ..NetworkEconomics::default()
    };
    let mut fake_driver = fake::FakeDriver::default();
    let fixture = GovernanceProto {
        neurons: neurons
            .into_iter()
            .zip(0_u64..)
            .map(|(neuron, i)| {
                (
                    i,
                    Neuron {
                        id: Some(NeuronId { id: i }),
                        controller: Some(principal(i)),
                        account: fake_driver.get_fake_env().random_byte_array().to_vec(),
                        ..neuron
                    },
                )
            })
            .collect(),
        wait_for_quiet_threshold_seconds: expiration_seconds,
        economics: Some(econ),
        ..Default::default()
    };
    let mut gov = Governance::new(
        fixture,
        fake_driver.get_fake_env(),
        fake_driver.get_fake_ledger(),
    );
    let pid = behavior
        .into()
        .propose_and_vote(&mut gov, "the unique proposal".to_string());
    let after_voting = gov.get_proposal_data(pid).unwrap().clone();
    assert_eq!(
        after_voting.status(),
        expected_after_voting,
        "After voting: {:?}",
        after_voting
    );
    fake_driver.advance_time_by(expiration_seconds - 1);
    gov.run_periodic_tasks().now_or_never();
    // The proposal should still be open for voting, so nothing should have changed
    assert_eq!(*gov.get_proposal_data(pid).unwrap(), after_voting);
    // One more second brings us to proposal expiration
    fake_driver.advance_time_by(1);
    gov.run_periodic_tasks().now_or_never();
    let after_expiration = gov.get_proposal_data(pid).unwrap();
    assert_eq!(
        after_expiration.status(),
        expected_after_expiration,
        "After expiration: {:?}",
        after_expiration
    );
}
fn check_proposal_status_after_voting_and_after_expiration ( neurons : impl IntoIterator < Item = Neuron > , behavior : impl Into < fake :: ProposalNeuronBehavior > , expected_after_voting : ProposalStatus , expected_after_expiration : ProposalStatus , ) { let expiration_seconds = 17 ; // Arbitrary duration let econ = NetworkEconomics { reject_cost_e8s : 0 , // It's the default, but specify for emphasis neuron_minimum_stake_e8s : 0 , // It's the default, but specify for emphasis .. NetworkEconomics :: default ( ) } ; let mut fake_driver = fake :: FakeDriver :: default ( ) ; let fixture = GovernanceProto { neurons : neurons . into_iter ( ) . zip ( 0_u64 .. ) . map ( | ( neuron , i ) | { ( i , Neuron { id : Some ( NeuronId { id : i } ) , controller : Some ( principal ( i ) ) , account : fake_driver . get_fake_env ( ) . random_byte_array ( ) . to_vec ( ) , .. neuron } , ) } ) . collect ( ) , wait_for_quiet_threshold_seconds : expiration_seconds , economics : Some ( econ ) , .. Default :: default ( ) } ; let mut gov = Governance :: new ( fixture , fake_driver . get_fake_env ( ) , fake_driver . get_fake_ledger ( ) , ) ; let pid = behavior . into ( ) . propose_and_vote ( & mut gov , " " . to_string ( ) ) ; let after_voting = gov . get_proposal_data ( pid ) . unwrap ( ) . clone ( ) ; assert_eq ! ( after_voting status ( ) expected_after_voting " " after_voting ) ; fake_driver . advance_time_by ( expiration_seconds - 1 ) ; gov . run_periodic_tasks ( ) . now_or_never ( ) ; // The proposal should still be open for voting, so nothing should have changed assert_eq ! ( gov get_proposal_data ( pid ) unwrap ( ) after_voting ) ; // One more second brings us to proposal expiration fake_driver . advance_time_by ( 1 ) ; gov . run_periodic_tasks ( ) . now_or_never ( ) ; let after_expiration = gov . get_proposal_data ( pid ) . unwrap ( ) ; assert_eq ! ( after_expiration status ( ) expected_after_expiration " " after_expiration ) ; }
Submits a proposal, votes on it as instructed, and then verifies:
 that the proposal status, immediately after voting, is as expected
 that the proposal status, after proposal expiration, is as expected
Submits a proposal votes on it as instructed and then verifies : that the proposal status immediately after voting is as expected that the proposal status after proposal expiration is as expected
neurons
impl IntoIterator<Item = Neuron>
behavior
impl Into<fake::ProposalNeuronBehavior>
expected_after_voting
ProposalStatus
expected_after_expiration
ProposalStatus