# How to mock ic\_cdk::caller() ? when using dfx command line to test functions?

**URL:** <https://forum.dfinity.org/t/how-to-mock-ic-cdk-caller-when-using-dfx-command-line-to-test-functions/22964>\
**Category:** Developers\
**Tags:** Discussing, dfx\
**Created:** [September 12, 2023, 11:51am UTC](https://forum.dfinity.org/t/how-to-mock-ic-cdk-caller-when-using-dfx-command-line-to-test-functions/22964 "2023-09-12T11:51:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![q2333gh](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/q2333gh/32/36020_2.png) [@q2333gh](https://forum.dfinity.org/u/q2333gh)\
**Post date:** [September 12, 2023, 11:51am UTC](https://forum.dfinity.org/t/how-to-mock-ic-cdk-caller-when-using-dfx-command-line-to-test-functions/22964/1 "2023-09-12T11:51:17Z")

</div>

such as:

```rust
#[update(guard = "user_owner_guard")]
fn delete_wallet(wallet_addr: String) -> Result<bool, String> {
    CONTEXT.with(|c| {
        let mut ctx = c.borrow_mut();
        let user = ctx.env.caller();
        ctx.user_service
            .delete_wallet(&user, wallet_addr)
            .ok_or(String::from("WalletNotFound"))
    })
}

```

I tried this 🙂

```auto
dfx canister call backend delete_wallet "b76rz-axcfs-swjig-bzzpx-yt5g7-2vcpg-wmb7i-2mz7s-upd4f-mag4c-yae"

```

but not work .  
says:

```auto
  The replica returned a replica error: Replica Error: reject code CanisterReject, reject message caller is not owner, error code None

```

which is a command need the ic\_cdk::caller() function.  
I have read the offical doc . but didnt find out solution.

---

<div class="post-metadata">

**Author:** ![Vivienne](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/vivienne/32/29170_2.png) [@Vivienne](https://forum.dfinity.org/u/Vivienne)\
**Post date:** [September 12, 2023, 2:20pm UTC](https://forum.dfinity.org/t/how-to-mock-ic-cdk-caller-when-using-dfx-command-line-to-test-functions/22964/2 "2023-09-12T14:20:54Z")

</div>

have a look at the options of `dfx identity`: `dfx identity --help`. You can create a few different ones to test with
