from importlib import import_module
from unittest import TestCase as UnitTestCase

from django.contrib.auth.models import Group
from django.core.management import BaseCommand
from django.conf import settings
from django.test import TestCase
from django.views.generic import TemplateView
try:
    from unittest.mock import Mock, patch, MagicMock
except:
    from mock import Mock, patch

from django_roles_access.decorator import access_by_role
from django_roles_access.mixin import RolesMixin
from django_roles_access.models import ViewAccess
from tests import views
from django_roles_access.utils import (walk_site_url, get_views_by_app,
                                       view_access_analyzer,
                                       get_view_analyze_report,
                                       check_django_roles_is_used,
                                       analyze_by_role, APP_NAME_FOR_NONE,
                                       NOT_SECURED_DEFAULT, SECURED_DEFAULT,
                                       PUBLIC_DEFAULT, NONE_TYPE_DEFAULT,
                                       DISABLED_DEFAULT, OutputReport)


class MockRegex:
    def __init__(self):
        self.pattern = '^fake-regex-pattern/$'


class MockRegexResolver:
    def __init__(self):
        self.pattern = '^fake-resolver/'


class MockRegexResolverNested:
    def __init__(self):
        self.pattern = '^fake-nested-resolver/'


class MockPattern:
    def __init__(self):
        self.regex = MockRegex()
        self.callback = 'fake-callback'
        self.name = 'fake-view-name'


class MockResolver:
    def __init__(self):
        self.url_patterns = [MockPattern()]
        self.regex = MockRegexResolver()
        self.app_name = 'fake-app-name'
        self.namespace = 'fake-namespace'


class MockResolverNested:
    def __init__(self):
        self.url_patterns = [MockResolver()]
        self.regex = MockRegexResolverNested()
        self.app_name = 'fake-app-name'
        self.namespace = 'nested-namespace'


class MockPatternDjango2:
    def __init__(self):
        self.pattern = '^fake-pattern/'
        self.callback = 'fake-callback'
        self.name = 'fake-view-name'


class MockPatternDjango2None:
    def __init__(self):
        self.pattern = '^fake-pattern/'
        self.callback = 'fake-callback'
        self.name = 'fake-view-none'


class MockResolverDjango2:
    def __init__(self):
        self.pattern = '^fake-resolver/'
        self.url_patterns = [MockPatternDjango2()]
        self.app_name = 'fake-app-name'
        self.namespace = 'fake-namespace'


class MockResolverDjango2None:
    def __init__(self):
        self.pattern = '^fake-resolver/'
        self.url_patterns = [MockPatternDjango2None()]
        self.app_name = None
        self.namespace = None


class MockResolverDjango2None2:
    def __init__(self):
        self.pattern = '^fake-resolver/'
        self.url_patterns = [MockResolverDjango2None()]
        self.app_name = 'fake-app-name'
        self.namespace = 'fake-namespace'


class MockResolverDjangoNested:
    def __init__(self):
        self.pattern = '^fake-nested-resolver/'
        self.url_patterns = [MockResolverDjango2()]
        self.app_name = 'fake-app-name'
        self.namespace = 'nested-namespace'


class UnitTestWalkSiteURL(UnitTestCase):

    def setUp(self):
        self.pattern_1 = MockPattern()
        self.data = [self.pattern_1]

    def test_second_param_is_optional_return_a_list(self):
        result = walk_site_url(self.data)
        self.assertIsInstance(result, list)

    def test_first_param_list_of_pattern_and_view(self):
        result = walk_site_url(self.data)
        self.assertEqual(result, [('fake-regex-pattern/', 'fake-callback',
                                   'fake-view-name', None)])

    def test_first_param_list_of_patterns_and_views(self):
        pattern_2 = MockPattern()
        pattern_2.regex.pattern = 'fake-regex-pattern-2/'
        pattern_2.callback = 'fake-view-2'
        result = walk_site_url([self.pattern_1, pattern_2])
        self.assertEqual(result, [('fake-regex-pattern/', 'fake-callback',
                                   'fake-view-name', None),
                                  ('fake-regex-pattern-2/', 'fake-view-2',
                                   'fake-view-name', None)])

    def test_param_list_with_pattern_and_resolver_django_1(self):
        expected_result = [
            ('fake-regex-pattern/', 'fake-callback', 'fake-view-name', None),
            ('fake-resolver/fake-regex-pattern/',
             'fake-callback', 'fake-namespace:fake-view-name', 'fake-app-name'
             )]
        resolver = MockResolver()
        result = walk_site_url([self.pattern_1, resolver])
        self.assertEqual(result, expected_result)

    def test_param_list_with_pattern_and_nested_resolver_django_1(self):
        expected_result = [
            ('fake-regex-pattern/', 'fake-callback', 'fake-view-name', None),
            ('fake-nested-resolver/fake-resolver/fake-regex-pattern/',
             'fake-callback', 'nested-namespace:fake-namespace:fake-view-name',
             'fake-app-name'
             )
        ]
        resolver = MockResolverNested()
        result = walk_site_url([self.pattern_1, resolver])
        self.assertEqual(result, expected_result)

    def test_param_list_with_pattern_and_resolver_django_2(self):
        expected_result = [
            ('fake-pattern/', 'fake-callback', 'fake-view-name', None),
            ('fake-resolver/fake-pattern/',
             'fake-callback', 'fake-namespace:fake-view-name', 'fake-app-name'
             )
        ]
        resolver = MockResolverDjango2()
        result = walk_site_url([MockPatternDjango2(), resolver])
        self.assertEqual(result, expected_result)

    def test_param_list_with_pattern_and_nested_resolver_django_2(self):
        expected_result = [
            ('fake-pattern/', 'fake-callback', 'fake-view-name', None),
            ('fake-nested-resolver/fake-resolver/fake-pattern/',
             'fake-callback', 'nested-namespace:fake-namespace:fake-view-name',
             'fake-app-name'
             )
        ]
        result = walk_site_url([MockPatternDjango2(),
                                MockResolverDjangoNested()])
        self.assertEqual(result, expected_result)

    def test_param_list_with_resolver_get_app_name_and_view_name_django_1(self):
        expected_result = [
            ('fake-resolver/fake-regex-pattern/',
             'fake-callback', 'fake-namespace:fake-view-name', 'fake-app-name'
             ),
            ('fake-nested-resolver/fake-resolver/fake-regex-pattern/',
             'fake-callback', 'nested-namespace:fake-namespace:fake-view-name',
             'fake-app-name'
             )
        ]
        result = walk_site_url([MockResolver(), MockResolverNested()])
        self.assertEqual(result, expected_result)

    def test_param_list_with_resolver_get_app_name_and_view_name_django_2(self):
        expected_result = [
            ('fake-resolver/fake-pattern/',
             'fake-callback', 'fake-namespace:fake-view-name', 'fake-app-name'
             ),
            ('fake-nested-resolver/fake-resolver/fake-pattern/',
             'fake-callback', 'nested-namespace:fake-namespace:fake-view-name',
             'fake-app-name'
             )
        ]
        resolver = MockResolverDjango2()
        nested_resolver = MockResolverDjangoNested()
        result = walk_site_url([resolver, nested_resolver])
        self.assertEqual(result, expected_result)

    def test_when_url_namespace_is_None(self):
        expected_result = [
            ('fake-resolver/fake-resolver/fake-pattern/',
             'fake-callback', 'fake-view-none', None
             )
        ]
        resolver = MockResolverDjango2None2()
        result = walk_site_url([resolver])
        self.assertEqual(result, expected_result)

    # def test_when_view_name_is_None(self):
    #     expected_result = [
    #         ('fake-resolver/fake-pattern/',
    #          'fake-callback', 'fake-view-name', None
    #          )
    #     ]
    #     resolver = MockResolverDjango2None2()
    #     result = walk_site_url([resolver])
    #     print(result)
    #     self.assertEqual(result, expected_result)


class IntegratedTestWalkSiteURL(TestCase):

    def setUp(self):
        self.url = import_module(settings.ROOT_URLCONF).urlpatterns

    def test_found_direct_access_view(self):
        expected_result = ('direct_access_view/',
                           views.protected_view_by_role,
                           'direct_access_view', None)
        result = walk_site_url(self.url)
        self.assertIn(expected_result, result)

    def test_found_included_view_without_namespace(self):
        expected_result = ('role-included[135]/view_by_role/',
                           views.protected_view_by_role,
                           'django_roles_access:view_protected_by_role',
                           'django_roles_access')
        result = walk_site_url(self.url)
        self.assertIn(expected_result, result)

    def test_found_included_view_with_namespace(self):
        expected_result = ('role-included2/view_by_role/',
                           views.protected_view_by_role,
                           'app-ns2:view_protected_by_role',
                           'django_roles_access')
        result = walk_site_url(self.url)
        self.assertIn(expected_result, result)

    def test_found_nested_access_view(self):
        expected_result = ('nest1/nest2/view_by_role/',
                           views.protected_view_by_role,
                           'nest1_namespace:nest2_namespace:view_'
                           'protected_by_role',
                           'roles-app-name')
        result = walk_site_url(self.url)
        self.assertIn(expected_result, result)


