Skip to content

Commit

Permalink
Fixup tests as a result of adding funds support to ModuleInstantiateInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
Jake Hartnell committed Sep 13, 2023
1 parent 1eb197a commit 9e904d9
Show file tree
Hide file tree
Showing 14 changed files with 105 additions and 18 deletions.
36 changes: 36 additions & 0 deletions contracts/dao-dao-core/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,15 @@ fn test_instantiate_with_n_gov_modules(n: usize) {
code_id: cw20_id,
msg: to_binary(&cw20_instantiate).unwrap(),
admin: Some(Admin::CoreModule {}),
funds: vec![],
label: "voting module".to_string(),
},
proposal_modules_instantiate_info: (0..n)
.map(|n| ModuleInstantiateInfo {
code_id: cw20_id,
msg: to_binary(&cw20_instantiate).unwrap(),
admin: Some(Admin::CoreModule {}),
funds: vec![],
label: format!("governance module {n}"),
})
.collect(),
Expand Down Expand Up @@ -191,19 +193,22 @@ fn test_instantiate_with_submessage_failure() {
code_id: cw20_id,
msg: to_binary(&cw20_instantiate).unwrap(),
admin: Some(Admin::CoreModule {}),
funds: vec![],
label: format!("governance module {n}"),
})
.collect::<Vec<_>>();
governance_modules.push(ModuleInstantiateInfo {
code_id: cw20_id,
msg: to_binary("bad").unwrap(),
admin: Some(Admin::CoreModule {}),
funds: vec![],
label: "I have a bad instantiate message".to_string(),
});
governance_modules.push(ModuleInstantiateInfo {
code_id: cw20_id,
msg: to_binary(&cw20_instantiate).unwrap(),
admin: Some(Admin::CoreModule {}),
funds: vec![],
label: "Everybody knowing
that goodness is good
makes wickedness."
Expand All @@ -222,6 +227,7 @@ makes wickedness."
code_id: cw20_id,
msg: to_binary(&cw20_instantiate).unwrap(),
admin: Some(Admin::CoreModule {}),
funds: vec![],
label: "voting module".to_string(),
},
proposal_modules_instantiate_info: governance_modules,
Expand Down Expand Up @@ -252,12 +258,14 @@ fn test_update_config() {
code_id: govmod_id,
msg: to_binary(&govmod_instantiate).unwrap(),
admin: Some(Admin::CoreModule {}),
funds: vec![],
label: "voting module".to_string(),
},
proposal_modules_instantiate_info: vec![ModuleInstantiateInfo {
code_id: govmod_id,
msg: to_binary(&govmod_instantiate).unwrap(),
admin: Some(Admin::CoreModule {}),
funds: vec![],
label: "voting module".to_string(),
}],
initial_items: None,
Expand Down Expand Up @@ -349,12 +357,14 @@ fn test_swap_governance(swaps: Vec<(u32, u32)>) {
code_id: propmod_id,
msg: to_binary(&govmod_instantiate).unwrap(),
admin: Some(Admin::CoreModule {}),
funds: vec![],
label: "voting module".to_string(),
},
proposal_modules_instantiate_info: vec![ModuleInstantiateInfo {
code_id: propmod_id,
msg: to_binary(&govmod_instantiate).unwrap(),
admin: Some(Admin::CoreModule {}),
funds: vec![],
label: "governance module".to_string(),
}],
initial_items: None,
Expand Down Expand Up @@ -418,6 +428,7 @@ fn test_swap_governance(swaps: Vec<(u32, u32)>) {
code_id: propmod_id,
msg: to_binary(&govmod_instantiate).unwrap(),
admin: Some(Admin::CoreModule {}),
funds: vec![],
label: format!("governance module {n}"),
})
.collect();
Expand Down Expand Up @@ -525,12 +536,14 @@ fn test_removed_modules_can_not_execute() {
code_id: govmod_id,
msg: to_binary(&govmod_instantiate).unwrap(),
admin: Some(Admin::CoreModule {}),
funds: vec![],
label: "voting module".to_string(),
},
proposal_modules_instantiate_info: vec![ModuleInstantiateInfo {
code_id: govmod_id,
msg: to_binary(&govmod_instantiate).unwrap(),
admin: Some(Admin::CoreModule {}),
funds: vec![],
label: "governance module".to_string(),
}],
initial_items: None,
Expand Down Expand Up @@ -566,6 +579,7 @@ fn test_removed_modules_can_not_execute() {
code_id: govmod_id,
msg: to_binary(&govmod_instantiate).unwrap(),
admin: Some(Admin::CoreModule {}),
funds: vec![],
label: "new governance module".to_string(),
}];

