Skip to content

Commit 4a38542

Browse files
authored
Merge pull request #2409 from CosmWasm/rm-mock_info
Remove mock_info
2 parents 55c5e8c + c116ddb commit 4a38542

File tree

4 files changed

+7
-32
lines changed

4 files changed

+7
-32
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ and this project adheres to
5555
of `::new`. ([#2399])
5656
- cosmwasm-std: Move `MemoryStorage` to `cosmwasm_std::testing::MockStorage`.
5757
([#2237])
58+
- cosmwasm-std: Remove previously deprecated `cosmwast_std::testing::mock_info`.
59+
Use `cosmwasm_std::testing::message_info` instead. ([#2393])
5860

5961
## Fixed
6062

@@ -78,6 +80,7 @@ and this project adheres to
7880
[#2378]: https://github.com/CosmWasm/cosmwasm/issues/2378
7981
[#2383]: https://github.com/CosmWasm/cosmwasm/issues/2383
8082
[#2390]: https://github.com/CosmWasm/cosmwasm/issues/2390
83+
[#2393]: https://github.com/CosmWasm/cosmwasm/issues/2393
8184
[#2399]: https://github.com/CosmWasm/cosmwasm/pull/2399
8285
[#2403]: https://github.com/CosmWasm/cosmwasm/pull/2403
8386

packages/std/src/coin.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,6 @@ pub fn coins(amount: u128, denom: impl Into<String>) -> Vec<Coin> {
8484
///
8585
/// ```
8686
/// # use cosmwasm_std::{coin, BankMsg, CosmosMsg, Response, SubMsg};
87-
/// # use cosmwasm_std::testing::{mock_env, mock_info};
88-
/// # let env = mock_env();
8987
/// # let recipient = "blub".to_string();
9088
/// let tip = vec![
9189
/// coin(123, "ucosm"),

packages/std/src/testing/mock.rs

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ use crate::query::{
3939
use crate::query::{DelegatorWithdrawAddressResponse, DistributionQuery};
4040
use crate::results::{ContractResult, Empty, SystemResult};
4141
use crate::traits::{Api, Querier, QuerierResult};
42-
use crate::types::{BlockInfo, ContractInfo, Env, MessageInfo, TransactionInfo};
42+
use crate::types::{BlockInfo, ContractInfo, Env, TransactionInfo};
4343
use crate::{from_json, to_json_binary, Binary, Uint128};
4444
#[cfg(feature = "cosmwasm_1_3")]
4545
use crate::{
@@ -406,16 +406,6 @@ pub fn mock_env() -> Env {
406406
}
407407
}
408408

409-
/// Just set sender and funds for the message.
410-
/// This is intended for use in test code only.
411-
#[deprecated(note = "This is inconvenient and unsafe. Use message_info instead.")]
412-
pub fn mock_info(sender: &str, funds: &[Coin]) -> MessageInfo {
413-
MessageInfo {
414-
sender: Addr::unchecked(sender),
415-
funds: funds.to_vec(),
416-
}
417-
}
418-
419409
/// Creates an IbcChannel for testing. You set a few key parameters for handshaking,
420410
/// If you want to set more, use this as a default and mutate other fields
421411
#[cfg(feature = "stargate")]
@@ -1239,9 +1229,11 @@ pub fn mock_wasmd_attr(key: impl Into<String>, value: impl Into<String>) -> Attr
12391229
#[cfg(test)]
12401230
mod tests {
12411231
use super::*;
1232+
#[allow(unused)]
1233+
use crate::coins;
12421234
#[cfg(feature = "cosmwasm_1_3")]
12431235
use crate::DenomUnit;
1244-
use crate::{coin, coins, instantiate2_address, ContractInfoResponse, HexBinary, Response};
1236+
use crate::{coin, instantiate2_address, ContractInfoResponse, HexBinary, Response};
12451237
#[cfg(feature = "staking")]
12461238
use crate::{Decimal, Delegation};
12471239
use base64::{engine::general_purpose, Engine};
@@ -1280,22 +1272,6 @@ mod tests {
12801272
assert_eq!(contract_address, Addr::unchecked(MOCK_CONTRACT_ADDR));
12811273
}
12821274

1283-
#[test]
1284-
fn mock_info_works() {
1285-
#[allow(deprecated)]
1286-
let info = mock_info("my name", &coins(100, "atom"));
1287-
assert_eq!(
1288-
info,
1289-
MessageInfo {
1290-
sender: Addr::unchecked("my name"),
1291-
funds: vec![Coin {
1292-
amount: 100u128.into(),
1293-
denom: "atom".into(),
1294-
}]
1295-
}
1296-
);
1297-
}
1298-
12991275
#[test]
13001276
fn addr_validate_works() {
13011277
// default prefix is 'cosmwasm'

packages/std/src/testing/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ pub use assertions::assert_hash_works_impl;
1515
pub use message_info::message_info;
1616
#[cfg(feature = "ibc2")]
1717
pub use mock::mock_ibc2_packet_recv;
18-
#[allow(deprecated)]
19-
pub use mock::mock_info;
2018
#[cfg(feature = "cosmwasm_1_3")]
2119
pub use mock::DistributionQuerier;
2220
#[cfg(feature = "staking")]

0 commit comments

Comments
 (0)