# Path: djangoevents/shortcuts.py
# def get_entity_or_404(repo, entity_id):
#     warnings.warn("`get_entity_or_404` is depreciated. Please switch to: `get_aggregate_or_404`", DeprecationWarning)
#     return get_aggregate_or_404(repo, entity_id)
# 
# def get_aggregate_or_404(repo, aggregate_id):
#     """
#     Uses `repo` to return most recent state of the aggregate. Raises a Http404 exception if the
#     `aggregate_id` does not exist.
# 
#     `repo` has to be a EventSourcedRepository object.
#     """
#     if aggregate_id not in repo:
#         raise Http404
#     return repo[aggregate_id]


from ..shortcuts import get_entity_or_404, get_aggregate_or_404
from django.http import Http404
import pytest



def test_get_entity_or_404_item_exists():
    """
    ES store provides a dictionary style item verification.
    """
    repo = {'id': 'entity'}
    assert get_entity_or_404(repo, 'id') == 'entity'


def test_get_entity_or_404_item_does_not_exists():
    repo = {}
    with pytest.raises(Http404) as exc_info:

# Path: djangoevents/shortcuts.py
# def get_entity_or_404(repo, entity_id):
#     warnings.warn("`get_entity_or_404` is depreciated. Please switch to: `get_aggregate_or_404`", DeprecationWarning)
#     return get_aggregate_or_404(repo, entity_id)
# 
# def get_aggregate_or_404(repo, aggregate_id):
#     """
#     Uses `repo` to return most recent state of the aggregate. Raises a Http404 exception if the
#     `aggregate_id` does not exist.
# 
#     `repo` has to be a EventSourcedRepository object.
#     """
#     if aggregate_id not in repo:
#         raise Http404
#     return repo[aggregate_id]


# Path: djangoevents/tests/test_shortcuts.py
from ..shortcuts import get_entity_or_404, get_aggregate_or_404
from django.http import Http404
import pytest




def test_get_entity_or_404_item_exists():
    """
    ES store provides a dictionary style item verification.
    """
    repo = {'id': 'entity'}
    assert get_entity_or_404(repo, 'id') == 'entity'


def test_get_entity_or_404_item_does_not_exists():
    repo = {}
    with pytest.raises(Http404) as exc_info:

        get_entity_or_404(repo, 'id')