示例#1
0
 def test_request_with_parent_id_and_location_restriction(self):
     if self.factory is None:
         return
     view = LocationView.as_view()
     url = 'icds_locations'
     working_reverse = reverse(url, kwargs={'domain': self.domain.name})
     request = self.factory.get(
         working_reverse, data={'parent_id': self.block_3.location_id})
     self.user.set_location(self.domain.name, self.awc_3)
     request.user = self.user
     expected = {
         'locations': [{
             'name': 'Test Supervisor 3',
             'user_have_access_to_parent': True,
             'location_type_name': 'supervisor',
             'user_have_access': False,
             'parent_id': self.block_3.location_id,
             'location_id': self.supervisor_3.location_id
         }]
     }
     with mock.patch('corehq.apps.users.models.WebUser.has_permission',
                     return_value=False):
         response = view(request, domain='icds-test')
     self.user.unset_location_by_id(self.domain.name,
                                    self.awc_3.location_id)
     self.assertDictEqual(expected, json.loads(response.content))
示例#2
0
 def test_request_with_parent_id(self):
     if self.factory is None:
         return
     view = LocationView.as_view()
     url = 'icds_locations'
     working_reverse = reverse(url, kwargs={'domain': self.domain.name})
     request = self.factory.get(
         working_reverse, data={'parent_id': self.state_3.location_id})
     request.user = self.user
     response = view(request, domain='icds-test')
     expected = {
         'locations': [{
             'name': 'Test District 3_1',
             'user_have_access_to_parent': False,
             'location_type_name': 'district',
             'user_have_access': True,
             'parent_id': self.state_3.location_id,
             'location_id': self.district_3_1.location_id
         }, {
             'name': 'Test District 3_2',
             'user_have_access_to_parent': False,
             'location_type_name': 'district',
             'user_have_access': True,
             'parent_id': self.state_3.location_id,
             'location_id': self.district_3_2.location_id
         }]
     }
     self.assertDictEqual(expected, json.loads(response.content))
 def test_request_with_parent_id_and_location_restriction(self):
     if self.factory is None:
         return
     view = LocationView.as_view()
     url = 'icds_locations'
     working_reverse = reverse(url, kwargs={'domain': self.domain.name})
     request = self.factory.get(working_reverse, data={
         'parent_id': self.block_3.location_id
     })
     self.user.set_location(self.domain.name, self.awc_3)
     request.user = self.user
     expected = {
         'locations': [
             {
                 'name': 'Test Supervisor 3',
                 'user_have_access_to_parent': True,
                 'location_type_name': 'supervisor',
                 'user_have_access': False,
                 'parent_id': self.block_3.location_id,
                 'location_id': self.supervisor_3.location_id
             }
         ]
     }
     with mock.patch('corehq.apps.users.models.WebUser.has_permission', return_value=False):
         response = view(request, domain='icds-test')
     self.user.unset_location_by_id(self.domain.name, self.awc_3.location_id)
     self.assertDictEqual(expected, json.loads(response.content))
 def test_request_with_parent_id(self):
     if self.factory is None:
         return
     view = LocationView.as_view()
     url = 'icds_locations'
     working_reverse = reverse(url, kwargs={'domain': self.domain.name})
     request = self.factory.get(working_reverse, data={
         'parent_id': self.state_3.location_id
     })
     request.user = self.user
     response = view(request, domain='icds-test')
     expected = {
         'locations': [
             {
                 'name': 'Test District 3_1',
                 'user_have_access_to_parent': False,
                 'location_type_name': 'district',
                 'user_have_access': True,
                 'parent_id': self.state_3.location_id,
                 'location_id': self.district_3_1.location_id
             },
             {
                 'name': 'Test District 3_2',
                 'user_have_access_to_parent': False,
                 'location_type_name': 'district',
                 'user_have_access': True,
                 'parent_id': self.state_3.location_id,
                 'location_id': self.district_3_2.location_id
             }
         ]
     }
     self.assertDictEqual(expected, json.loads(response.content))
