# Path: premis_event_service/views.py
# ARK_ID_REGEX = re.compile(r'ark:/'+str(ARK_NAAN)+r'/\w.*')
# MAINTENANCE_MSG = settings.MAINTENANCE_MSG
# EVENT_UPDATE_TRANSLATION_DICT = xpath_map
# XML_HEADER = b"<?xml version=\"1.0\"?>\n%s"
# EVENT_SEARCH_PER_PAGE = 200
#     DATE_FORMAT = "%m/%d/%Y"
# def get_request_body(request):
# def app(request):
# def humanEvent(request, identifier=None):
# def last_page_ordinal(query_set, per_page=20):
# def get_page_offsets(query_set, page, page_range, page_lims, per_page=20):
# def paginate_events(valid, request, per_page=20):
# def event_search(request):
# def json_event_search(request):
# def recent_event_list(request):
# def json_agent(request, identifier=None):
# def humanAgent(request, identifier=None):
# def eventXML(request, identifier=None):
# def findEvent(request, linked_identifier, event_type=None):
# def agentXML(request, identifier):
# def app_event(request, identifier=None):
# def app_agent(request, identifier=None):
# 
# Path: premis_event_service/models.py
# AGENT_TYPE_CHOICES = [
#     ('Personal', 'Personal'),
#     ('Organization', 'Organization'),
#     ('Event', 'Event'),
#     ('Software', 'Software'),
# ]
# class Agent(models.Model):
#     class Meta:
# class LinkObject(models.Model):
# class EventManager(models.Manager):
# class Event(models.Model):
#     class Meta:
# class EventLinkObject(models.Model):
#     class Meta:
#     def __str__(self):
#     def get_absolute_url(self):
#     def __str__(self):
#     def search(self, **kwargs):
#     def searchunfilt(self, max_ordinal=None):
#     def __str__(self):
#     def link_objects_string(self):
#     def is_good(self):
# 
# Path: premis_event_service/settings.py
# EVENT_TYPE_CHOICES = getattr(
#     settings, 'EVENT_TYPE_CHOICES',
#     (
#         ('', 'None'),
#         ('http://purl.org/net/untl/vocabularies/preservationEvents/#fixityCheck', 'Fixity Check'),
#         ('http://purl.org/net/untl/vocabularies/preservationEvents/#replication', 'Replication'),
#         ('http://purl.org/net/untl/vocabularies/preservationEvents/#ingestion', 'Ingestion'),
#         ('http://purl.org/net/untl/vocabularies/preservationEvents/#migration', 'Migration'),
#     )
# )
# 
# EVENT_OUTCOME_CHOICES = getattr(
#     settings, 'EVENT_OUTCOME_CHOICES',
#     (
#         ('', 'None'),
#         ('http://purl.org/net/untl/vocabularies/eventOutcomes/#success', 'Success'),
#         ('http://purl.org/net/untl/vocabularies/eventOutcomes/#failure', 'Failure'),
#     )
# )


import json
import random
import pytest
from lxml import objectify
from django.urls import reverse
from django.http import Http404
from django.utils.http import urlquote
from datetime import datetime
from premis_event_service import views, models
from premis_event_service.settings import EVENT_TYPE_CHOICES, EVENT_OUTCOME_CHOICES
from . import factories
        views.app_agent(request)

    def test_put_without_identifier_returns_bad_request(self, rf):
        request = rf.put('/')
        response = views.app_agent(request)
        assert response.status_code == 400

    def test_delete_without_identifier_returns_bad_request(self, rf):
        request = rf.delete('/')
        response = views.app_agent(request)
        assert response.status_code == 400

    def test_invalid_identifier_returns_not_found(self, rf):
        """Test that a nonexistent Agent identifier results in a
        404 Not Found.
        """
        request = rf.get('/')
        response = views.app_agent(request, 'fake-identifier')
        assert response.status_code == 404

    def test_delete_returns_ok(self, rf):
        agent = factories.AgentFactory.create()
        request = rf.delete('/')
        response = views.app_agent(request, agent.agent_identifier)
        assert response.status_code == 200

    def test_delete_removes_agent(self, rf):
        agent = factories.AgentFactory.create()
        request = rf.delete('/')
        views.app_agent(request, agent.agent_identifier)

