Exemplo n.º 1
0
    def test_redirect_url_returns_no_params_if_no_username(self):
        user = Mock()
        request = Mock()
        request.GET = {}
        view = DisableUserView(user=user, request=request)
        with patch('corehq.apps.hqadmin.views.users.reverse') as mock_reverse:
            mock_reverse.return_value = 'dummy_url'
            redirect_url = view.redirect_url

        self.assertEqual(redirect_url, 'dummy_url')
Exemplo n.º 2
0
    def test_redirect_url_username_is_encoded(self):
        user = Mock()
        request = Mock()
        request.GET = {'username': '******'}
        view = DisableUserView(user=user, request=request)
        with patch('corehq.apps.hqadmin.views.users.reverse') as mock_reverse:
            mock_reverse.return_value = 'dummy_url/'
            redirect_url = view.redirect_url

        self.assertEqual(redirect_url,
                         'dummy_url/?q=test%2Bexample%40dimagi.com')
Exemplo n.º 3
0
 # Same view supported with three possible urls to support tracking
 # username and domain in the url via audit
 url(r'^auth_as/$', AuthenticateAs.as_view(), name=AuthenticateAs.urlname),
 url(r'^auth_as/(?P<username>[^/]*)/$', AuthenticateAs.as_view(), name=AuthenticateAs.urlname),
 url(r'^auth_as/(?P<username>[^/]*)/(?P<domain>{})/$'.format(new_domain_re),
     AuthenticateAs.as_view(), name=AuthenticateAs.urlname),
 url(r'^superuser_management/$', SuperuserManagement.as_view(), name=SuperuserManagement.urlname),
 url(r'^phone/restore/$', AdminRestoreView.as_view(), name="admin_restore"),
 url(r'^phone/restore/(?P<app_id>[\w-]+)/$', AdminRestoreView.as_view(), name='app_aware_admin_restore'),
 url(r'^app_build_timings/$', AppBuildTimingsView.as_view(), name="app_build_timings"),
 url(r'^stats_data/$', stats_data, name="admin_stats_data"),
 url(r'^admin_reports_stats_data/$', admin_reports_stats_data, name="admin_reports_stats_data"),
 url(r'^do_pillow_op/$', pillow_operation_api, name="pillow_operation_api"),
 url(r'^web_user_lookup/$', web_user_lookup, name='web_user_lookup'),
 url(r'^disable_two_factor/$', DisableTwoFactorView.as_view(), name=DisableTwoFactorView.urlname),
 url(r'^disable_account/$', DisableUserView.as_view(), name=DisableUserView.urlname),
 url(r'^doc_in_es/$', doc_in_es, name='doc_in_es'),
 url(r'^raw_couch/$', raw_couch, name='raw_couch'),
 url(r'^raw_doc/$', raw_doc, name='raw_doc'),
 url(r'^api/', include(admin_api_urlpatterns)),
 url(r'^callcenter_ucr_check/$', CallcenterUCRCheck.as_view(), name=CallcenterUCRCheck.urlname),
 url(r'^download_malt/$',
     DownloadMALTView.as_view(), name=DownloadMALTView.urlname),
 url(r'^download_gir', DownloadGIRView.as_view(), name=DownloadGIRView.urlname),
 url(r'^dimagisphere/$',
     require_superuser(DimagisphereView.as_view(template_name='hqadmin/dimagisphere/form_feed.html')),
     name='dimagisphere'),
 url(r'^reprocess_messaging_case_updates/$', ReprocessMessagingCaseUpdatesView.as_view(),
     name=ReprocessMessagingCaseUpdatesView.urlname),
 url(r'^top_five_projects_by_country/$', top_five_projects_by_country, name='top_five_projects_by_country'),
 url(r'^web_user_data', WebUserDataView.as_view(), name=WebUserDataView.urlname),
