def home_authentication_switcher(request, *args, **kwargs): if cabot_needs_setup(): return redirect('first_time_setup') if not request.user.is_authenticated(): return ServicePublicListView.as_view()(request, *args, **kwargs) else: return ServiceListView.as_view()(request, *args, **kwargs)
def test_services_list(self): """test the services list queryset, since it uses some custom SQL for the active/inactive check counts""" # add a disabled check inactive_check = HttpStatusCheck(active=False) inactive_check.save() self.service.status_checks.add(inactive_check) self.service.save() qs = ServiceListView().get_queryset().all() self.assertEquals(len(qs), 1) service = qs[0] # check the extra fields are correct self.assertEquals(service.active_checks_count, 3) self.assertEquals(service.inactive_checks_count, 1)
url(r'^$', view=RedirectView.as_view(url='services/', permanent=False), name='dashboard'), url(r'^subscriptions/', view=subscriptions, name='subscriptions'), url(r'^accounts/login/', view=login, name='login'), url(r'^accounts/logout/', view=logout, name='logout'), url(r'^accounts/password-reset/', view=password_reset, name='password-reset'), url(r'^accounts/password-reset-done/', view=password_reset_done, name='password-reset-done'), url(r'^accounts/password-reset-confirm/', view=password_reset_confirm, name='password-reset-confirm'), url(r'^status/', view=checks_run_recently, name='system-status'), url(r'^services/', view=ServiceListView.as_view(), name='services'), url(r'^service/create/', view=ServiceCreateView.as_view(), name='create-service'), url(r'^service/update/(?P<pk>\d+)/', view=ServiceUpdateView.as_view( ), name='update-service'), url(r'^service/delete/(?P<pk>\d+)/', view=ServiceDeleteView.as_view( ), name='delete-service'), url(r'^service/(?P<pk>\d+)/', view=ServiceDetailView.as_view(), name='service'), url(r'^instances/', view=InstanceListView.as_view(), name='instances'), url(r'^instance/create/', view=InstanceCreateView.as_view(),
name='subscriptions'), url(r'^accounts/login/', view=first_time_setup_wrapper(login), name='login'), url(r'^accounts/logout/', view=logout, name='logout'), url(r'^setup/', view=SetupView.as_view(), name='first_time_setup'), url(r'^accounts/password-reset/', view=password_reset, name='password-reset'), url(r'^accounts/password-reset-done/', view=password_reset_done, name='password-reset-done'), url(r'^accounts/password-reset-confirm/', view=password_reset_confirm, name='password-reset-confirm'), url(r'^status/', view=checks_run_recently, name='system-status'), url(r'^about/', view=about, name='about-cabot'), url(r'^services/', view=ServiceListView.as_view(), name='services'), url(r'^public/', view=ServicePublicListView.as_view(), name='public'), url(r'^service/create/', view=ServiceCreateView.as_view(), name='create-service'), url(r'^service/update/(?P<pk>\d+)/', view=ServiceUpdateView.as_view(), name='update-service'), url(r'^service/delete/(?P<pk>\d+)/', view=ServiceDeleteView.as_view(), name='delete-service'), url(r'^service/(?P<pk>\d+)/', view=ServiceDetailView.as_view(), name='service'), url(r'^service/acknowledge_alert/(?P<pk>\d+)/', view=acknowledge_alert, name='acknowledge-alert'), url(r'^service/remove_acknowledgement/(?P<pk>\d+)/', view=remove_acknowledgement, name='remove-acknowledgement'),
view=first_time_setup_wrapper(login), name='login'), url(r'^accounts/logout/', view=logout, name='logout'), url(r'^setup/', view=SetupView.as_view(), name='first_time_setup'), url(r'^accounts/password-reset/', view=password_reset, name='password-reset'), url(r'^accounts/password-reset-done/', view=password_reset_done, name='password-reset-done'), url(r'^accounts/password-reset-confirm/', view=password_reset_confirm, name='password-reset-confirm'), url(r'^status/', view=checks_run_recently, name='system-status'), url(r'^about/', view=about, name='about-cabot'), url(r'^services/', view=ServiceListView.as_view(), name='services'), url(r'^public/', view=ServicePublicListView.as_view(), name='public'), url(r'^service/create/', view=ServiceCreateView.as_view(), name='create-service'), url(r'^service/update/(?P<pk>\d+)/', view=ServiceUpdateView.as_view(), name='update-service'), url(r'^service/delete/(?P<pk>\d+)/', view=ServiceDeleteView.as_view(), name='delete-service'), url(r'^service/(?P<pk>\d+)/', view=ServiceDetailView.as_view(), name='service'), url(r'^service/acknowledge_alert/(?P<pk>\d+)/', view=acknowledge_alert,
logger = logging.getLogger(__name__) urlpatterns = patterns( "", # for the password reset views url("^", include("django.contrib.auth.urls")), url(r"^$", view=RedirectView.as_view(url="services/", permanent=False), name="dashboard"), url(r"^subscriptions/", view=subscriptions, name="subscriptions"), url(r"^accounts/login/", view=login, name="login"), url(r"^accounts/logout/", view=logout, name="logout"), url(r"^accounts/password-reset/", view=password_reset, name="password-reset"), url(r"^accounts/password-reset-done/", view=password_reset_done, name="password-reset-done"), url(r"^accounts/password-reset-confirm/", view=password_reset_confirm, name="password-reset-confirm"), url(r"^status/", view=checks_run_recently, name="system-status"), url(r"^services/", view=ServiceListView.as_view(), name="services"), url(r"^service/create/", view=ServiceCreateView.as_view(), name="create-service"), url(r"^service/update/(?P<pk>\d+)/", view=ServiceUpdateView.as_view(), name="update-service"), url(r"^service/delete/(?P<pk>\d+)/", view=ServiceDeleteView.as_view(), name="delete-service"), url(r"^service/(?P<pk>\d+)/", view=ServiceDetailView.as_view(), name="service"), url(r"^service/acknowledge_alert/(?P<pk>\d+)/", view=acknowledge_alert, name="acknowledge-alert"), url(r"^service/remove_acknowledgement/(?P<pk>\d+)/", view=remove_acknowledgement, name="remove-acknowledgement"), url(r"^instances/", view=InstanceListView.as_view(), name="instances"), url(r"^instance/create/", view=InstanceCreateView.as_view(), name="create-instance"), url(r"^instance/update/(?P<pk>\d+)/", view=InstanceUpdateView.as_view(), name="update-instance"), url(r"^instance/duplicate/(?P<pk>\d+)/", view=duplicate_instance, name="duplicate-instance"), url(r"^instance/delete/(?P<pk>\d+)/", view=InstanceDeleteView.as_view(), name="delete-instance"), url(r"^instance/(?P<pk>\d+)/", view=InstanceDetailView.as_view(), name="instance"), url(r"^checks/$", view=StatusCheckListView.as_view(), name="checks"), url(r"^check/run/(?P<pk>\d+)/", view=run_status_check, name="run-check"), url(r"^check/delete/(?P<pk>\d+)/", view=StatusCheckDeleteView.as_view(), name="delete-check"),
name='dashboard'), url(r'^subscriptions/', view=subscriptions, name='subscriptions'), url(r'^accounts/login/', view=login, name='login'), url(r'^accounts/logout/', view=logout, name='logout'), url(r'^accounts/password-reset/', view=password_reset, name='password-reset'), url(r'^accounts/password-reset-done/', view=password_reset_done, name='password-reset-done'), url(r'^accounts/password-reset-confirm/', view=password_reset_confirm, name='password-reset-confirm'), url(r'^status/', view=checks_run_recently, name='system-status'), url(r'^services/', view=ServiceListView.as_view(), name='services'), url(r'^service/create/', view=ServiceCreateView.as_view(), name='create-service'), url(r'^service/update/(?P<pk>\d+)/', view=ServiceUpdateView.as_view(), name='update-service'), url(r'^service/delete/(?P<pk>\d+)/', view=ServiceDeleteView.as_view(), name='delete-service'), url(r'^service/(?P<pk>\d+)/', view=ServiceDetailView.as_view(), name='service'), url(r'^instances/', view=InstanceListView.as_view(), name='instances'), url(r'^instance/create/', view=InstanceCreateView.as_view(), name='create-instance'), url(r'^instance/update/(?P<pk>\d+)/', view=InstanceUpdateView.as_view(), name='update-instance'), url(r'^instance/duplicate/(?P<pk>\d+)/', view=duplicate_instance, name='duplicate-instance'),