def test__find_owner_account_for_webhook_event_trigger(
    mock__get_or_retrieve,
    mock_get_or_retrieve_for_api_key,
    api_key,
    stripe_account,
    has_account_key,
):
    """
    Test that the correct classmethod is invoked with the correct arguments
    to get the owner account
    """

    # should fake_data have the account key
    if has_account_key:
        # fake_data used to invoke _find_owner_account classmethod
        fake_data = {
            "id": "test_XXXXXXXX",
            "livemode": False,
            "object": "event",
            "account": stripe_account,
        }
    else:
        # fake_data used to invoke _find_owner_account classmethod
        fake_data = {
            "id": "test_XXXXXXXX",
            "livemode": False,
            "object": "event",
        }

    if api_key is None:
        # invoke _find_owner_account without the api_key parameter
        StripeModel._find_owner_account(fake_data)
    else:
        # invoke _find_owner_account with the api_key parameter
        StripeModel._find_owner_account(fake_data, api_key=api_key)

    if has_account_key and stripe_account:
        if api_key:
            mock__get_or_retrieve.assert_called_once_with(
                id=stripe_account, api_key=api_key
            )
        else:
            mock__get_or_retrieve.assert_called_once_with(
                id=stripe_account, api_key=djstripe_settings.STRIPE_SECRET_KEY
            )

    else:
        if api_key:
            mock_get_or_retrieve_for_api_key.assert_called_once_with(api_key)
        else:
            mock_get_or_retrieve_for_api_key.assert_called_once_with(
                djstripe_settings.STRIPE_SECRET_KEY
            )

    Test that the correct classmethod is invoked with the correct arguments
    to get the owner account
    
tests/test_stripe_model.py