# Path: sectesting/streetart/tests/cases/base.py
# class BaseViewTestCase(BaseStreetArtTestCase):
#     """
#     This is a base class for all test cases that run tests on a view specified within the test
#     case constructor.
#     """
# 
#     def __init__(self, view=None, *args, **kwargs):
#         self.view = view
#         super(BaseViewTestCase, self).__init__(*args, **kwargs)
# 
# class BaseViewVerbTestCase(BaseViewTestCase):
#     """
#     This is a base class for all test cases that run tests on a view and a verb specified within the
#     test case constructor.
#     """
# 
#     def __init__(self, verb=None, *args, **kwargs):
#         self.verb = verb
#         super(BaseViewVerbTestCase, self).__init__(*args, **kwargs)


from .base import BaseViewTestCase, BaseViewVerbTestCase
# -*- coding: utf-8 -*-
from __future__ import absolute_import



class RegularUnknownMethodsTestCase(BaseViewTestCase):
    """
    This is a test case for testing whether or not a view returns the expected HTTP verbs through
    an OPTIONS request from a regular user.
    """

    def runTest(self):
        """
        Tests that the HTTP verbs returned by an OPTIONS request match the expected values.
        :return: None
        """
        requestor = self._get_requestor_for_view(self.view)
        response = requestor.send_options(user_string="user_1")
        allowed_verbs = response._headers.get("allow", None)
        if not allowed_verbs:
            raise ValueError("No allow header returned by view %s." % self.view)
        allowed_verbs = [x.strip().lower() for x in allowed_verbs[1].split(",")]
        supported_verbs = [x.lower() for x in requestor.supported_verbs]
        self.assertTrue(
            all([x.lower() in supported_verbs for x in allowed_verbs]),
            "Unexpected verbs found for view %s. Expected %s, got %s."
            % (self.view, [x.upper() for x in supported_verbs], [x.upper() for x in allowed_verbs])
        )



# Path: sectesting/streetart/tests/cases/base.py
# class BaseViewTestCase(BaseStreetArtTestCase):
#     """
#     This is a base class for all test cases that run tests on a view specified within the test
#     case constructor.
#     """
# 
#     def __init__(self, view=None, *args, **kwargs):
#         self.view = view
#         super(BaseViewTestCase, self).__init__(*args, **kwargs)
# 
# class BaseViewVerbTestCase(BaseViewTestCase):
#     """
#     This is a base class for all test cases that run tests on a view and a verb specified within the
#     test case constructor.
#     """
# 
#     def __init__(self, verb=None, *args, **kwargs):
#         self.verb = verb
#         super(BaseViewVerbTestCase, self).__init__(*args, **kwargs)


# Path: sectesting/streetart/tests/cases/hidden.py
from .base import BaseViewTestCase, BaseViewVerbTestCase

# -*- coding: utf-8 -*-
from __future__ import absolute_import



class RegularUnknownMethodsTestCase(BaseViewTestCase):
    """
    This is a test case for testing whether or not a view returns the expected HTTP verbs through
    an OPTIONS request from a regular user.
    """

    def runTest(self):
        """
        Tests that the HTTP verbs returned by an OPTIONS request match the expected values.
        :return: None
        """
        requestor = self._get_requestor_for_view(self.view)
        response = requestor.send_options(user_string="user_1")
        allowed_verbs = response._headers.get("allow", None)
        if not allowed_verbs:
            raise ValueError("No allow header returned by view %s." % self.view)
        allowed_verbs = [x.strip().lower() for x in allowed_verbs[1].split(",")]
        supported_verbs = [x.lower() for x in requestor.supported_verbs]
        self.assertTrue(
            all([x.lower() in supported_verbs for x in allowed_verbs]),
            "Unexpected verbs found for view %s. Expected %s, got %s."
            % (self.view, [x.upper() for x in supported_verbs], [x.upper() for x in allowed_verbs])
        )



class AdminUnknownMethodsTestCase(BaseViewTestCase):