Expand Down Expand Up @@ -597,6 +611,7 @@ fn test_removed_modules_can_not_execute() {
code_id: govmod_id,
msg: to_binary(&govmod_instantiate).unwrap(),
admin: Some(Admin::CoreModule {}),
funds: vec![],
label: "new governance module".to_string(),
}];
let to_disable = vec![new_proposal_module.address.to_string()];
Expand Down Expand Up @@ -682,12 +697,14 @@ fn test_module_already_disabled() {
code_id: govmod_id,
msg: to_binary(&govmod_instantiate).unwrap(),
admin: Some(Admin::CoreModule {}),
funds: vec![],
label: "voting module".to_string(),
},
proposal_modules_instantiate_info: vec![ModuleInstantiateInfo {
code_id: govmod_id,
msg: to_binary(&govmod_instantiate).unwrap(),
admin: Some(Admin::CoreModule {}),
funds: vec![],
label: "governance module".to_string(),
}],
initial_items: None,
Expand Down Expand Up @@ -737,6 +754,7 @@ fn test_module_already_disabled() {
code_id: govmod_id,
msg: to_binary(&govmod_instantiate).unwrap(),
admin: Some(Admin::CoreModule {}),
funds: vec![],
label: "governance module".to_string(),
}],
to_disable,
Expand Down Expand Up @@ -781,12 +799,14 @@ fn test_swap_voting_module() {
code_id: govmod_id,
msg: to_binary(&govmod_instantiate).unwrap(),
admin: Some(Admin::CoreModule {}),
funds: vec![],
label: "voting module".to_string(),
},
proposal_modules_instantiate_info: vec![ModuleInstantiateInfo {
code_id: govmod_id,
msg: to_binary(&govmod_instantiate).unwrap(),
admin: Some(Admin::CoreModule {}),
funds: vec![],
label: "governance module".to_string(),
}],
initial_items: None,
Expand Down Expand Up @@ -833,6 +853,7 @@ fn test_swap_voting_module() {
code_id: govmod_id,
msg: to_binary(&govmod_instantiate).unwrap(),
admin: Some(Admin::CoreModule {}),
funds: vec![],
label: "voting module".to_string(),
},
})
Expand Down Expand Up @@ -882,12 +903,14 @@ fn test_permissions() {
code_id: govmod_id,
msg: to_binary(&govmod_instantiate).unwrap(),
admin: Some(Admin::CoreModule {}),
funds: vec![],
label: "voting module".to_string(),
},
proposal_modules_instantiate_info: vec![ModuleInstantiateInfo {
code_id: govmod_id,
msg: to_binary(&govmod_instantiate).unwrap(),
admin: Some(Admin::CoreModule {}),
funds: vec![],
label: "governance module".to_string(),
}],
initial_items: None,
Expand All @@ -914,6 +937,7 @@ fn test_permissions() {
code_id: govmod_id,
msg: to_binary(&govmod_instantiate).unwrap(),
admin: Some(Admin::CoreModule {}),
funds: vec![],
label: "voting module".to_string(),
},
},
Expand Down Expand Up @@ -981,12 +1005,14 @@ fn do_standard_instantiate(auto_add: bool, admin: Option<String>) -> (Addr, App)
code_id: voting_id,
msg: to_binary(&voting_instantiate).unwrap(),
admin: Some(Admin::CoreModule {}),
funds: vec![],
label: "voting module".to_string(),
},
proposal_modules_instantiate_info: vec![ModuleInstantiateInfo {
code_id: govmod_id,
msg: to_binary(&govmod_instantiate).unwrap(),
admin: Some(Admin::CoreModule {}),
funds: vec![],
label: "governance module".to_string(),
}],
initial_items: None,
Expand Down Expand Up @@ -1613,12 +1639,14 @@ fn test_list_items() {
code_id: voting_id,
msg: to_binary(&voting_instantiate).unwrap(),
admin: Some(Admin::CoreModule {}),
funds: vec![],
label: "voting module".to_string(),
},
proposal_modules_instantiate_info: vec![ModuleInstantiateInfo {
code_id: govmod_id,
msg: to_binary(&govmod_instantiate).unwrap(),
admin: Some(Admin::CoreModule {}),
funds: vec![],
label: "governance module".to_string(),
}],
initial_items: None,
Expand Down Expand Up @@ -1745,12 +1773,14 @@ fn test_instantiate_with_items() {
code_id: voting_id,
msg: to_binary(&voting_instantiate).unwrap(),
admin: Some(Admin::CoreModule {}),
funds: vec![],
label: "voting module".to_string(),
},
proposal_modules_instantiate_info: vec![ModuleInstantiateInfo {
code_id: govmod_id,
msg: to_binary(&govmod_instantiate).unwrap(),
admin: Some(Admin::CoreModule {}),
funds: vec![],
label: "governance module".to_string(),
}],
initial_items: Some(initial_items.clone()),
Expand Down Expand Up @@ -2576,12 +2606,14 @@ fn test_migrate_from_compatible() {
code_id: voting_id,
msg: to_binary(&voting_instantiate).unwrap(),
admin: Some(Admin::CoreModule {}),
funds: vec![],
label: "voting module".to_string(),
},
proposal_modules_instantiate_info: vec![ModuleInstantiateInfo {
code_id: govmod_id,
msg: to_binary(&govmod_instantiate).unwrap(),
admin: Some(Admin::CoreModule {}),
funds: vec![],
label: "governance module".to_string(),
}],
initial_items: None,
Expand Down Expand Up @@ -2859,25 +2891,29 @@ fn test_module_prefixes() {
code_id: govmod_id,
msg: to_binary(&govmod_instantiate).unwrap(),
admin: Some(Admin::CoreModule {}),
funds: vec![],
label: "voting module".to_string(),
},
proposal_modules_instantiate_info: vec![
ModuleInstantiateInfo {
code_id: govmod_id,
msg: to_binary(&govmod_instantiate).unwrap(),
admin: Some(Admin::CoreModule {}),
funds: vec![],
label: "proposal module 1".to_string(),
},
ModuleInstantiateInfo {
code_id: govmod_id,
msg: to_binary(&govmod_instantiate).unwrap(),
admin: Some(Admin::CoreModule {}),
funds: vec![],
label: "proposal module 2".to_string(),
},
ModuleInstantiateInfo {
code_id: govmod_id,
msg: to_binary(&govmod_instantiate).unwrap(),
admin: Some(Admin::CoreModule {}),
funds: vec![],
label: "proposal module 2".to_string(),
},
],
Expand Down
3 changes: 3 additions & 0 deletions contracts/external/cw-admin-factory/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,19 +84,22 @@ pub fn test_set_admin() {
code_id: cw20_code_id,
msg: to_binary(&cw20_instantiate).unwrap(),
admin: Some(Admin::CoreModule {}),
funds: vec![],
label: "voting module".to_string(),
},
proposal_modules_instantiate_info: vec![
ModuleInstantiateInfo {
code_id: cw20_code_id,
msg: to_binary(&cw20_instantiate).unwrap(),
admin: Some(Admin::CoreModule {}),
funds: vec![],
label: "prop module".to_string(),
},
ModuleInstantiateInfo {
code_id: cw20_code_id,
msg: to_binary(&cw20_instantiate).unwrap(),
admin: Some(Admin::CoreModule {}),
funds: vec![],
label: "prop module 2".to_string(),
},
],
Expand Down
1 change: 1 addition & 0 deletions contracts/external/dao-migrator/src/testing/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ pub fn execute_migration(
})
.unwrap(),
admin: Some(Admin::CoreModule {}),
funds: vec![],
label: "migrator".to_string(),
}],
to_disable: vec![],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ fn get_default_proposal_module_instantiate(
})
.unwrap(),
admin: Some(Admin::CoreModule {}),
funds: vec![],
label: "baby's first pre-propose module".to_string(),
},
},
Expand Down Expand Up @@ -1200,6 +1201,7 @@ fn test_instantiate_with_zero_native_deposit() {
})
.unwrap(),
admin: Some(Admin::CoreModule {}),
funds: vec![],
label: "baby's first pre-propose module".to_string(),
},
},
Expand Down Expand Up @@ -1263,6 +1265,7 @@ fn test_instantiate_with_zero_cw20_deposit() {
})
.unwrap(),
admin: Some(Admin::CoreModule {}),
funds: vec![],
label: "baby's first pre-propose module".to_string(),
},
},
Expand Down
2 changes: 2 additions & 0 deletions contracts/pre-propose/dao-pre-propose-approver/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ fn get_proposal_module_approval_single_instantiate(
})
.unwrap(),
admin: Some(Admin::CoreModule {}),
funds: vec![],
label: "baby's first pre-propose module, needs supervision".to_string(),
},
},
Expand Down Expand Up @@ -126,6 +127,7 @@ fn get_proposal_module_approver_instantiate(
})
.unwrap(),
admin: Some(Admin::CoreModule {}),
funds: vec![],
label: "approver module".to_string(),
},
},
Expand Down
3 changes: 3 additions & 0 deletions contracts/pre-propose/dao-pre-propose-multiple/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ fn get_default_proposal_module_instantiate(
})
.unwrap(),
admin: Some(Admin::CoreModule {}),
funds: vec![],
label: "baby's first pre-propose module".to_string(),
},
},
Expand Down Expand Up @@ -1059,6 +1060,7 @@ fn test_instantiate_with_zero_native_deposit() {
})
.unwrap(),
admin: Some(Admin::CoreModule {}),
funds: vec![],
label: "baby's first pre-propose module".to_string(),
},
},
Expand Down Expand Up @@ -1120,6 +1122,7 @@ fn test_instantiate_with_zero_cw20_deposit() {
})
.unwrap(),
admin: Some(Admin::CoreModule {}),
funds: vec![],
label: "baby's first pre-propose module".to_string(),
},
},
Expand Down
3 changes: 3 additions & 0 deletions contracts/pre-propose/dao-pre-propose-single/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ fn get_default_proposal_module_instantiate(
})
.unwrap(),
admin: Some(Admin::CoreModule {}),
funds: vec![],
label: "baby's first pre-propose module".to_string(),
},
},
Expand Down Expand Up @@ -995,6 +996,7 @@ fn test_instantiate_with_zero_native_deposit() {
})
.unwrap(),
admin: Some(Admin::CoreModule {}),
funds: vec![],
label: "baby's first pre-propose module".to_string(),
},
},
Expand Down Expand Up @@ -1056,6 +1058,7 @@ fn test_instantiate_with_zero_cw20_deposit() {
})
.unwrap(),
admin: Some(Admin::CoreModule {}),
funds: vec![],
label: "baby's first pre-propose module".to_string(),
},
},
Expand Down
Loading

0 comments on commit 9e904d9

Please sign in to comment.