def test_qr_code(self): """ Check that the qr code in the context is a string, as opposed to a byte object """ view = EnableMobilePrivilegesView() view.get_context_data = Mock(return_value={}) view.render_to_response = lambda x: x mock_request = Mock() mock_request.user.username = "******" with patch('corehq.apps.settings.views.sign', lambda x: b'foo'): context = view.get(mock_request) self.assertTrue(isinstance(context['qrcode_64'], str))
from corehq.apps.settings.views import ( ChangeMyPasswordView, DefaultMySettingsView, EnableMobilePrivilegesView, MyAccountSettingsView, MyProjectsList, new_api_key, default, project_id_mapping, redirect_users, redirect_domain_settings, ) urlpatterns = [ url(r'^$', DefaultMySettingsView.as_view(), name=DefaultMySettingsView.urlname), url(r'^settings/$', MyAccountSettingsView.as_view(), name=MyAccountSettingsView.urlname), url(r'^projects/$', MyProjectsList.as_view(), name=MyProjectsList.urlname), url(r'^password/$', ChangeMyPasswordView.as_view(), name=ChangeMyPasswordView.urlname), url(r'^mobile_privileges/$', EnableMobilePrivilegesView.as_view(), name=EnableMobilePrivilegesView.urlname), url(r'new_api_key/$', new_api_key, name='new_api_key'), ] domain_specific = [ url(r'^$', default, name="settings_default"), url(r'^users/', include('corehq.apps.users.urls')), url(r'^project/', include(domain_settings)), url(r'^cloudcare/', include(cloudcare_settings)), url(r'^commtrack/', include(commtrack_settings)), url(r'^products/', include(product_settings)), url(r'^programs/', include(program_settings)), url(r'^locations/', include(location_settings)), url(r'^api/id_mapping/$', project_id_mapping, name="project_id_mapping") ]
ChangeMyPasswordView, DefaultMySettingsView, EnableMobilePrivilegesView, MyAccountSettingsView, MyProjectsList, new_api_key, default, project_id_mapping, redirect_users, redirect_domain_settings, ) urlpatterns = patterns( 'corehq.apps.settings.views', url(r'^$', DefaultMySettingsView.as_view(), name=DefaultMySettingsView.urlname), url(r'^settings/$', MyAccountSettingsView.as_view(), name=MyAccountSettingsView.urlname), url(r'^projects/$', MyProjectsList.as_view(), name=MyProjectsList.urlname), url(r'^password/$', ChangeMyPasswordView.as_view(), name=ChangeMyPasswordView.urlname), url(r'^mobile_privileges/$', EnableMobilePrivilegesView.as_view(), name=EnableMobilePrivilegesView.urlname), url(r'new_api_key/$', new_api_key, name='new_api_key'), ) domain_specific = patterns('', url(r'^$', default, name="settings_default"), (r'^users/', include('corehq.apps.users.urls')), (r'^project/', include(domain_settings)), (r'^cloudcare/', include(cloudcare_settings)), (r'^commtrack/', include(commtrack_settings)), (r'^products/', include(product_settings)), (r'^programs/', include(program_settings)), (r'^locations/', include(location_settings)), url(r'^api/id_mapping/$', project_id_mapping, name="project_id_mapping") )
redirect_domain_settings, ) urlpatterns = [ url(r'^$', DefaultMySettingsView.as_view(), name=DefaultMySettingsView.urlname), url(r'^settings/$', MyAccountSettingsView.as_view(), name=MyAccountSettingsView.urlname), url(r'^projects/$', MyProjectsList.as_view(), name=MyProjectsList.urlname), url(r'^password/$', ChangeMyPasswordView.as_view(), name=ChangeMyPasswordView.urlname), url(r'^mobile_privileges/$', EnableMobilePrivilegesView.as_view(), name=EnableMobilePrivilegesView.urlname), url(r'new_api_key/$', new_api_key, name='new_api_key'), ] domain_specific = [ url(r'^$', default, name="settings_default"), url(r'^users/', include('corehq.apps.users.urls')), url(r'^project/', include(domain_settings)), url(r'^cloudcare/', include(cloudcare_settings)), url(r'^commtrack/', include(commtrack_settings)), url(r'^products/', include(product_settings)), url(r'^programs/', include(program_settings)), url(r'^locations/', include(location_settings)), url(r'^api/id_mapping/$', project_id_mapping, name="project_id_mapping") ]