class UnitTestGetViewsByApp(UnitTestCase):
    """
    get_views_by_app receive the result of walk_site_url and is required to
    return a dictionary with keys been installed applications.
    """
    def setUp(self):
        self.data = [('a', 'b', 'c', 'fake-app-1')]

    @patch('django_roles_access.utils.settings')
    def test_returns_a_dictionary(
            self, mock_settings
    ):
        mock_settings.INSTALLED_APPS = ['fake-app-1', 'fake-app-2']
        result = get_views_by_app(self.data)
        self.assertIsInstance(result, dict)

    @patch('django_roles_access.utils.settings')
    def test_returns_a_dictionary_with_all_installed_apps(
            self, mock_settings
    ):
        mock_settings.INSTALLED_APPS = ['fake-app-1', 'fake-app-2']
        result = get_views_by_app(self.data)
        assert 'fake-app-1' in result
        assert 'fake-app-2' in result

    @patch('django_roles_access.utils.settings')
    def test_values_of_returned_dictionary_keys_are_lists(
            self, mock_settings
    ):
        mock_settings.INSTALLED_APPS = ['fake-app-1', 'fake-app-2']
        result = get_views_by_app(self.data)
        self.assertIsInstance(result['fake-app-1'], list)
        self.assertIsInstance(result['fake-app-2'], list)

    @patch('django_roles_access.utils.settings')
    def test_receive_list_of_tuples_with_4_element(
            self, mock_settings
    ):
        mock_settings.INSTALLED_APPS = ['fake-app-1']
        result = get_views_by_app(self.data)
        assert 'fake-app-1' in result

    @patch('django_roles_access.utils.settings')
    def test_raise_type_error_if_receive_list_of_tuples_with_3_element(
            self, mock_settings
    ):
        mock_settings.INSTALLED_APPS = ['fake-app-1']
        data = [('a', 'b', 'c')]
        with self.assertRaises(TypeError):
            get_views_by_app(data)

    @patch('django_roles_access.utils.settings')
    def test_raise_type_error_if_receive_list_of_tuples_with_5_element(
            self, mock_settings
    ):
        mock_settings.INSTALLED_APPS = ['fake-app-1']
        data = [('a', 'b', 'c', 'd', 'e')]
        with self.assertRaises(TypeError):
            get_views_by_app(data)

    @patch('django_roles_access.utils.settings')
    def test_received_data_is_ordered_and_returned_by_application(
            self, mock_settings
    ):
        mock_settings.INSTALLED_APPS = ['fake-app-1', 'fake-app-2', None]
        data = [('a', 'b', 'c', 'fake-app-1'), ('1', '2', '3', 'fake-app-2'),
                ('a1', 'b2', 'c3', None)]
        expected_result = [('a', 'b', 'c')]
        result = get_views_by_app(data)
        self.assertEqual(expected_result, result['fake-app-1'])

    @patch('django_roles_access.utils.settings')
    def test_can_work_with_no_declared_application_name(
            self, mock_settings
    ):
        mock_settings.INSTALLED_APPS = ['fake-app-1', 'fake-app-2', None]
        data = [('a', 'b', 'c', 'fake-app-1'), ('1', '2', '3', 'fake-app-2'),
                ('a1', 'b2', 'c3', None)]
        expected_result = [('a1', 'b2', 'c3')]
        result = get_views_by_app(data)
        self.assertEqual(expected_result, result[APP_NAME_FOR_NONE])

    @patch('django_roles_access.utils.settings')
    def test_if_application_is_not_in_installed_apps_will_not_be_in_dict(
            self, mock_settings
    ):
        mock_settings.INSTALLED_APPS = ['fake-app-1', 'fake-app-2', None]
        result = get_views_by_app(self.data)
        assert 'fake-app-3' not in result


class IntegratedTestGetViewsByApp(TestCase):

    def setUp(self):
        self.url = import_module(settings.ROOT_URLCONF).urlpatterns
    
    def test_not_declared_app_are_recognized_as_undefined_app(self):
        expected_result = ('direct_access_view/',
                           views.protected_view_by_role,
                           'direct_access_view')
        result = get_views_by_app(walk_site_url(self.url))
        self.assertIn(expected_result, result[APP_NAME_FOR_NONE])

    def test_views_without_namespace_are_added_with_app_name_in_view_name(self):
        expected_result = ('role-included[135]/view_by_role/',
                           views.protected_view_by_role,
                           'django_roles_access:view_protected_by_role')
        result = get_views_by_app(walk_site_url(self.url))
        self.assertIn(expected_result, result['django_roles_access'])

    def test_view_with_namespace_are_added_with_correct_app_name(self):
        expected_result = ('role-included2/view_by_role/',
                           views.protected_view_by_role,
                           'app-ns2:view_protected_by_role')
        result = get_views_by_app(walk_site_url(self.url))
        self.assertIn(expected_result, result['django_roles_access'])

    def test_nested_namespace_are_added_with_correct_app_name(self):
        expected_result = ('nest1/nest2/view_by_role/',
                           views.protected_view_by_role,
                           'nest1_namespace:nest2_namespace:view_'
                           'protected_by_role')
        result = get_views_by_app(walk_site_url(self.url))
        self.assertIn(expected_result, result['roles-app-name'])


class TestGetViewAnalyzeReport(UnitTestCase):

    def test_report_for_no_application_type(self):
        expected = u'\t' + NONE_TYPE_DEFAULT
        result = get_view_analyze_report(None)
        self.assertEqual(result, expected)

    def test_report_for_application_type_NOT_SECURED(self):
        expected = u'\t' + NOT_SECURED_DEFAULT
        result = get_view_analyze_report('NOT_SECURED')
        self.assertEqual(result, expected)
        self.assertEqual(result, expected)

    def test_report_for_application_type_DISABLED(self):
        expected = u'\t' + DISABLED_DEFAULT
        result = get_view_analyze_report('DISABLED')
        self.assertEqual(result, expected)

    def test_report_for_application_type_SECURED(self):
        expected = u'\t' + SECURED_DEFAULT
        result = get_view_analyze_report('SECURED')
        self.assertEqual(result, expected)

    def test_report_for_application_type_PUBLIC(self):
        expected = u'\t' + PUBLIC_DEFAULT
        result = get_view_analyze_report('PUBLIC')
        self.assertEqual(result, expected)


class TestCheckDjangoRolesIsUsed(UnitTestCase):

    def test_detect_view_is_decorated(self):
        @access_by_role
        def function():
            pass
        self.assertTrue(check_django_roles_is_used(function))

    def test_detect_view_is_not_decorated(self):
        def function():
            pass
        self.assertFalse(check_django_roles_is_used(function()))

    def test_detect_view_use_mixin(self):
        class Aview(RolesMixin, TemplateView):
            template_name = 'dummyTemplate.html'
        self.assertTrue(check_django_roles_is_used(Aview))

    def test_detect_view_not_use_mixin(self):
        class Aview(TemplateView):
            template_name = 'dummyTemplate.html'
        self.assertFalse(check_django_roles_is_used(Aview))


@patch('django_roles_access.utils.ViewAccess')
class UnitTestAnalyzeByRoleAccess(UnitTestCase):

    def test_detect_access_is_by_role(
            self, mock_view_access
    ):
        expected = u'ERROR: No roles configured to access de view.'
        mock_view_access.type = 'br'
        mock_view_access.roles.count.return_value = 0
        result = analyze_by_role(mock_view_access)
        self.assertEqual(result, expected)

    def test_detect_access_is_not_by_role(
            self, mock_view_access
    ):
        expected = u''
        mock_view_access.type = 'pu'
        result = analyze_by_role(mock_view_access)
        self.assertEqual(result, expected)

    def test_detect_access_is_not_by_role_with_roles(
            self, mock_view_access
    ):
        expected = u'Roles with access: role-1, role-2'
        mock_view_access.type = 'br'
        role_1 = Mock()
        role_1.name = u'role-1'
        role_2 = Mock()
        role_2.name = u'role-2'
        mock_view_access.roles.all.return_value = [role_1, role_2]
        result = analyze_by_role(mock_view_access)
        self.assertEqual(result, expected)

    def test_detect_access_is_not_by_role_without_roles(
            self, mock_view_access
    ):
        expected = u'ERROR: No roles configured to access de view.'
        mock_view_access.type = 'br'
        mock_view_access.roles.count.return_value = 0
        result = analyze_by_role(mock_view_access)
        self.assertEqual(result, expected)


class IntegratedTestAnalyzeByRoleAccess(TestCase):

    def test_detect_access_is_by_role(self):
        expected = u'ERROR: No roles configured to access de view.'
        view_access = ViewAccess.objects.create(view='any-name', type='br')
        result = analyze_by_role(view_access)
        self.assertEqual(result, expected)

    def test_detect_access_is_not_by_role(self):
        expected = u''
        view_access = ViewAccess.objects.create(view='any-name', type='pu')
        result = analyze_by_role(view_access)
        self.assertEqual(result, expected)

    def test_detect_access_is_by_role_with_roles(self):
        expected = u'Roles with access: role-1, role-2'
        view_access = ViewAccess.objects.create(view='any-name', type='br')
        role_1, created = Group.objects.get_or_create(name='role-1')
        role_2, created = Group.objects.get_or_create(name='role-2')
        view_access.roles.add(role_1)
        view_access.roles.add(role_2)
        view_access.save()
        result = analyze_by_role(view_access)
        self.assertEqual(result, expected)

    def test_detect_access_is_not_by_role_without_roles(self):
        expected = u'ERROR: No roles configured to access de view.'
        view_access = ViewAccess.objects.create(view='any-name', type='br')
        result = analyze_by_role(view_access)
        self.assertEqual(result, expected)


