# Path: sectesting/streetart/tests/registry.py
# class TestRequestorRegistry(object):
#     """
#     This is a class that maintains mappings from views to test cases that are configured to
#     send HTTP requests to the view in question.
#     """
# 
#     # Class Members
# 
#     # Instantiation
# 
#     def __init__(self):
#         self._registry = {}
# 
#     # Static Methods
# 
#     # Class Methods
# 
#     # Public Methods
# 
#     def add_mapping(self, requestor_path=None, requested_view=None):
#         """
#         Add a mapping from the view to the given requestor class specified by requestor_path.
#         :param requestor_path: The path to the requestor class configured for the given view.
#         :param requested_view: The view that the requestor is meant to send requests for.
#         :return: None
#         """
#         try:
#             requestor_class = self.__import_class(requestor_path)
#         except (ImportError, AttributeError) as e:
#             raise RequestorNotFoundException(
#                 "Unable to load requestor at %s: %s."
#                 % (requestor_path, e.message)
#             )
#         if not issubclass(requestor_class, BaseRequestor):
#             raise InvalidRequestorException(
#                 "Class of %s is not a valid requestor class."
#                 % (requestor_class.__name__,)
#             )
#         self._registry[requested_view] = requestor_class
# 
#     def does_view_have_mapping(self, view):
#         """
#         Check to see if a mapping exists between the given view and a requestor class.
#         :param view: The view to check a mapping for.
#         :return: Whether or not a mapping exists for the given view.
#         """
#         return view in self.registry
# 
#     def get_requestor_for_view(self, view):
#         """
#         Get the requestor configured to send requests to the given view.
#         :param view: The view to retrieve the requestor for.
#         :return: The requestor configured to send requests to the given view.
#         """
#         return self.registry[view]
# 
#     def print_mappings(self):
#         """
#         Print all of the mappings currently stored within the registry.
#         :return: None
#         """
#         for k, v in self.registry.iteritems():
#             print("%s --> %s" % (k, v))
# 
#     # Protected Methods
# 
#     # Private Methods
# 
#     def __import_class(self, class_path):
#         """
#         Import the class at the given class path and return it.
#         :param class_path: The class path to the class to load.
#         :return: The loaded class.
#         """
#         components = class_path.split(".")
#         mod = __import__(components[0])
#         for component in components[1:]:
#             mod = getattr(mod, component)
#         return mod
# 
#     # Properties
# 
#     @property
#     def registry(self):
#         """
#         Get the registry mapping functions and classes to the test classes that are configured to
#         submit HTTP requests to them.
#         :return: the registry mapping functions and classes to the test classes that are
#         configured to submit HTTP requests to them.
#         """
#         return self._registry
# 
#     # Representation and Comparison


from django.test import TestCase
from ..registry import TestRequestorRegistry
        Assert that the contents of the given response indicate a redirect.
        :param response: The response to check.
        :param message: The message to print upon failure.
        :return: None
        """
        self.assertIn(
            response.status_code,
            [301, 302],
            msg=message,
        )

    def _assert_response_successful(self, response, message):
        """
        Assert that the contents of the given response indicate a successful response.
        :param response: The response to check.
        :param message: The message to print upon failure.
        :return: None
        """
        self.assertIn(
            response.status_code,
            [200, 201, 202, 301, 302],
            msg=message,
        )

    def _get_requestor_for_view(self, view):
        """
        Get the requestor class to use to send requests to the given view.
        :param view: The view to retrieve the requestor class for.
        :return: The requestor class to use to send requests to the given view.
        """

# Path: sectesting/streetart/tests/registry.py
# class TestRequestorRegistry(object):
#     """
#     This is a class that maintains mappings from views to test cases that are configured to
#     send HTTP requests to the view in question.
#     """
# 
#     # Class Members
# 
#     # Instantiation
# 
#     def __init__(self):
#         self._registry = {}
# 
#     # Static Methods
# 
#     # Class Methods
# 
#     # Public Methods
# 
#     def add_mapping(self, requestor_path=None, requested_view=None):
#         """
#         Add a mapping from the view to the given requestor class specified by requestor_path.
#         :param requestor_path: The path to the requestor class configured for the given view.
#         :param requested_view: The view that the requestor is meant to send requests for.
#         :return: None
#         """
#         try:
#             requestor_class = self.__import_class(requestor_path)
#         except (ImportError, AttributeError) as e:
#             raise RequestorNotFoundException(
#                 "Unable to load requestor at %s: %s."
#                 % (requestor_path, e.message)
#             )
#         if not issubclass(requestor_class, BaseRequestor):
#             raise InvalidRequestorException(
#                 "Class of %s is not a valid requestor class."
#                 % (requestor_class.__name__,)
#             )
#         self._registry[requested_view] = requestor_class
# 
#     def does_view_have_mapping(self, view):
#         """
#         Check to see if a mapping exists between the given view and a requestor class.
#         :param view: The view to check a mapping for.
#         :return: Whether or not a mapping exists for the given view.
#         """
#         return view in self.registry
# 
#     def get_requestor_for_view(self, view):
#         """
#         Get the requestor configured to send requests to the given view.
#         :param view: The view to retrieve the requestor for.
#         :return: The requestor configured to send requests to the given view.
#         """
#         return self.registry[view]
# 
#     def print_mappings(self):
#         """
#         Print all of the mappings currently stored within the registry.
#         :return: None
#         """
#         for k, v in self.registry.iteritems():
#             print("%s --> %s" % (k, v))
# 
#     # Protected Methods
# 
#     # Private Methods
# 
#     def __import_class(self, class_path):
#         """
#         Import the class at the given class path and return it.
#         :param class_path: The class path to the class to load.
#         :return: The loaded class.
#         """
#         components = class_path.split(".")
#         mod = __import__(components[0])
#         for component in components[1:]:
#             mod = getattr(mod, component)
#         return mod
# 
#     # Properties
# 
#     @property
#     def registry(self):
#         """
#         Get the registry mapping functions and classes to the test classes that are configured to
#         submit HTTP requests to them.
#         :return: the registry mapping functions and classes to the test classes that are
#         configured to submit HTTP requests to them.
#         """
#         return self._registry
# 
#     # Representation and Comparison


# Path: sectesting/streetart/tests/cases/base.py
from django.test import TestCase
from ..registry import TestRequestorRegistry

        Assert that the contents of the given response indicate a redirect.
        :param response: The response to check.
        :param message: The message to print upon failure.
        :return: None
        """
        self.assertIn(
            response.status_code,
            [301, 302],
            msg=message,
        )

    def _assert_response_successful(self, response, message):
        """
        Assert that the contents of the given response indicate a successful response.
        :param response: The response to check.
        :param message: The message to print upon failure.
        :return: None
        """
        self.assertIn(
            response.status_code,
            [200, 201, 202, 301, 302],
            msg=message,
        )

    def _get_requestor_for_view(self, view):
        """
        Get the requestor class to use to send requests to the given view.
        :param view: The view to retrieve the requestor class for.
        :return: The requestor class to use to send requests to the given view.
        """

        registry = TestRequestorRegistry.instance()