Exemplo n.º 4
0
     name=SuperuserManagement.urlname),
 url(r'^phone/restore/$', AdminRestoreView.as_view(), name="admin_restore"),
 url(r'^phone/restore/(?P<app_id>[\w-]+)/$',
     AdminRestoreView.as_view(),
     name='app_aware_admin_restore'),
 url(r'^stats_data/$', stats_data, name="admin_stats_data"),
 url(r'^admin_reports_stats_data/$',
     admin_reports_stats_data,
     name="admin_reports_stats_data"),
 url(r'^do_pillow_op/$', pillow_operation_api, name="pillow_operation_api"),
 url(r'^web_user_lookup/$', web_user_lookup, name='web_user_lookup'),
 url(r'^disable_two_factor/$',
     DisableTwoFactorView.as_view(),
     name=DisableTwoFactorView.urlname),
 url(r'^disable_account/$',
     DisableUserView.as_view(),
     name=DisableUserView.urlname),
 url(r'^doc_in_es/$', doc_in_es, name='doc_in_es'),
 url(r'^raw_couch/$', raw_couch, name='raw_couch'),
 url(r'^raw_doc/$', raw_doc, name='raw_doc'),
 url(r'^api/', include(admin_api_urlpatterns)),
 url(r'^callcenter_ucr_check/$',
     CallcenterUCRCheck.as_view(),
     name=CallcenterUCRCheck.urlname),
 url(r'^api/', include(admin_api_urlpatterns)),
 url(r'^download_malt/$',
     DownloadMALTView.as_view(),
     name=DownloadMALTView.urlname),
 url(r'^download_gir',
     DownloadGIRView.as_view(),
     name=DownloadGIRView.urlname),
Exemplo n.º 5
0
    url(r'^system/autostaging/$', branches_on_staging, name="branches_on_staging"),
    url(r'^mass_email/$', mass_email, name="mass_email"),
    # Same view supported with three possible urls to support tracking
    # username and domain in the url via audit
    url(r'^auth_as/$', AuthenticateAs.as_view(), name=AuthenticateAs.urlname),
    url(r'^auth_as/(?P<username>[^/]*)/$', AuthenticateAs.as_view(), name=AuthenticateAs.urlname),
    url(r'^auth_as/(?P<username>[^/]*)/(?P<domain>{})/$'.format(new_domain_re),
        AuthenticateAs.as_view(), name=AuthenticateAs.urlname),
    url(r'^superuser_management/$', SuperuserManagement.as_view(), name=SuperuserManagement.urlname),
    url(r'^phone/restore/$', AdminRestoreView.as_view(), name="admin_restore"),
    url(r'^phone/restore/(?P<app_id>[\w-]+)/$', AdminRestoreView.as_view(), name='app_aware_admin_restore'),
    url(r'^app_build_timings/$', AppBuildTimingsView.as_view(), name="app_build_timings"),
    url(r'^do_pillow_op/$', pillow_operation_api, name="pillow_operation_api"),
    url(r'^web_user_lookup/$', web_user_lookup, name='web_user_lookup'),
    url(r'^disable_two_factor/$', DisableTwoFactorView.as_view(), name=DisableTwoFactorView.urlname),
    url(r'^disable_account/$', DisableUserView.as_view(), name=DisableUserView.urlname),
    url(r'^doc_in_es/$', doc_in_es, name='doc_in_es'),
    url(r'^raw_couch/$', raw_doc, name='raw_couch'),
    url(r'^raw_doc/$', raw_doc, name='raw_doc'),
    url(r'^api/', include(admin_api_urlpatterns)),
    url(r'^callcenter_ucr_check/$', CallcenterUCRCheck.as_view(), name=CallcenterUCRCheck.urlname),
    url(r'^download_malt/$',
        DownloadMALTView.as_view(), name=DownloadMALTView.urlname),
    url(r'^download_gir', DownloadGIRView.as_view(), name=DownloadGIRView.urlname),
    url(r'^reprocess_messaging_case_updates/$', ReprocessMessagingCaseUpdatesView.as_view(),
        name=ReprocessMessagingCaseUpdatesView.urlname),
    url(r'^top_five_projects_by_country/$', top_five_projects_by_country, name='top_five_projects_by_country'),
    url(r'^web_user_data', WebUserDataView.as_view(), name=WebUserDataView.urlname),
    AdminReportDispatcher.url_pattern(),
]