If I want to test my "slack_message_on_success" ho...
# ask-community
b
If I want to test my "slack_message_on_success" hook I understand that I have to use "build_hock_context", but it's unclear to me how I define a mock "op" to pass in as part of that context. Can anyone help out? Thanks!
Copy code
def test_slack_message_on_success():
    my_conn = mock.MagicMock()
    context = build_hook_context(job_name='test-job', resources={"slack": my_conn})
    slack_message_on_success(context)

    assert my_conn.send.call_count == 1
c
Hi Ben. I believe
build_hook_context
has an
op
argument, would you be able to pass your mock "op" through that argument?