@patch('django_roles_access.utils.ViewAccess.objects')
class UnitTestViewAnalyzer(UnitTestCase):

    def test_view_analyzer_return_a_report(
            self, mock_objects
    ):
        view_access = Mock()
        view_access.type = 'pu'
        mock_objects.filter.return_value = mock_objects
        mock_objects.first.return_value = view_access
        result = view_access_analyzer('fake-app-type', 'fake-callback',
                                      'fake-view-name', 'fake-site-active')
        try:
            self.assertIsInstance(result, unicode)
        except:
            self.assertIsInstance(result, str)

    def test_view_analyzer_search_view_access_for_the_view(
            self, mock_objects
    ):
        view_access = Mock()
        view_access.type = 'pu'
        mock_objects.filter.return_value = mock_objects
        mock_objects.first.return_value = view_access
        view_access_analyzer('fake-app-type', 'fake-callback',
                             'fake-view-name', 'fake-site-active')
        assert mock_objects.first.called

    def test_view_analyzer_search_view_access_for_the_view_once(
            self, mock_objects
    ):
        view_access = Mock()
        view_access.type = 'pu'
        mock_objects.filter.return_value = mock_objects
        mock_objects.first.return_value = view_access
        view_access_analyzer('fake-app-type', 'fake-callback',
                             'fake-view-name', 'fake-site-active')
        self.assertEqual(mock_objects.filter.call_count, 1)

    def test_view_analyzer_search_view_access_with_view_name(
            self, mock_objects
    ):
        view_access = Mock()
        view_access.type = 'pu'
        mock_objects.filter.return_value = mock_objects
        mock_objects.first.return_value = view_access
        view_access_analyzer('fake-app-type', 'fake-callback',
                             'fake-view-name', 'fake-site-active')
        mock_objects.filter.assert_called_once_with(view='fake-view-name')

    def test_view_access_type_when_site_active_and_exists_view_access(
            self, mock_objects
    ):
        expected = u'View access is of type Public.'
        view_access = Mock()
        view_access.type = 'pu'
        mock_objects.filter.return_value = mock_objects
        mock_objects.first.return_value = view_access
        result = view_access_analyzer('fake-app-type', 'fake-callback',
                                      'fake-view-name', True)
        self.assertEqual(result, expected)

    @patch('django_roles_access.utils.analyze_by_role')
    def test_view_access_type_by_role_call_analyze_by_role(
            self, mock_analyze_by_role, mock_objects
    ):
        view_access = Mock()
        view_access.type = 'br'
        mock_objects.filter.return_value = mock_objects
        mock_objects.first.return_value = view_access
        view_access_analyzer('fake-app-type', 'fake-callback',
                             'fake-view-name', True)
        assert mock_analyze_by_role.called

    @patch('django_roles_access.utils.analyze_by_role')
    def test_view_access_type_by_role_call_analyze_by_role_once(
            self, mock_analyze_by_role, mock_objects
    ):
        view_access = Mock()
        view_access.type = 'br'
        mock_objects.filter.return_value = mock_objects
        mock_objects.first.return_value = view_access
        view_access_analyzer('fake-app-type', 'fake-callback',
                             'fake-view-name', True)
        self.assertEqual(mock_analyze_by_role.call_count, 1)

    @patch('django_roles_access.utils.analyze_by_role')
    def test_view_access_type_by_role_call_analyze_by_role_with_view_access(
            self, mock_analyze_by_role, mock_objects
    ):
        view_access = Mock()
        view_access.type = 'br'
        mock_objects.filter.return_value = mock_objects
        mock_objects.first.return_value = view_access
        view_access_analyzer('fake-app-type', 'fake-callback',
                             'fake-view-name', True)
        mock_analyze_by_role.assert_called_once_with(view_access)

    def test_no_view_access_object_for_the_view_and_site_active_no_app_type(
            self, mock_objects
    ):
        expected = u'\t' + NONE_TYPE_DEFAULT
        mock_objects.filter.return_value = mock_objects
        mock_objects.first.return_value = None
        result = view_access_analyzer(None, 'fake-callback',
                                      'fake-view-name', True)
        self.assertEqual(result, expected)

    def test_no_view_access_object_and_site_active_app_type_NOT_SECURED(
            self, mock_objects
    ):
        expected = u'\t' + NOT_SECURED_DEFAULT
        mock_objects.filter.return_value = mock_objects
        mock_objects.first.return_value = None
        result = view_access_analyzer('NOT_SECURED', 'fake-callback',
                                      'fake-view-name', True)
        self.assertEqual(result, expected)

    def test_no_view_access_object_and_site_active_app_type_DISABLED(
            self, mock_objects
    ):
        expected = u'\t' + DISABLED_DEFAULT
        mock_objects.filter.return_value = mock_objects
        mock_objects.first.return_value = None
        result = view_access_analyzer('DISABLED', 'fake-callback',
                                      'fake-view-name', True)
        self.assertEqual(result, expected)

    def test_no_view_access_object_and_site_active_app_type_SECURED(
            self, mock_objects
    ):
        expected = u'\t' + SECURED_DEFAULT
        mock_objects.filter.return_value = mock_objects
        mock_objects.first.return_value = None
        result = view_access_analyzer('SECURED', 'fake-callback',
                                      'fake-view-name', True)
        self.assertEqual(result, expected)

    def test_no_view_access_object_and_site_active_app_type_PUBLIC(
            self, mock_objects
    ):
        expected = u'\t' + PUBLIC_DEFAULT
        mock_objects.filter.return_value = mock_objects
        mock_objects.first.return_value = None
        result = view_access_analyzer('PUBLIC', 'fake-callback',
                                      'fake-view-name', True)
        self.assertEqual(result, expected)

    def test_middleware_not_used_view_access_object_exist_and_dr_tools_used(
            self, mock_objects
    ):
        expected = u'View access is of type Public.'

        @access_by_role
        def function():
            pass
        view_access = Mock()
        view_access.type = 'pu'
        mock_objects.filter.return_value = mock_objects
        mock_objects.first.return_value = view_access
        result = view_access_analyzer('fake-app-type', function,
                                      'fake-view-name', False)
        self.assertEqual(result, expected)

    def test_middleware_not_used_view_access_object_exist_and_dr_tools_not_used(
            self, mock_objects
    ):
        expected = u'ERROR: View access object exist for the view, but no '
        expected += u'Django role access tool is used: neither decorator, '
        expected += u'mixin, or middleware.'

        def function():
            pass

        view_access = Mock()
        view_access.type = 'pu'
        mock_objects.filter.return_value = mock_objects
        mock_objects.first.return_value = view_access
        result = view_access_analyzer('fake-app-type', function,
                                      'fake-view-name', False)
        self.assertEqual(result, expected)

    def test_middleware_not_used_dr_tools_are_used_no_view_access_object(
            self, mock_objects
    ):
        expected = u'\t' + PUBLIC_DEFAULT

        @access_by_role
        def function():
            pass
        mock_objects.filter.return_value = mock_objects
        mock_objects.first.return_value = None
        result = view_access_analyzer('PUBLIC', function,
                                      'fake-view-name', False)
        self.assertEqual(result, expected)

    def test_no_django_roles_tools_used_no_application_type(
            self, mock_objects
    ):
        expected = u'No Django roles access tool used. Access to view depends '
        expected += u'on its implementation.'

        def function():
            pass
        mock_objects.filter.return_value = mock_objects
        mock_objects.first.return_value = None
        result = view_access_analyzer(None, function,
                                      'fake-view-name', False)
        self.assertEqual(result, expected)

    def test_no_django_roles_tools_used_application_type(
            self, mock_objects
    ):
        expected = u'No Django roles access tool used. Access to view depends '
        expected += u'on its implementation.'

        def function():
            pass
        mock_objects.filter.return_value = mock_objects
        mock_objects.first.return_value = None
        result = view_access_analyzer('Authorized', function,
                                      'fake-view-name', False)
        self.assertEqual(result, expected)