# Path: premis_event_service/views.py
# ARK_ID_REGEX = re.compile(r'ark:/'+str(ARK_NAAN)+r'/\w.*')
# MAINTENANCE_MSG = settings.MAINTENANCE_MSG
# EVENT_UPDATE_TRANSLATION_DICT = xpath_map
# XML_HEADER = b"<?xml version=\"1.0\"?>\n%s"
# EVENT_SEARCH_PER_PAGE = 200
#     DATE_FORMAT = "%m/%d/%Y"
# def get_request_body(request):
# def app(request):
# def humanEvent(request, identifier=None):
# def last_page_ordinal(query_set, per_page=20):
# def get_page_offsets(query_set, page, page_range, page_lims, per_page=20):
# def paginate_events(valid, request, per_page=20):
# def event_search(request):
# def json_event_search(request):
# def recent_event_list(request):
# def json_agent(request, identifier=None):
# def humanAgent(request, identifier=None):
# def eventXML(request, identifier=None):
# def findEvent(request, linked_identifier, event_type=None):
# def agentXML(request, identifier):
# def app_event(request, identifier=None):
# def app_agent(request, identifier=None):
# 
# Path: premis_event_service/models.py
# AGENT_TYPE_CHOICES = [
#     ('Personal', 'Personal'),
#     ('Organization', 'Organization'),
#     ('Event', 'Event'),
#     ('Software', 'Software'),
# ]
# class Agent(models.Model):
#     class Meta:
# class LinkObject(models.Model):
# class EventManager(models.Manager):
# class Event(models.Model):
#     class Meta:
# class EventLinkObject(models.Model):
#     class Meta:
#     def __str__(self):
#     def get_absolute_url(self):
#     def __str__(self):
#     def search(self, **kwargs):
#     def searchunfilt(self, max_ordinal=None):
#     def __str__(self):
#     def link_objects_string(self):
#     def is_good(self):
# 
# Path: premis_event_service/settings.py
# EVENT_TYPE_CHOICES = getattr(
#     settings, 'EVENT_TYPE_CHOICES',
#     (
#         ('', 'None'),
#         ('http://purl.org/net/untl/vocabularies/preservationEvents/#fixityCheck', 'Fixity Check'),
#         ('http://purl.org/net/untl/vocabularies/preservationEvents/#replication', 'Replication'),
#         ('http://purl.org/net/untl/vocabularies/preservationEvents/#ingestion', 'Ingestion'),
#         ('http://purl.org/net/untl/vocabularies/preservationEvents/#migration', 'Migration'),
#     )
# )
# 
# EVENT_OUTCOME_CHOICES = getattr(
#     settings, 'EVENT_OUTCOME_CHOICES',
#     (
#         ('', 'None'),
#         ('http://purl.org/net/untl/vocabularies/eventOutcomes/#success', 'Success'),
#         ('http://purl.org/net/untl/vocabularies/eventOutcomes/#failure', 'Failure'),
#     )
# )


# Path: tests/test_views.py
import json
import random
import pytest
from lxml import objectify
from django.urls import reverse
from django.http import Http404
from django.utils.http import urlquote
from datetime import datetime
from premis_event_service import views, models
from premis_event_service.settings import EVENT_TYPE_CHOICES, EVENT_OUTCOME_CHOICES
from . import factories

        views.app_agent(request)

    def test_put_without_identifier_returns_bad_request(self, rf):
        request = rf.put('/')
        response = views.app_agent(request)
        assert response.status_code == 400

    def test_delete_without_identifier_returns_bad_request(self, rf):
        request = rf.delete('/')
        response = views.app_agent(request)
        assert response.status_code == 400

    def test_invalid_identifier_returns_not_found(self, rf):
        """Test that a nonexistent Agent identifier results in a
        404 Not Found.
        """
        request = rf.get('/')
        response = views.app_agent(request, 'fake-identifier')
        assert response.status_code == 404

    def test_delete_returns_ok(self, rf):
        agent = factories.AgentFactory.create()
        request = rf.delete('/')
        response = views.app_agent(request, agent.agent_identifier)
        assert response.status_code == 200

    def test_delete_removes_agent(self, rf):
        agent = factories.AgentFactory.create()
        request = rf.delete('/')
        views.app_agent(request, agent.agent_identifier)

        assert models.Agent.objects.count() == 0