Skip to content

Commit

Permalink
chore: Remove governed account from tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianBor committed Mar 5, 2024
1 parent c5b7a5a commit a25b35c
Show file tree
Hide file tree
Showing 29 changed files with 174 additions and 1,051 deletions.
2 changes: 1 addition & 1 deletion governance/program/src/instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ pub enum GovernanceInstruction {
/// Solana account or asset
///
/// 0. `[]` Realm account the created Governance belongs to
/// 1. `[writable]` Account Governance account.
/// 1. `[writable]` Governance account
/// * PDA seeds: ['account-governance', realm, governed_account]
/// 2. `[]` Account governed by this Governance Note: The account doesn't
/// have to exist and can be only used as a unique identifier for the
Expand Down
7 changes: 1 addition & 6 deletions governance/program/tests/migrate_legacy_accounts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,14 @@ async fn test_create_proposal_and_migrate_governance_v1_to_v2() {
let mut governance_test = GovernanceProgramTest::start_new().await;

let realm_cookie = governance_test.with_realm().await;
let governed_account_cookie = governance_test.with_governed_account().await;

let token_owner_record_cookie = governance_test
.with_community_token_deposit(&realm_cookie)
.await
.unwrap();

let mut governance_cookie = governance_test
.with_governance(
&realm_cookie,
&governed_account_cookie,
&token_owner_record_cookie,
)
.with_governance(&realm_cookie, &token_owner_record_cookie)
.await
.unwrap();

Expand Down
14 changes: 2 additions & 12 deletions governance/program/tests/process_add_required_signatory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ async fn test_add_required_signatory() {
let mut governance_test = GovernanceProgramTest::start_new().await;

let realm_cookie = governance_test.with_realm().await;
let governed_account_cookie = governance_test.with_governed_account().await;

let signatory = Pubkey::new_unique();

Expand All @@ -29,11 +28,7 @@ async fn test_add_required_signatory() {
.unwrap();

let mut governance_cookie = governance_test
.with_governance(
&realm_cookie,
&governed_account_cookie,
&token_owner_record_cookie,
)
.with_governance(&realm_cookie, &token_owner_record_cookie)
.await
.unwrap();

Expand Down Expand Up @@ -154,7 +149,6 @@ pub async fn add_required_signatory_to_governance_without_governance_signer_err(
let mut governance_test = GovernanceProgramTest::start_new().await;

let realm_cookie = governance_test.with_realm().await;
let governed_account_cookie = governance_test.with_governed_account().await;

let signatory = Pubkey::new_unique();

Expand All @@ -164,11 +158,7 @@ pub async fn add_required_signatory_to_governance_without_governance_signer_err(
.unwrap();

let governance_cookie = governance_test
.with_governance(
&realm_cookie,
&governed_account_cookie,
&token_owner_record_cookie,
)
.with_governance(&realm_cookie, &token_owner_record_cookie)
.await
.unwrap();

Expand Down
37 changes: 7 additions & 30 deletions governance/program/tests/process_add_signatory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,14 @@ async fn test_add_signatory() {
let mut governance_test = GovernanceProgramTest::start_new().await;

let realm_cookie = governance_test.with_realm().await;
let governed_account_cookie = governance_test.with_governed_account().await;

let token_owner_record_cookie = governance_test
.with_community_token_deposit(&realm_cookie)
.await
.unwrap();

let mut governance_cookie = governance_test
.with_governance(
&realm_cookie,
&governed_account_cookie,
&token_owner_record_cookie,
)
.with_governance(&realm_cookie, &token_owner_record_cookie)
.await
.unwrap();

Expand Down Expand Up @@ -70,19 +65,14 @@ async fn test_add_signatory_with_owner_or_delegate_must_sign_error() {
let mut governance_test = GovernanceProgramTest::start_new().await;

let realm_cookie = governance_test.with_realm().await;
let governed_account_cookie = governance_test.with_governed_account().await;

let mut token_owner_record_cookie = governance_test
.with_community_token_deposit(&realm_cookie)
.await
.unwrap();

let mut governance_cookie = governance_test
.with_governance(
&realm_cookie,
&governed_account_cookie,
&token_owner_record_cookie,
)
.with_governance(&realm_cookie, &token_owner_record_cookie)
.await
.unwrap();

Expand Down Expand Up @@ -122,19 +112,14 @@ async fn test_add_signatory_with_invalid_proposal_owner_error() {
let mut governance_test = GovernanceProgramTest::start_new().await;

let realm_cookie = governance_test.with_realm().await;
let governed_account_cookie = governance_test.with_governed_account().await;

let mut token_owner_record_cookie = governance_test
.with_community_token_deposit(&realm_cookie)
.await
.unwrap();

let mut governance_cookie = governance_test
.with_governance(
&realm_cookie,
&governed_account_cookie,
&token_owner_record_cookie,
)
.with_governance(&realm_cookie, &token_owner_record_cookie)
.await
.unwrap();

Expand Down Expand Up @@ -171,7 +156,7 @@ async fn test_add_signatory_for_required_signatory() {
let mut governance_test = GovernanceProgramTest::start_new().await;

let realm_cookie = governance_test.with_realm().await;
let governed_account_cookie = governance_test.with_governed_account().await;

let signatory = Pubkey::new_unique();

let token_owner_record_cookie = governance_test
Expand All @@ -180,11 +165,7 @@ async fn test_add_signatory_for_required_signatory() {
.unwrap();

let mut governance_cookie = governance_test
.with_governance(
&realm_cookie,
&governed_account_cookie,
&token_owner_record_cookie,
)
.with_governance(&realm_cookie, &token_owner_record_cookie)
.await
.unwrap();

Expand Down Expand Up @@ -269,7 +250,7 @@ async fn test_add_signatory_for_required_signatory_multiple_times_err() {
let mut governance_test = GovernanceProgramTest::start_new().await;

let realm_cookie = governance_test.with_realm().await;
let governed_account_cookie = governance_test.with_governed_account().await;

let signatory = Pubkey::new_unique();

let token_owner_record_cookie = governance_test
Expand All @@ -278,11 +259,7 @@ async fn test_add_signatory_for_required_signatory_multiple_times_err() {
.unwrap();

let mut governance_cookie = governance_test
.with_governance(
&realm_cookie,
&governed_account_cookie,
&token_owner_record_cookie,
)
.with_governance(&realm_cookie, &token_owner_record_cookie)
.await
.unwrap();

Expand Down
37 changes: 5 additions & 32 deletions governance/program/tests/process_cancel_proposal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,14 @@ async fn test_cancel_proposal() {
let mut governance_test = GovernanceProgramTest::start_new().await;

let realm_cookie = governance_test.with_realm().await;
let governed_account_cookie = governance_test.with_governed_account().await;

let token_owner_record_cookie = governance_test
.with_community_token_deposit(&realm_cookie)
.await
.unwrap();

let mut governance_cookie = governance_test
.with_governance(
&realm_cookie,
&governed_account_cookie,
&token_owner_record_cookie,
)
.with_governance(&realm_cookie, &token_owner_record_cookie)
.await
.unwrap();

Expand Down Expand Up @@ -70,19 +65,14 @@ async fn test_cancel_proposal_with_already_completed_error() {
let mut governance_test = GovernanceProgramTest::start_new().await;

let realm_cookie = governance_test.with_realm().await;
let governed_account_cookie = governance_test.with_governed_account().await;

let token_owner_record_cookie = governance_test
.with_community_token_deposit(&realm_cookie)
.await
.unwrap();

let mut governance_cookie = governance_test
.with_governance(
&realm_cookie,
&governed_account_cookie,
&token_owner_record_cookie,
)
.with_governance(&realm_cookie, &token_owner_record_cookie)
.await
.unwrap();

Expand Down Expand Up @@ -117,19 +107,14 @@ async fn test_cancel_proposal_with_owner_or_delegate_must_sign_error() {
let mut governance_test = GovernanceProgramTest::start_new().await;

let realm_cookie = governance_test.with_realm().await;
let governed_account_cookie = governance_test.with_governed_account().await;

let mut token_owner_record_cookie = governance_test
.with_community_token_deposit(&realm_cookie)
.await
.unwrap();

let mut governance_cookie = governance_test
.with_governance(
&realm_cookie,
&governed_account_cookie,
&token_owner_record_cookie,
)
.with_governance(&realm_cookie, &token_owner_record_cookie)
.await
.unwrap();

Expand Down Expand Up @@ -165,19 +150,14 @@ async fn test_cancel_proposal_with_vote_time_expired_error() {
let mut governance_test = GovernanceProgramTest::start_new().await;

let realm_cookie = governance_test.with_realm().await;
let governed_account_cookie = governance_test.with_governed_account().await;

let token_owner_record_cookie = governance_test
.with_community_token_deposit(&realm_cookie)
.await
.unwrap();

let mut governance_cookie = governance_test
.with_governance(
&realm_cookie,
&governed_account_cookie,
&token_owner_record_cookie,
)
.with_governance(&realm_cookie, &token_owner_record_cookie)
.await
.unwrap();

Expand Down Expand Up @@ -214,7 +194,6 @@ async fn test_cancel_proposal_after_voting_cool_off_with_vote_time_expired_error
let mut governance_test = GovernanceProgramTest::start_new().await;

let realm_cookie = governance_test.with_realm().await;
let governed_account_cookie = governance_test.with_governed_account().await;

let token_owner_record_cookie = governance_test
.with_community_token_deposit(&realm_cookie)
Expand All @@ -228,7 +207,6 @@ async fn test_cancel_proposal_after_voting_cool_off_with_vote_time_expired_error
let mut governance_cookie = governance_test
.with_governance_using_config(
&realm_cookie,
&governed_account_cookie,
&token_owner_record_cookie,
&governance_config,
)
Expand Down Expand Up @@ -270,19 +248,14 @@ async fn test_cancel_proposal_in_voting_state() {
let mut governance_test = GovernanceProgramTest::start_new().await;

let realm_cookie = governance_test.with_realm().await;
let governed_account_cookie = governance_test.with_governed_account().await;

let token_owner_record_cookie = governance_test
.with_community_token_deposit(&realm_cookie)
.await
.unwrap();

let mut governance_cookie = governance_test
.with_governance(
&realm_cookie,
&governed_account_cookie,
&token_owner_record_cookie,
)
.with_governance(&realm_cookie, &token_owner_record_cookie)
.await
.unwrap();

Expand Down
Loading

0 comments on commit a25b35c

Please sign in to comment.