class IntegratedTestViewAnalyzezr(TestCase):

    def test_with_middleware_SECURED_without_view_access_object(self):
        expected = u'\t' + SECURED_DEFAULT
        result = view_access_analyzer(
            'SECURED', views.MiddlewareView.as_view,
            'django_roles_access:middleware_view_class',
            True)
        self.assertEqual(expected, result)

    def test_with_middleware_NOT_SECURED_with_view_access_object(self):
        ViewAccess.objects.create(
            view='django_roles_access:middleware_view_class',
            type='br')
        result = view_access_analyzer(
            'NOT_SECURED', views.MiddlewareView.as_view,
            'django_roles_access:middleware_view_class',
            True)
        self.assertEqual(result, u'\t' + NOT_SECURED_DEFAULT)

    def test_with_middleware_DISABLED_with_view_access_object(self):
        ViewAccess.objects.create(
            view='django_roles_access:middleware_view_class',
            type='pu')
        result = view_access_analyzer(
            'DISABLED', views.MiddlewareView.as_view,
            'django_roles_access:middleware_view_class',
            True)
        self.assertEqual(result, u'\t' + DISABLED_DEFAULT)

    def test_with_middleware_with_view_access_object(self):
        expected = u'View access is of type By role.'
        expected += u'ERROR: No roles configured to access de view.'
        ViewAccess.objects.create(
            view='django_roles_access:middleware_view_class',
            type='br')
        result = view_access_analyzer(
            'SECURED', views.MiddlewareView.as_view,
            'django_roles_access:middleware_view_class',
            True)
        self.assertEqual(result, expected)

    def test_with_middleware_with_view_access_object_with_roles(self):
        expected = u'View access is of type By role.'
        expected += u'Roles with access: test1, test2'
        g1, created = Group.objects.get_or_create(name='test1')
        g2, created = Group.objects.get_or_create(name='test2')
        view_access = ViewAccess.objects.create(
            view='django_roles_access:middleware_view_class',
            type='br')
        view_access.roles.add(g1)
        view_access.roles.add(g2)
        view_access.save()
        result = view_access_analyzer(
            'SECURED', views.MiddlewareView.as_view,
            'django_roles_access:middleware_view_class',
            True)
        self.assertEqual(result, expected)

    def test_with_middleware_with_view_access_object_authorized(self):
        expected = u'View access is of type Authorized.'
        ViewAccess.objects.create(
            view='django_roles_access:middleware_view_class',
            type='au')
        result = view_access_analyzer(
            'SECURED', views.MiddlewareView.as_view,
            'django_roles_access:middleware_view_class',
            True)
        self.assertEqual(result, expected)

    def test_with_middleware_with_view_access_object_public(self):
        expected = u'View access is of type Public.'
        ViewAccess.objects.create(
            view='django_roles_access:middleware_view_class',
            type='pu')
        result = view_access_analyzer(
            'SECURED', views.MiddlewareView.as_view,
            'django_roles_access:middleware_view_class',
            True)
        self.assertEqual(result, expected)

    def test_without_middleware_with_view_access_object(self):
        expected = u'View access is of type By role.'
        expected += u'ERROR: No roles configured to access de view.'
        ViewAccess.objects.create(
            view='django_roles_access:view_protected_by_role',
            type='br')
        result = view_access_analyzer(
            'SECURED', views.protected_view_by_role,
            'django_roles_access:view_protected_by_role',
            False)
        self.assertEqual(result, expected)

    def test_without_middleware_with_view_access_object_with_roles(self):
        expected = u'View access is of type By role.'
        expected += u'Roles with access: test1, test2'
        g1, created = Group.objects.get_or_create(name='test1')
        g2, created = Group.objects.get_or_create(name='test2')
        view_access = ViewAccess.objects.create(
            view='django_roles_access:view_protected_by_role',
            type='br')
        view_access.roles.add(g1)
        view_access.roles.add(g2)
        view_access.save()
        result = view_access_analyzer(
            'SECURED', views.protected_view_by_role,
            'django_roles_access:view_protected_by_role',
            False)
        self.assertEqual(result, expected)

    def test_without_middleware_with_view_access_object_authorized(self):
        expected = u'View access is of type Authorized.'
        ViewAccess.objects.create(
            view='django_roles_access:view_protected_by_role',
            type='au')
        result = view_access_analyzer(
            'SECURED', views.protected_view_by_role,
            'django_roles_access:view_protected_by_role',
            False)
        self.assertEqual(result, expected)

    def test_without_middleware_with_view_access_object_public(self):
        expected = u'View access is of type Public.'
        ViewAccess.objects.create(
            view='django_roles_access:view_protected_by_role',
            type='pu')
        result = view_access_analyzer(
            'SECURED', views.protected_view_by_role,
            'django_roles_access:view_protected_by_role',
            False)
        self.assertEqual(result, expected)

    def test_without_middleware_without_view_access_object_and_view_protected(
            self
    ):
        expected = u'\t' + SECURED_DEFAULT
        result = view_access_analyzer(
            'SECURED', views.protected_view_by_role,
            'django_roles_access:view_protected_by_role',
            False)
        self.assertEqual(result, expected)

    def test_without_middleware_no_view_access_object_and_view_protected_without_app(
            self
    ):
        expected = u'\t' + NONE_TYPE_DEFAULT

        result = view_access_analyzer(
            None, views.protected_view_by_role,
            'django_roles_access:view_protected_by_role',
            False)
        self.assertEqual(result, expected)

    def test_without_middleware_with_view_access_object_and_view_not_protected(
            self
    ):
        expected = u'ERROR: View access object exist for the view, '
        expected += 'but no Django role access tool is used: neither '
        expected += 'decorator, mixin, or middleware.'
        ViewAccess.objects.create(
            view='django_roles_access:middleware_view_func',
            type='pu')
        result = view_access_analyzer(
            None, views.middleware_view,
            'django_roles_access:middleware_view_func',
            False)
        self.assertEqual(result, expected)


class UnitTestOutputReport(UnitTestCase):

    def setUp(self):
        self.patch_mock_stdout = patch.object(BaseCommand(), 'style')
        self.patch_mock_style = patch.object(BaseCommand(), 'stdout')
        self.mock_stdout = self.patch_mock_stdout.start()
        self.mock_style = self.patch_mock_style.start()
        self._output = OutputReport(self.mock_stdout, self.mock_style)

    def tearDown(self):
        self.patch_mock_stdout.stop()
        self.patch_mock_style.stop()

    def test_initial_with_parameter(self):
        assert self._output.stdout == self.mock_stdout
        assert self._output.style == self.mock_style

    def test_internal_attributes_are_initialize(self):
        assert hasattr(self._output, '_row') and self._output._row == u''
        assert hasattr(self._output, '_format') and self._output._format == \
               'console'

    def test_initial_without_parameter(self):
        with self.assertRaises(TypeError) as e:
            OutputReport()

    def test_default_output_format_is_correct_type(self):
        assert self._output._format == 'console'

    def test_set_format(self):
        self._output.set_format('csv')
        assert self._output._format == 'csv'

    def test_add_to_row(self):
        self._output.add_to_row('text')
        self._output.add_to_row('other')
        self.assertIn('text', self._output._row)
        self.assertIn('other', self._output._row)

    def test_write_method_write_to_stdout(self):
        self._output.write(u'some text')
        assert self.mock_stdout.write.called

    def test_write_method_use_stdout_write_once(self):
        self._output.write(u'some text')
        self.assertEqual(self.mock_stdout.write.call_count, 1)

    def test_write_method_use_SUCCESS_style_for_styling_output(self):
        self._output.write(u'some text')
        self.mock_stdout.write.assert_called_once_with(
            self.mock_style.SUCCESS())

    def test_write_method_use_SUCCESS_style_for_output(self):
        self._output.write(u'some text')
        assert self.mock_style.SUCCESS.called

    def test_write_method_use_style_with_received_argument(self):
        self._output.write(u'some text')
        self.mock_style.SUCCESS.assert_called_once_with(u'some text')

    def test_console_format_write_correct_header_to_stdout_with_SUCCESS_style(
            self
    ):
        expected = u'Start checking views access.\n'
        expected += u'Start gathering information.'
        self._output.write_header()
        self.mock_style.SUCCESS.assert_called_once_with(expected)
        self.assertEqual(self.mock_stdout.write.call_count, 1)

    @patch('django_roles_access.utils.timezone')
    def test_cvs_format_write_correct_header(
            self, mock_timezone
    ):
        mock_timezone.now.return_value = 'fake-date'
        self._output.set_format('csv')
        self._output.write_header()
        self.mock_style.SUCCESS.assert_called_once_with(u'Reported: fake-date')
        self.assertEqual(self.mock_stdout.write.call_count, 1)

    def test_console_format_write_correct_middleware_status_and_end_of_header(
            self
    ):
        expected = u'Django roles access middleware is active: False.\n'
        self._output.write_middleware_status(False)
        self.mock_style.SUCCESS.assert_called_once_with(expected)
        self.assertEqual(self.mock_stdout.write.call_count, 1)

    def test_console_format_write_correct_end_of_header(
            self
    ):
        expected = u'Finish gathering information.'
        self._output.write_end_of_head()
        self.mock_style.SUCCESS.assert_called_once_with(expected)
        self.assertEqual(self.mock_stdout.write.call_count, 1)

    def test_cvs_format_write_correct_correct_middleware_status(
            self
    ):
        expected = u'Django roles access middleware is active: False.\n'
        self._output.set_format('csv')
        self._output.write_middleware_status(False)
        self.mock_style.SUCCESS.assert_called_once_with(expected)
        self.assertEqual(self.mock_stdout.write.call_count, 1)

    def test_cvs_format_write_correct_csv_columns(
            self
    ):
        expected = u'App Name,Type,View Name,Url,Status,Status description'
        self._output.set_format('csv')
        self._output.write_end_of_head()
        self.mock_style.SUCCESS.assert_called_once_with(expected)
        self.assertEqual(self.mock_stdout.write.call_count, 1)

    def test_console_format_process_app_data_to_stdout_with_SUCCESS_style(self):
        app_name = u'fake-app-name'
        app_type = u'fake-app-type'
        view_list = ['fake-view']
        expected = u'\tAnalyzing: {}\n'.format(app_name)
        expected += u'\t\t{} is {} type.'.format(app_name, app_type)
        self._output.process_application_data(app_name, app_type, view_list)
        self.mock_style.SUCCESS.assert_called_once_with(expected)
        self.assertEqual(self.mock_stdout.write.call_count, 1)

    def test_console_format_process_app_data_without_type(self):
        app_name = u'fake-app-name'
        app_type = None
        view_list = ['fake-view']
        expected = u'\tAnalyzing: {}\n'.format(app_name)
        expected += u'\t\t{} has no type.'.format(app_name)
        self._output.process_application_data(app_name, app_type, view_list)
        self.mock_style.SUCCESS.assert_called_once_with(expected)
        self.assertEqual(self.mock_stdout.write.call_count, 1)

    def test_console_format_process_app_data_without_views(self):
        app_name = u'fake-app-name'
        app_type = u'fake-app-type'
        view_list = []
        expected = u'\tAnalyzing: {}\n'.format(app_name)
        expected += u'\t\t{} is {} type.'.format(app_name, app_type)
        expected += u'\t\t{} does not have configured views.'.format(app_name)
        self._output.process_application_data(app_name, app_type, view_list)
        self.mock_style.SUCCESS.assert_called_once_with(expected)
        self.assertEqual(self.mock_stdout.write.call_count, 1)

    def test_cvs_format_process_application_data_to_string(self):
        app_name = u'fake-app-name'
        app_type = u'fake-app-type'
        view_list = ['fake-view-list']
        expected = u'{},{},'.format(app_name, app_type, view_list)
        self._output.set_format('csv')
        self._output.process_application_data(app_name, app_type, view_list)
        self.assertEqual(expected, self._output._row)

    def test_cvs_format_process_application_data_without_type_to_string(self):
        app_name = u'fake-app-name'
        app_type = None
        view_list = ['fake-view-list']
        expected = u'fake-app-name,no type,'.format(app_name)
        self._output.set_format('csv')
        self._output.process_application_data(app_name, app_type, view_list)
        self.assertEqual(expected, self._output._row)

    def test_cvs_format_process_application_data_without_views(self):
        app_name = u'fake-app-name'
        app_type = u'fake-app-type'
        view_list = []
        expected = u'fake-app-name,fake-app-type,,,,,'.format(app_name)
        self._output.set_format('csv')
        self._output.process_application_data(app_name, app_type, view_list)
        self.assertEqual(expected, self._output._row)

    def test_console_format_process_view_data_to_stdout_with_SUCCESS_style(
            self
    ):
        view_name = u'fake-view-name'
        url = '/fake-url/'
        expected = u'\n\t\tAnalysis for view: {}'.format(view_name)
        expected += u'\n\t\tView url: {}'.format(url)
        self._output.process_view_data(view_name, url)
        self.mock_style.SUCCESS.assert_called_once_with(expected)
        self.assertEqual(self.mock_stdout.write.call_count, 1)

    def test_cvs_format_process_view_data(self):
        view_name = u'fake-view-name'
        url = '/fake-url/'
        expected = u'{},{}'.format(view_name, url)
        self._output.set_format('csv')
        self._output.process_view_data(view_name, url)
        self.assertIn(expected, self._output._row)

    # View_access_analyzer output.
    def test_console_format_write_vaa_to_stdout(self):
        self._output.write_view_access_analyzer(u'some text')
        assert self.mock_stdout.write.called

    def test_console_format_use_stdout_write_once_with_vaa(self):
        self._output.write_view_access_analyzer(u'some text')
        self.assertEqual(self.mock_stdout.write.call_count, 1)

    def test_console_format_use_SUCCESS_style_for_styling_output_of_vaa(self):
        self._output.write_view_access_analyzer(u'some text')
        self.mock_stdout.write.assert_called_once_with(
            self.mock_style.SUCCESS())

    def test_console_format_use_SUCCESS_style_for_output_of_vaa(self):
        self._output.write_view_access_analyzer(u'some text')
        assert self.mock_style.SUCCESS.called

    def test_console_format_use_style_with_vaa_result(self):
        self._output.write_view_access_analyzer(u'some text')
        self.mock_style.SUCCESS.assert_called_once_with(u'\t\tsome text')

    def test_console_format_use_ERROR_style_for_output_if_error_in_vaa(self):
        self._output.write_view_access_analyzer('ERROR: fake report')
        assert self.mock_style.ERROR.called

    def test_console_format_use_ERROR_style_with_the_error_in_vaa(self):
        self._output.write_view_access_analyzer('ERROR: fake report')
        self.mock_style.ERROR.assert_called_once_with('\t\t' +
                                                      'ERROR: fake report')

    def test_console_format_use_WARNING_style_for_output_if_warning_in_vaa(self):
        self._output.write_view_access_analyzer('WARNING: fake report')
        assert self.mock_style.WARNING.called

    def test_console_format_use_WARNING_style_with_the_warning_in_vaa(self):
        self._output.write_view_access_analyzer('WARNING: fake report')
        self.mock_style.WARNING.assert_called_once_with(
            '\t\t' + 'WARNING: fake report')

    def test_csv_format_write_view_access_analyzer_with_Normal_to_stdout(self):
        self._output.add_to_row('fake-app,fake-type,fake-view,fake-url,')
        self._output._format = 'csv'
        self._output.write_view_access_analyzer(u'fake-report')
        self.assertEqual(self.mock_stdout.write.call_count, 1)

    def test_csv_format_write_view_access_analyzer_with_Normal_to_style(self):
        self._output.add_to_row('fake-app,fake-type,fake-view,fake-url,')
        expected = u'fake-app,fake-type,fake-view,fake-url,Normal,fake-report\n'
        self._output._format = 'csv'
        self._output.write_view_access_analyzer(u'fake-report')
        self.mock_style.SUCCESS.assert_called_once_with(expected)

    def test_csv_format_write_view_access_analyzer_with_WARNING_to_stdout(self):
        self._output.add_to_row('fake-app,fake-type,fake-view,fake-url,')
        self._output._format = 'csv'
        self._output.write_view_access_analyzer('WARNING: fake-report')
        self.assertEqual(self.mock_stdout.write.call_count, 1)

    def test_csv_format_write_view_access_analyzer_with_WARNING_with_style(
            self
    ):
        self._output.add_to_row('fake-app,fake-type,fake-view,fake-url,')
        expected = u'fake-app,fake-type,fake-view,fake-url,Warning,' \
                   u'fake-report\n'
        self._output._format = 'csv'
        self._output.write_view_access_analyzer('WARNING: fake-report')
        self.mock_style.WARNING.assert_called_once_with(expected)

    def test_csv_format_write_view_access_analyzer_with_ERROR_to_stdout(self):
        self._output.add_to_row('fake-app,fake-type,fake-view,fake-url,')
        self._output._format = 'csv'
        self._output.write_view_access_analyzer('ERROR: fake-report')
        self.assertEqual(self.mock_stdout.write.call_count, 1)

    def test_csv_format_write_view_access_analyzer_with_ERROR_with_style(self):
        self._output.add_to_row('fake-app,fake-type,fake-view,fake-url,')
        expected = u'fake-app,fake-type,fake-view,fake-url,Error,fake-report\n'
        self._output._format = 'csv'
        self._output.write_view_access_analyzer('ERROR: fake-report')
        self.mock_style.ERROR.assert_called_once_with(expected)

    def test_csv_format_write_view_access_analyzer_reset_OutputFormater_row(
            self
    ):
        self._output.add_to_row('fake-app,fake-type,fake-view,fake-url,')
        self._output._format = 'csv'
        self._output.write_view_access_analyzer('fake-report')
        self.assertEqual(self._output._row, u'fake-app,fake-type,')

    def test_console_format_close_application_data_to_stdout_with_SUCCESS_style(
            self
    ):
        expected = u'\tFinish analyzing fake-app-name.'
        self._output.close_application_data('fake-app-name')
        self.mock_style.SUCCESS.assert_called_once_with(expected)
        self.assertEqual(self.mock_stdout.write.call_count, 1)

    def test_cvs_format_close_application_data_to_string(self):
        expected = u''
        self._output.set_format('csv')
        self._output.close_application_data('fake-app-name')
        self.assertEqual(self._output._row, expected)

    def test_console_format_write_footer_to_stdout_with_SUCCESS_style(self):
        expected = u'End checking view access.'
        self._output.write_footer()
        self.mock_style.SUCCESS.assert_called_once_with(expected)
        self.assertEqual(self.mock_stdout.write.call_count, 1)

    def test_cvs_format_write_footer_to_string(self):
        expected = u'\n'
        self._output.set_format('csv')
        self._output.write_footer()
        self.assertEqual(self._output._row, expected)