示例#5
0
 url(r'^underweight_children/(?P<step>[\w-]+)/',
     PrevalenceOfUndernutritionView.as_view(),
     name='underweight_children'),
 url(r'^prevalence_of_severe/(?P<step>[\w-]+)/',
     PrevalenceOfSevereView.as_view(),
     name='prevalence_of_severe'),
 url(r'^prevalence_of_stunting/(?P<step>[\w-]+)/',
     PrevalenceOfStuntingView.as_view(),
     name='prevalence_of_stunting'),
 url(r'^low_birth/(?P<step>[\w-]+)/',
     NewbornsWithLowBirthWeightView.as_view(),
     name='low_birth'),
 url(r'^early_initiation/(?P<step>[\w-]+)/',
     EarlyInitiationBreastfeeding.as_view(),
     name='early_initiation'),
 url(r'^locations$', LocationView.as_view(), name='icds_locations'),
 url(r'^locations/ancestors$',
     LocationAncestorsView.as_view(),
     name='icds_locations_ancestors'),
 url(r'^export_indicator$',
     ExportIndicatorView.as_view(),
     name='icds_export_indicator'),
 url(r'^fact_sheets$', FactSheetsView.as_view(), name='fact_sheets'),
 url(r'^exclusive-breastfeeding/(?P<step>[\w-]+)/',
     ExclusiveBreastfeedingView.as_view(),
     name='exclusive-breastfeeding'),
 url(r'^children_initiated/(?P<step>[\w-]+)/',
     ChildrenInitiatedView.as_view(),
     name='children_initiated'),
 url(r'^institutional_deliveries/(?P<step>[\w-]+)/',
     InstitutionalDeliveriesView.as_view(),
示例#6
0
    url(r'^tableau/(?P<workbook>\w+)/(?P<worksheet>\w+)$', TableauView.as_view(), name='icds_tableau'),
    url(r'^icds_dashboard/', include(dashboardurls)),
    url(r'^icds-ng-template/(?P<template>[\w-].+)', IcdsDynamicTemplateView.as_view(), name='icds-ng-template'),
    url(r'^program_summary/(?P<step>[\w-]+)/', ProgramSummaryView.as_view(), name='program_summary'),
    url(r'^lady_supervisor/', LadySupervisorView.as_view(), name='lady_supervisor'),
    url(
        r'^service_delivery_dashboard/',
        ServiceDeliveryDashboardView.as_view(),
        name='service_delivery_dashboard'
    ),
    url(r'^maternal_and_child/', include(maternal_and_child_urls)),
    url(r'^icds_cas_reach/', include(cas_reach_urls)),
    url(r'^demographics/', include(demographics_urls)),
    url(r'^awc_infrastructure/', include(awc_infrastructure_urls)),
    url(r'^awc_reports/(?P<step>[\w-]+)/', AwcReportsView.as_view(), name='awc_reports'),
    url(r'^locations$', LocationView.as_view(), name='icds_locations'),
    url(r'^locations/ancestors$', LocationAncestorsView.as_view(), name='icds_locations_ancestors'),
    url(r'^export_indicator$', ExportIndicatorView.as_view(), name='icds_export_indicator'),
    url(r'^fact_sheets$', FactSheetsView.as_view(), name='fact_sheets'),
    url(r'^aggregation_script/', AggregationScriptPage.as_view(), name=AggregationScriptPage.urlname),
    url(r'^bug_report/', ICDSBugReportView.as_view(), name='icds_bug_report'),
    url(r'^awc_locations/', AWCLocationView.as_view(), name='awc_locations'),
    url(r'^download_pdf/', DownloadPDFReport.as_view(), name='icds_download_pdf'),
    url(r'^download_excel/', DownloadExportReport.as_view(), name='icds_download_excel'),
    url(r'^issnip_pdf_status/', CheckExportReportStatus.as_view(), name='issnip_pdf_status'),
    url(r'^have_access_to_location/', HaveAccessToLocation.as_view(), name='have_access_to_location'),
    url(r'^inactive_aww', InactiveAWW.as_view(), name='inactive_aww'),
    url(r'^inactive_dashboard_users', InactiveDashboardUsers.as_view(), name='inactive_aww'),
    url(r'^health_indicators', DishaAPIView.as_view(), name='disha_api'),
    url(r'^cas_export', CasDataExport.as_view(), name='cas_export'),
]