def METHOD_NAME(
    repository,
    remote_repository,
    remote,
    available_remotes,
    upstream,
    expected_target,
    expected_remote,
):
    repository = Repository.from_schema(repository)
    remote_repository = Repository.from_schema(remote_repository) if remote_repository else None
    fake_config = {"remotes": {s: {"SG_NAMESPACE": "user"} for s in available_remotes}}
    with mock.patch.object(Repository, "upstream", new_callable=PropertyMock) as up:
        up.return_value = upstream
        with mock.patch("splitgraph.commandline.push_pull.REMOTES", available_remotes):
            with mock.patch("splitgraph.commandline.push_pull.CONFIG", fake_config):
                with mock.patch("splitgraph.engine.config.get_engine") as ge:
                    ge.return_value = Mock()
                    ge.return_value.name = expected_remote
                    if isinstance(expected_target, type):
                        with pytest.raises(expected_target):
                            _determine_push_target(repository, remote_repository, remote)
                    else:
                        result = _determine_push_target(repository, remote_repository, remote)
                        if upstream:
                            assert result == upstream
                        else:
                            assert result.to_schema() == expected_target
                            ge_call = ge.mock_calls[0]
                            assert ge_call[1][0] == expected_remote
                            assert result.engine.name == expected_remote