[((449, 1, 449, 46), 'mock.patch', 'patch', ({(449, 7, 449, 45): '"""django_roles_access.utils.ViewAccess"""'}, {}), "('django_roles_access.utils.ViewAccess')", False, 'from mock import Mock, patch\n'), ((524, 1, 524, 54), 'mock.patch', 'patch', ({(524, 7, 524, 53): '"""django_roles_access.utils.ViewAccess.objects"""'}, {}), "('django_roles_access.utils.ViewAccess.objects')", False, 'from mock import Mock, patch\n'), ((278, 5, 278, 48), 'mock.patch', 'patch', ({(278, 11, 278, 47): '"""django_roles_access.utils.settings"""'}, {}), "('django_roles_access.utils.settings')", False, 'from mock import Mock, patch\n'), ((286, 5, 286, 48), 'mock.patch', 'patch', ({(286, 11, 286, 47): '"""django_roles_access.utils.settings"""'}, {}), "('django_roles_access.utils.settings')", False, 'from mock import Mock, patch\n'), ((295, 5, 295, 48), 'mock.patch', 'patch', ({(295, 11, 295, 47): '"""django_roles_access.utils.settings"""'}, {}), "('django_roles_access.utils.settings')", False, 'from mock import Mock, patch\n'), ((304, 5, 304, 48), 'mock.patch', 'patch', ({(304, 11, 304, 47): '"""django_roles_access.utils.settings"""'}, {}), "('django_roles_access.utils.settings')", False, 'from mock import Mock, patch\n'), ((312, 5, 312, 48), 'mock.patch', 'patch', ({(312, 11, 312, 47): '"""django_roles_access.utils.settings"""'}, {}), "('django_roles_access.utils.settings')", False, 'from mock import Mock, patch\n'), ((321, 5, 321, 48), 'mock.patch', 'patch', ({(321, 11, 321, 47): '"""django_roles_access.utils.settings"""'}, {}), "('django_roles_access.utils.settings')", False, 'from mock import Mock, patch\n'), ((330, 5, 330, 48), 'mock.patch', 'patch', ({(330, 11, 330, 47): '"""django_roles_access.utils.settings"""'}, {}), "('django_roles_access.utils.settings')", False, 'from mock import Mock, patch\n'), ((341, 5, 341, 48), 'mock.patch', 'patch', ({(341, 11, 341, 47): '"""django_roles_access.utils.settings"""'}, {}), "('django_roles_access.utils.settings')", False, 'from mock import Mock, patch\n'), ((352, 5, 352, 48), 'mock.patch', 'patch', ({(352, 11, 352, 47): '"""django_roles_access.utils.settings"""'}, {}), "('django_roles_access.utils.settings')", False, 'from mock import Mock, patch\n'), ((586, 5, 586, 55), 'mock.patch', 'patch', ({(586, 11, 586, 54): '"""django_roles_access.utils.analyze_by_role"""'}, {}), "('django_roles_access.utils.analyze_by_role')", False, 'from mock import Mock, patch\n'), ((598, 5, 598, 55), 'mock.patch', 'patch', ({(598, 11, 598, 54): '"""django_roles_access.utils.analyze_by_role"""'}, {}), "('django_roles_access.utils.analyze_by_role')", False, 'from mock import Mock, patch\n'), ((610, 5, 610, 55), 'mock.patch', 'patch', ({(610, 11, 610, 54): '"""django_roles_access.utils.analyze_by_role"""'}, {}), "('django_roles_access.utils.analyze_by_role')", False, 'from mock import Mock, patch\n'), ((987, 5, 987, 48), 'mock.patch', 'patch', ({(987, 11, 987, 47): '"""django_roles_access.utils.timezone"""'}, {}), "('django_roles_access.utils.timezone')", False, 'from mock import Mock, patch\n'), ((119, 17, 119, 41), 'django_roles_access.utils.walk_site_url', 'walk_site_url', ({(119, 31, 119, 40): 'self.data'}, {}), '(self.data)', False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((123, 17, 123, 41), 'django_roles_access.utils.walk_site_url', 'walk_site_url', ({(123, 31, 123, 40): 'self.data'}, {}), '(self.data)', False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((131, 17, 131, 59), 'django_roles_access.utils.walk_site_url', 'walk_site_url', ({(131, 31, 131, 58): '[self.pattern_1, pattern_2]'}, {}), '([self.pattern_1, pattern_2])', False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((144, 17, 144, 58), 'django_roles_access.utils.walk_site_url', 'walk_site_url', ({(144, 31, 144, 57): '[self.pattern_1, resolver]'}, {}), '([self.pattern_1, resolver])', False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((156, 17, 156, 58), 'django_roles_access.utils.walk_site_url', 'walk_site_url', ({(156, 31, 156, 57): '[self.pattern_1, resolver]'}, {}), '([self.pattern_1, resolver])', False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((207, 17, 207, 59), 'django_roles_access.utils.walk_site_url', 'walk_site_url', ({(207, 31, 207, 58): '[resolver, nested_resolver]'}, {}), '([resolver, nested_resolver])', False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((217, 17, 217, 42), 'django_roles_access.utils.walk_site_url', 'walk_site_url', ({(217, 31, 217, 41): '[resolver]'}, {}), '([resolver])', False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((241, 17, 241, 40), 'django_roles_access.utils.walk_site_url', 'walk_site_url', ({(241, 31, 241, 39): 'self.url'}, {}), '(self.url)', False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((249, 17, 249, 40), 'django_roles_access.utils.walk_site_url', 'walk_site_url', ({(249, 31, 249, 39): 'self.url'}, {}), '(self.url)', False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((257, 17, 257, 40), 'django_roles_access.utils.walk_site_url', 'walk_site_url', ({(257, 31, 257, 39): 'self.url'}, {}), '(self.url)', False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((266, 17, 266, 40), 'django_roles_access.utils.walk_site_url', 'walk_site_url', ({(266, 31, 266, 39): 'self.url'}, {}), '(self.url)', False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((283, 17, 283, 44), 'django_roles_access.utils.get_views_by_app', 'get_views_by_app', ({(283, 34, 283, 43): 'self.data'}, {}), '(self.data)', False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((291, 17, 291, 44), 'django_roles_access.utils.get_views_by_app', 'get_views_by_app', ({(291, 34, 291, 43): 'self.data'}, {}), '(self.data)', False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((300, 17, 300, 44), 'django_roles_access.utils.get_views_by_app', 'get_views_by_app', ({(300, 34, 300, 43): 'self.data'}, {}), '(self.data)', False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((309, 17, 309, 44), 'django_roles_access.utils.get_views_by_app', 'get_views_by_app', ({(309, 34, 309, 43): 'self.data'}, {}), '(self.data)', False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((338, 17, 338, 39), 'django_roles_access.utils.get_views_by_app', 'get_views_by_app', ({(338, 34, 338, 38): 'data'}, {}), '(data)', False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((349, 17, 349, 39), 'django_roles_access.utils.get_views_by_app', 'get_views_by_app', ({(349, 34, 349, 38): 'data'}, {}), '(data)', False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((357, 17, 357, 44), 'django_roles_access.utils.get_views_by_app', 'get_views_by_app', ({(357, 34, 357, 43): 'self.data'}, {}), '(self.data)', False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((400, 17, 400, 46), 'django_roles_access.utils.get_view_analyze_report', 'get_view_analyze_report', ({(400, 41, 400, 45): 'None'}, {}), '(None)', False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((405, 17, 405, 55), 'django_roles_access.utils.get_view_analyze_report', 'get_view_analyze_report', ({(405, 41, 405, 54): '"""NOT_SECURED"""'}, {}), "('NOT_SECURED')", False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((411, 17, 411, 52), 'django_roles_access.utils.get_view_analyze_report', 'get_view_analyze_report', ({(411, 41, 411, 51): '"""DISABLED"""'}, {}), "('DISABLED')", False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((416, 17, 416, 51), 'django_roles_access.utils.get_view_analyze_report', 'get_view_analyze_report', ({(416, 41, 416, 50): '"""SECURED"""'}, {}), "('SECURED')", False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((421, 17, 421, 50), 'django_roles_access.utils.get_view_analyze_report', 'get_view_analyze_report', ({(421, 41, 421, 49): '"""PUBLIC"""'}, {}), "('PUBLIC')", False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((458, 17, 458, 50), 'django_roles_access.utils.analyze_by_role', 'analyze_by_role', ({(458, 33, 458, 49): 'mock_view_access'}, {}), '(mock_view_access)', False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((466, 17, 466, 50), 'django_roles_access.utils.analyze_by_role', 'analyze_by_role', ({(466, 33, 466, 49): 'mock_view_access'}, {}), '(mock_view_access)', False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((474, 17, 474, 23), 'mock.Mock', 'Mock', ({}, {}), '()', False, 'from mock import Mock, patch\n'), ((476, 17, 476, 23), 'mock.Mock', 'Mock', ({}, {}), '()', False, 'from mock import Mock, patch\n'), ((479, 17, 479, 50), 'django_roles_access.utils.analyze_by_role', 'analyze_by_role', ({(479, 33, 479, 49): 'mock_view_access'}, {}), '(mock_view_access)', False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((488, 17, 488, 50), 'django_roles_access.utils.analyze_by_role', 'analyze_by_role', ({(488, 33, 488, 49): 'mock_view_access'}, {}), '(mock_view_access)', False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((496, 22, 496, 75), 'django_roles_access.models.ViewAccess.objects.create', 'ViewAccess.objects.create', (), '', False, 'from django_roles_access.models import ViewAccess\n'), ((497, 17, 497, 45), 'django_roles_access.utils.analyze_by_role', 'analyze_by_role', ({(497, 33, 497, 44): 'view_access'}, {}), '(view_access)', False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((502, 22, 502, 75), 'django_roles_access.models.ViewAccess.objects.create', 'ViewAccess.objects.create', (), '', False, 'from django_roles_access.models import ViewAccess\n'), ((503, 17, 503, 45), 'django_roles_access.utils.analyze_by_role', 'analyze_by_role', ({(503, 33, 503, 44): 'view_access'}, {}), '(view_access)', False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((508, 22, 508, 75), 'django_roles_access.models.ViewAccess.objects.create', 'ViewAccess.objects.create', (), '', False, 'from django_roles_access.models import ViewAccess\n'), ((509, 26, 509, 68), 'django.contrib.auth.models.Group.objects.get_or_create', 'Group.objects.get_or_create', (), '', False, 'from django.contrib.auth.models import Group\n'), ((510, 26, 510, 68), 'django.contrib.auth.models.Group.objects.get_or_create', 'Group.objects.get_or_create', (), '', False, 'from django.contrib.auth.models import Group\n'), ((514, 17, 514, 45), 'django_roles_access.utils.analyze_by_role', 'analyze_by_role', ({(514, 33, 514, 44): 'view_access'}, {}), '(view_access)', False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((519, 22, 519, 75), 'django_roles_access.models.ViewAccess.objects.create', 'ViewAccess.objects.create', (), '', False, 'from django_roles_access.models import ViewAccess\n'), ((520, 17, 520, 45), 'django_roles_access.utils.analyze_by_role', 'analyze_by_role', ({(520, 33, 520, 44): 'view_access'}, {}), '(view_access)', False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((530, 22, 530, 28), 'mock.Mock', 'Mock', ({}, {}), '()', False, 'from mock import Mock, patch\n'), ((534, 17, 535, 75), 'django_roles_access.utils.view_access_analyzer', 'view_access_analyzer', ({(534, 38, 534, 53): '"""fake-app-type"""', (534, 55, 534, 70): '"""fake-callback"""', (535, 38, 535, 54): '"""fake-view-name"""', (535, 56, 535, 74): '"""fake-site-active"""'}, {}), "('fake-app-type', 'fake-callback', 'fake-view-name',\n    'fake-site-active')", False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((544, 22, 544, 28), 'mock.Mock', 'Mock', ({}, {}), '()', False, 'from mock import Mock, patch\n'), ((548, 8, 549, 66), 'django_roles_access.utils.view_access_analyzer', 'view_access_analyzer', ({(548, 29, 548, 44): '"""fake-app-type"""', (548, 46, 548, 61): '"""fake-callback"""', (549, 29, 549, 45): '"""fake-view-name"""', (549, 47, 549, 65): '"""fake-site-active"""'}, {}), "('fake-app-type', 'fake-callback', 'fake-view-name',\n    'fake-site-active')", False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((555, 22, 555, 28), 'mock.Mock', 'Mock', ({}, {}), '()', False, 'from mock import Mock, patch\n'), ((559, 8, 560, 66), 'django_roles_access.utils.view_access_analyzer', 'view_access_analyzer', ({(559, 29, 559, 44): '"""fake-app-type"""', (559, 46, 559, 61): '"""fake-callback"""', (560, 29, 560, 45): '"""fake-view-name"""', (560, 47, 560, 65): '"""fake-site-active"""'}, {}), "('fake-app-type', 'fake-callback', 'fake-view-name',\n    'fake-site-active')", False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((566, 22, 566, 28), 'mock.Mock', 'Mock', ({}, {}), '()', False, 'from mock import Mock, patch\n'), ((570, 8, 571, 66), 'django_roles_access.utils.view_access_analyzer', 'view_access_analyzer', ({(570, 29, 570, 44): '"""fake-app-type"""', (570, 46, 570, 61): '"""fake-callback"""', (571, 29, 571, 45): '"""fake-view-name"""', (571, 47, 571, 65): '"""fake-site-active"""'}, {}), "('fake-app-type', 'fake-callback', 'fake-view-name',\n    'fake-site-active')", False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((578, 22, 578, 28), 'mock.Mock', 'Mock', ({}, {}), '()', False, 'from mock import Mock, patch\n'), ((582, 17, 583, 61), 'django_roles_access.utils.view_access_analyzer', 'view_access_analyzer', ({(582, 38, 582, 53): '"""fake-app-type"""', (582, 55, 582, 70): '"""fake-callback"""', (583, 38, 583, 54): '"""fake-view-name"""', (583, 56, 583, 60): 'True'}, {}), "('fake-app-type', 'fake-callback', 'fake-view-name', True)", False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((590, 22, 590, 28), 'mock.Mock', 'Mock', ({}, {}), '()', False, 'from mock import Mock, patch\n'), ((594, 8, 595, 52), 'django_roles_access.utils.view_access_analyzer', 'view_access_analyzer', ({(594, 29, 594, 44): '"""fake-app-type"""', (594, 46, 594, 61): '"""fake-callback"""', (595, 29, 595, 45): '"""fake-view-name"""', (595, 47, 595, 51): '(True)'}, {}), "('fake-app-type', 'fake-callback', 'fake-view-name', True)", False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((602, 22, 602, 28), 'mock.Mock', 'Mock', ({}, {}), '()', False, 'from mock import Mock, patch\n'), ((606, 8, 607, 52), 'django_roles_access.utils.view_access_analyzer', 'view_access_analyzer', ({(606, 29, 606, 44): '"""fake-app-type"""', (606, 46, 606, 61): '"""fake-callback"""', (607, 29, 607, 45): '"""fake-view-name"""', (607, 47, 607, 51): '(True)'}, {}), "('fake-app-type', 'fake-callback', 'fake-view-name', True)", False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((614, 22, 614, 28), 'mock.Mock', 'Mock', ({}, {}), '()', False, 'from mock import Mock, patch\n'), ((618, 8, 619, 52), 'django_roles_access.utils.view_access_analyzer', 'view_access_analyzer', ({(618, 29, 618, 44): '"""fake-app-type"""', (618, 46, 618, 61): '"""fake-callback"""', (619, 29, 619, 45): '"""fake-view-name"""', (619, 47, 619, 51): '(True)'}, {}), "('fake-app-type', 'fake-callback', 'fake-view-name', True)", False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((628, 17, 629, 61), 'django_roles_access.utils.view_access_analyzer', 'view_access_analyzer', ({(628, 38, 628, 42): 'None', (628, 44, 628, 59): '"""fake-callback"""', (629, 38, 629, 54): '"""fake-view-name"""', (629, 56, 629, 60): 'True'}, {}), "(None, 'fake-callback', 'fake-view-name', True)", False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((638, 17, 639, 61), 'django_roles_access.utils.view_access_analyzer', 'view_access_analyzer', ({(638, 38, 638, 51): '"""NOT_SECURED"""', (638, 53, 638, 68): '"""fake-callback"""', (639, 38, 639, 54): '"""fake-view-name"""', (639, 56, 639, 60): 'True'}, {}), "('NOT_SECURED', 'fake-callback', 'fake-view-name', True)", False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((648, 17, 649, 61), 'django_roles_access.utils.view_access_analyzer', 'view_access_analyzer', ({(648, 38, 648, 48): '"""DISABLED"""', (648, 50, 648, 65): '"""fake-callback"""', (649, 38, 649, 54): '"""fake-view-name"""', (649, 56, 649, 60): 'True'}, {}), "('DISABLED', 'fake-callback', 'fake-view-name', True)", False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((658, 17, 659, 61), 'django_roles_access.utils.view_access_analyzer', 'view_access_analyzer', ({(658, 38, 658, 47): '"""SECURED"""', (658, 49, 658, 64): '"""fake-callback"""', (659, 38, 659, 54): '"""fake-view-name"""', (659, 56, 659, 60): 'True'}, {}), "('SECURED', 'fake-callback', 'fake-view-name', True)", False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((668, 17, 669, 61), 'django_roles_access.utils.view_access_analyzer', 'view_access_analyzer', ({(668, 38, 668, 46): '"""PUBLIC"""', (668, 48, 668, 63): '"""fake-callback"""', (669, 38, 669, 54): '"""fake-view-name"""', (669, 56, 669, 60): 'True'}, {}), "('PUBLIC', 'fake-callback', 'fake-view-name', True)", False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((680, 22, 680, 28), 'mock.Mock', 'Mock', ({}, {}), '()', False, 'from mock import Mock, patch\n'), ((684, 17, 685, 62), 'django_roles_access.utils.view_access_analyzer', 'view_access_analyzer', ({(684, 38, 684, 53): '"""fake-app-type"""', (684, 55, 684, 63): 'function', (685, 38, 685, 54): '"""fake-view-name"""', (685, 56, 685, 61): 'False'}, {}), "('fake-app-type', function, 'fake-view-name', False)", False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((698, 22, 698, 28), 'mock.Mock', 'Mock', ({}, {}), '()', False, 'from mock import Mock, patch\n'), ((702, 17, 703, 62), 'django_roles_access.utils.view_access_analyzer', 'view_access_analyzer', ({(702, 38, 702, 53): '"""fake-app-type"""', (702, 55, 702, 63): 'function', (703, 38, 703, 54): '"""fake-view-name"""', (703, 56, 703, 61): 'False'}, {}), "('fake-app-type', function, 'fake-view-name', False)", False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((716, 17, 717, 62), 'django_roles_access.utils.view_access_analyzer', 'view_access_analyzer', ({(716, 38, 716, 46): '"""PUBLIC"""', (716, 48, 716, 56): 'function', (717, 38, 717, 54): '"""fake-view-name"""', (717, 56, 717, 61): 'False'}, {}), "('PUBLIC', function, 'fake-view-name', False)", False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((730, 17, 731, 62), 'django_roles_access.utils.view_access_analyzer', 'view_access_analyzer', ({(730, 38, 730, 42): 'None', (730, 44, 730, 52): 'function', (731, 38, 731, 54): '"""fake-view-name"""', (731, 56, 731, 61): 'False'}, {}), "(None, function, 'fake-view-name', False)", False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((744, 17, 745, 62), 'django_roles_access.utils.view_access_analyzer', 'view_access_analyzer', ({(744, 38, 744, 50): '"""Authorized"""', (744, 52, 744, 60): 'function', (745, 38, 745, 54): '"""fake-view-name"""', (745, 56, 745, 61): 'False'}, {}), "('Authorized', function, 'fake-view-name', False)", False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((753, 17, 756, 17), 'django_roles_access.utils.view_access_analyzer', 'view_access_analyzer', ({(754, 12, 754, 21): '"""SECURED"""', (754, 23, 754, 51): 'views.MiddlewareView.as_view', (755, 12, 755, 55): '"""django_roles_access:middleware_view_class"""', (756, 12, 756, 16): 'True'}, {}), "('SECURED', views.MiddlewareView.as_view,\n    'django_roles_access:middleware_view_class', True)", False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((760, 8, 762, 22), 'django_roles_access.models.ViewAccess.objects.create', 'ViewAccess.objects.create', (), '', False, 'from django_roles_access.models import ViewAccess\n'), ((763, 17, 766, 17), 'django_roles_access.utils.view_access_analyzer', 'view_access_analyzer', ({(764, 12, 764, 25): '"""NOT_SECURED"""', (764, 27, 764, 55): 'views.MiddlewareView.as_view', (765, 12, 765, 55): '"""django_roles_access:middleware_view_class"""', (766, 12, 766, 16): 'True'}, {}), "('NOT_SECURED', views.MiddlewareView.as_view,\n    'django_roles_access:middleware_view_class', True)", False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((770, 8, 772, 22), 'django_roles_access.models.ViewAccess.objects.create', 'ViewAccess.objects.create', (), '', False, 'from django_roles_access.models import ViewAccess\n'), ((773, 17, 776, 17), 'django_roles_access.utils.view_access_analyzer', 'view_access_analyzer', ({(774, 12, 774, 22): '"""DISABLED"""', (774, 24, 774, 52): 'views.MiddlewareView.as_view', (775, 12, 775, 55): '"""django_roles_access:middleware_view_class"""', (776, 12, 776, 16): 'True'}, {}), "('DISABLED', views.MiddlewareView.as_view,\n    'django_roles_access:middleware_view_class', True)", False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((782, 8, 784, 22), 'django_roles_access.models.ViewAccess.objects.create', 'ViewAccess.objects.create', (), '', False, 'from django_roles_access.models import ViewAccess\n'), ((785, 17, 788, 17), 'django_roles_access.utils.view_access_analyzer', 'view_access_analyzer', ({(786, 12, 786, 21): '"""SECURED"""', (786, 23, 786, 51): 'views.MiddlewareView.as_view', (787, 12, 787, 55): '"""django_roles_access:middleware_view_class"""', (788, 12, 788, 16): 'True'}, {}), "('SECURED', views.MiddlewareView.as_view,\n    'django_roles_access:middleware_view_class', True)", False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((794, 22, 794, 63), 'django.contrib.auth.models.Group.objects.get_or_create', 'Group.objects.get_or_create', (), '', False, 'from django.contrib.auth.models import Group\n'), ((795, 22, 795, 63), 'django.contrib.auth.models.Group.objects.get_or_create', 'Group.objects.get_or_create', (), '', False, 'from django.contrib.auth.models import Group\n'), ((796, 22, 798, 22), 'django_roles_access.models.ViewAccess.objects.create', 'ViewAccess.objects.create', (), '', False, 'from django_roles_access.models import ViewAccess\n'), ((802, 17, 805, 17), 'django_roles_access.utils.view_access_analyzer', 'view_access_analyzer', ({(803, 12, 803, 21): '"""SECURED"""', (803, 23, 803, 51): 'views.MiddlewareView.as_view', (804, 12, 804, 55): '"""django_roles_access:middleware_view_class"""', (805, 12, 805, 16): 'True'}, {}), "('SECURED', views.MiddlewareView.as_view,\n    'django_roles_access:middleware_view_class', True)", False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((810, 8, 812, 22), 'django_roles_access.models.ViewAccess.objects.create', 'ViewAccess.objects.create', (), '', False, 'from django_roles_access.models import ViewAccess\n'), ((813, 17, 816, 17), 'django_roles_access.utils.view_access_analyzer', 'view_access_analyzer', ({(814, 12, 814, 21): '"""SECURED"""', (814, 23, 814, 51): 'views.MiddlewareView.as_view', (815, 12, 815, 55): '"""django_roles_access:middleware_view_class"""', (816, 12, 816, 16): 'True'}, {}), "('SECURED', views.MiddlewareView.as_view,\n    'django_roles_access:middleware_view_class', True)", False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((821, 8, 823, 22), 'django_roles_access.models.ViewAccess.objects.create', 'ViewAccess.objects.create', (), '', False, 'from django_roles_access.models import ViewAccess\n'), ((824, 17, 827, 17), 'django_roles_access.utils.view_access_analyzer', 'view_access_analyzer', ({(825, 12, 825, 21): '"""SECURED"""', (825, 23, 825, 51): 'views.MiddlewareView.as_view', (826, 12, 826, 55): '"""django_roles_access:middleware_view_class"""', (827, 12, 827, 16): 'True'}, {}), "('SECURED', views.MiddlewareView.as_view,\n    'django_roles_access:middleware_view_class', True)", False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((833, 8, 835, 22), 'django_roles_access.models.ViewAccess.objects.create', 'ViewAccess.objects.create', (), '', False, 'from django_roles_access.models import ViewAccess\n'), ((836, 17, 839, 18), 'django_roles_access.utils.view_access_analyzer', 'view_access_analyzer', ({(837, 12, 837, 21): '"""SECURED"""', (837, 23, 837, 51): 'views.protected_view_by_role', (838, 12, 838, 56): '"""django_roles_access:view_protected_by_role"""', (839, 12, 839, 17): 'False'}, {}), "('SECURED', views.protected_view_by_role,\n    'django_roles_access:view_protected_by_role', False)", False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((845, 22, 845, 63), 'django.contrib.auth.models.Group.objects.get_or_create', 'Group.objects.get_or_create', (), '', False, 'from django.contrib.auth.models import Group\n'), ((846, 22, 846, 63), 'django.contrib.auth.models.Group.objects.get_or_create', 'Group.objects.get_or_create', (), '', False, 'from django.contrib.auth.models import Group\n'), ((847, 22, 849, 22), 'django_roles_access.models.ViewAccess.objects.create', 'ViewAccess.objects.create', (), '', False, 'from django_roles_access.models import ViewAccess\n'), ((853, 17, 856, 18), 'django_roles_access.utils.view_access_analyzer', 'view_access_analyzer', ({(854, 12, 854, 21): '"""SECURED"""', (854, 23, 854, 51): 'views.protected_view_by_role', (855, 12, 855, 56): '"""django_roles_access:view_protected_by_role"""', (856, 12, 856, 17): 'False'}, {}), "('SECURED', views.protected_view_by_role,\n    'django_roles_access:view_protected_by_role', False)", False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((861, 8, 863, 22), 'django_roles_access.models.ViewAccess.objects.create', 'ViewAccess.objects.create', (), '', False, 'from django_roles_access.models import ViewAccess\n'), ((864, 17, 867, 18), 'django_roles_access.utils.view_access_analyzer', 'view_access_analyzer', ({(865, 12, 865, 21): '"""SECURED"""', (865, 23, 865, 51): 'views.protected_view_by_role', (866, 12, 866, 56): '"""django_roles_access:view_protected_by_role"""', (867, 12, 867, 17): 'False'}, {}), "('SECURED', views.protected_view_by_role,\n    'django_roles_access:view_protected_by_role', False)", False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((872, 8, 874, 22), 'django_roles_access.models.ViewAccess.objects.create', 'ViewAccess.objects.create', (), '', False, 'from django_roles_access.models import ViewAccess\n'), ((875, 17, 878, 18), 'django_roles_access.utils.view_access_analyzer', 'view_access_analyzer', ({(876, 12, 876, 21): '"""SECURED"""', (876, 23, 876, 51): 'views.protected_view_by_role', (877, 12, 877, 56): '"""django_roles_access:view_protected_by_role"""', (878, 12, 878, 17): 'False'}, {}), "('SECURED', views.protected_view_by_role,\n    'django_roles_access:view_protected_by_role', False)", False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((885, 17, 888, 18), 'django_roles_access.utils.view_access_analyzer', 'view_access_analyzer', ({(886, 12, 886, 21): '"""SECURED"""', (886, 23, 886, 51): 'views.protected_view_by_role', (887, 12, 887, 56): '"""django_roles_access:view_protected_by_role"""', (888, 12, 888, 17): 'False'}, {}), "('SECURED', views.protected_view_by_role,\n    'django_roles_access:view_protected_by_role', False)", False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((896, 17, 899, 18), 'django_roles_access.utils.view_access_analyzer', 'view_access_analyzer', ({(897, 12, 897, 16): 'None', (897, 18, 897, 46): 'views.protected_view_by_role', (898, 12, 898, 56): '"""django_roles_access:view_protected_by_role"""', (899, 12, 899, 17): 'False'}, {}), "(None, views.protected_view_by_role,\n    'django_roles_access:view_protected_by_role', False)", False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((908, 8, 910, 22), 'django_roles_access.models.ViewAccess.objects.create', 'ViewAccess.objects.create', (), '', False, 'from django_roles_access.models import ViewAccess\n'), ((911, 17, 914, 18), 'django_roles_access.utils.view_access_analyzer', 'view_access_analyzer', ({(912, 12, 912, 16): 'None', (912, 18, 912, 39): 'views.middleware_view', (913, 12, 913, 54): '"""django_roles_access:middleware_view_func"""', (914, 12, 914, 17): 'False'}, {}), "(None, views.middleware_view,\n    'django_roles_access:middleware_view_func', False)", False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((925, 23, 925, 70), 'django_roles_access.utils.OutputReport', 'OutputReport', ({(925, 36, 925, 52): 'self.mock_stdout', (925, 54, 925, 69): 'self.mock_style'}, {}), '(self.mock_stdout, self.mock_style)', False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((235, 19, 235, 55), 'importlib.import_module', 'import_module', ({(235, 33, 235, 54): 'settings.ROOT_URLCONF'}, {}), '(settings.ROOT_URLCONF)', False, 'from importlib import import_module\n'), ((319, 12, 319, 34), 'django_roles_access.utils.get_views_by_app', 'get_views_by_app', ({(319, 29, 319, 33): 'data'}, {}), '(data)', False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((328, 12, 328, 34), 'django_roles_access.utils.get_views_by_app', 'get_views_by_app', ({(328, 29, 328, 33): 'data'}, {}), '(data)', False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((364, 19, 364, 55), 'importlib.import_module', 'import_module', ({(364, 33, 364, 54): 'settings.ROOT_URLCONF'}, {}), '(settings.ROOT_URLCONF)', False, 'from importlib import import_module\n'), ((370, 34, 370, 57), 'django_roles_access.utils.walk_site_url', 'walk_site_url', ({(370, 48, 370, 56): 'self.url'}, {}), '(self.url)', False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((377, 34, 377, 57), 'django_roles_access.utils.walk_site_url', 'walk_site_url', ({(377, 48, 377, 56): 'self.url'}, {}), '(self.url)', False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((384, 34, 384, 57), 'django_roles_access.utils.walk_site_url', 'walk_site_url', ({(384, 48, 384, 56): 'self.url'}, {}), '(self.url)', False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((392, 34, 392, 57), 'django_roles_access.utils.walk_site_url', 'walk_site_url', ({(392, 48, 392, 56): 'self.url'}, {}), '(self.url)', False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((431, 24, 431, 60), 'django_roles_access.utils.check_django_roles_is_used', 'check_django_roles_is_used', ({(431, 51, 431, 59): 'function'}, {}), '(function)', False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((441, 24, 441, 57), 'django_roles_access.utils.check_django_roles_is_used', 'check_django_roles_is_used', ({(441, 51, 441, 56): 'Aview'}, {}), '(Aview)', False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((446, 25, 446, 58), 'django_roles_access.utils.check_django_roles_is_used', 'check_django_roles_is_used', ({(446, 52, 446, 57): 'Aview'}, {}), '(Aview)', False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n'), ((921, 46, 921, 59), 'django.core.management.BaseCommand', 'BaseCommand', ({}, {}), '()', False, 'from django.core.management import BaseCommand\n'), ((922, 45, 922, 58), 'django.core.management.BaseCommand', 'BaseCommand', ({}, {}), '()', False, 'from django.core.management import BaseCommand\n'), ((942, 12, 942, 26), 'django_roles_access.utils.OutputReport', 'OutputReport', ({}, {}), '()', False, 'from django_roles_access.utils import walk_site_url, get_views_by_app, view_access_analyzer, get_view_analyze_report, check_django_roles_is_used, analyze_by_role, APP_NAME_FOR_NONE, NOT_SECURED_DEFAULT, SECURED_DEFAULT, PUBLIC_DEFAULT, NONE_TYPE_DEFAULT, DISABLED_DEFAULT, OutputReport\n')]