def test_context_data(self): # Setup request and view queryset = UserService.objects.all() request = self.factory.get('/') request.user = self.user view = UserServiceListView( template_name='services/services.html', context_object_name="services_list", object_list=queryset) view = setup_view(view, request) context = view.get_context_data() if request.user.is_authenticated(): nb_user_service = nb_service = 20 context, action = self.get_action_context(context, nb_user_service, nb_service) self.assertEqual(context['action'], action) nb_user_service = 19 nb_service = 20 context, action = self.get_action_context(context, nb_user_service, nb_service) self.assertEqual(context['action'], action)
def test_context_data(self): # Setup request and view queryset = UserService.objects.all() request = self.factory.get(reverse('user_services')) request.user = self.user response = UserServiceListView.as_view()(request) self.assertEqual(response.status_code, 200) view = UserServiceListView(template_name='services/services.html', context_object_name="services_list", object_list=queryset) view = setup_view(view, request) context = view.get_context_data() self.assertIn('service_list_remaining', context)
def test_context_data(self): # Setup request and view queryset = UserService.objects.all() request = self.factory.get(reverse('user_services')) request.user = self.user response = UserServiceListView.as_view()(request) self.assertEqual(response.status_code, 200) view = UserServiceListView( template_name='services/services.html', context_object_name="services_list", object_list=queryset) view = setup_view(view, request) context = view.get_context_data() self.assertIn('service_list_remaining', context)
url(r'^th/trigger/edit/thanks', TriggerEditedTemplateView.as_view(), name="trigger_edit_thanks"), url(r'^th/trigger/delete/thanks', TriggerDeletedTemplateView.as_view(), name="trigger_delete_thanks"), url(r'^th/trigger/onoff/(?P<trigger_id>\d+)$', trigger_on_off, name="trigger_on_off"), url(r'^th/trigger/all/(?P<switch>(on|off))$', trigger_switch_all_to, name="trigger_switch_all_to"), # **************************************** # * service # **************************************** url(r'^th/service/$', UserServiceListView.as_view(), name='user_services'), url(r'^th/service/(?P<action>\w+)$', UserServiceListView.as_view(), name='user_services'), url(r'^th/service/add/$', UserServiceCreateView.as_view(), name='add_service'), url(r'^th/service/edit/(?P<pk>\d+)$', UserServiceUpdateView.as_view(), name='edit_service'), url(r'^th/service/delete/(?P<pk>\d+)$', UserServiceDeleteView.as_view(), name='delete_service'), url(r'^th/service/renew/(?P<pk>\d+)$', renew_service, name="renew_service"), url(r'^th/service/delete/$', UserServiceDeleteView.as_view(),
url(r'^th/trigger/edit/thanks', TriggerEditedTemplateView.as_view(), name="trigger_edit_thanks"), url(r'^th/trigger/delete/thanks', TriggerDeletedTemplateView.as_view(), name="trigger_delete_thanks"), url(r'^th/trigger/onoff/(?P<trigger_id>\d+)$', trigger_on_off, name="trigger_on_off"), url(r'^th/trigger/all/(?P<switch>(on|off))$', trigger_switch_all_to, name="trigger_switch_all_to"), # **************************************** # * service # **************************************** url(r'^th/service/$', UserServiceListView.as_view(), name='user_services'), url(r'^th/service/add/$', UserServiceCreateView.as_view(), name='add_service'), url(r'^th/service/delete/(?P<pk>\d+)$', UserServiceDeleteView.as_view(), name='delete_service'), url(r'^th/service/add/thanks', UserServiceAddedTemplateView.as_view(), name="service_add_thanks"), # name="service_added"), url(r'^th/service/renew/(?P<pk>\d+)$', renew_service, name="renew_service"), url(r'^th/service/delete/$', UserServiceDeleteView.as_view(),
path('th/trigger/edit/thanks', TriggerEditedTemplateView.as_view(), name="trigger_edit_thanks"), path('th/trigger/delete/thanks', TriggerDeletedTemplateView.as_view(), name="trigger_delete_thanks"), path('th/trigger/onoff/<int:trigger_id>', trigger_on_off, name="trigger_on_off"), url(r'^th/trigger/all/(?P<switch>(on|off))$', trigger_switch_all_to, name="trigger_switch_all_to"), # **************************************** # * service # **************************************** path('th/services/', UserServiceListView.as_view(), name='user_services'), url(r'^th/service/add/(?P<service_name>\w+)$', UserServiceCreateView.as_view(), name='add_service'), url(r'^th/service/edit/(?P<pk>\d+)$', UserServiceUpdateView.as_view(), name='edit_service'), url(r'^th/service/delete/(?P<pk>\d+)$', UserServiceDeleteView.as_view(), name='delete_service'), url(r'^th/service/renew/(?P<pk>\d+)$', renew_service, name="renew_service"), path('th/service/delete/', UserServiceDeleteView.as_view(), name='delete_service'), url(r'^th/service/onoff/(?P<user_service_id>\d+)/(?P<switch>(on|off))$',
path('th/trigger/', TriggerListView.as_view(), name='home'), # **************************************** # * trigger # **************************************** url(r'^th/trigger/delete/(?P<pk>\d+)$', TriggerDeleteView.as_view(), name='delete_trigger'), url(r'^th/trigger/edit/(?P<pk>\d+)$', TriggerUpdateView.as_view(), name='edit_trigger'), path('th/trigger/editprovider/<int:trigger_id>', trigger_edit, {'edit_what': 'Provider'}, name='edit_provider'), path('th/trigger/editconsumer/<int:trigger_id>', trigger_edit, {'edit_what': 'Consumer'}, name='edit_consumer'), path('th/trigger/edit/thanks', TriggerEditedTemplateView.as_view(), name="trigger_edit_thanks"), path('th/trigger/delete/thanks', TriggerDeletedTemplateView.as_view(), name="trigger_delete_thanks"), path('th/trigger/onoff/<int:trigger_id>', trigger_on_off, name="trigger_on_off"), url(r'^th/trigger/all/(?P<switch>(on|off))$', trigger_switch_all_to, name="trigger_switch_all_to"), # **************************************** # * service # **************************************** path('th/services/', UserServiceListView.as_view(), name='user_services'), url(r'^th/service/add/(?P<service_name>\w+)$', UserServiceCreateView.as_view(), name='add_service'), url(r'^th/service/edit/(?P<pk>\d+)$', UserServiceUpdateView.as_view(), name='edit_service'), url(r'^th/service/delete/(?P<pk>\d+)$', UserServiceDeleteView.as_view(), name='delete_service'), url(r'^th/service/renew/(?P<pk>\d+)$', renew_service, name="renew_service"), path('th/service/delete/', UserServiceDeleteView.as_view(), name='delete_service'), url(r'^th/service/onoff/(?P<user_service_id>\d+)/(?P<switch>(on|off))$', service_related_triggers_switch_to, name="service_related_triggers_switch_to"), # **************************************** # wizard # **************************************** path('th/service/create/', UserServiceWizard.as_view([ProviderForm, DummyForm, ConsumerForm, DummyForm,
url(r"^th/trigger/edit/(?P<pk>\d+)$", TriggerUpdateView.as_view(), name="edit_trigger"), url( r"^th/trigger/editprovider/(?P<trigger_id>\d+)$", trigger_edit, {"edit_what": "Provider"}, name="edit_provider" ), url( r"^th/trigger/editconsumer/(?P<trigger_id>\d+)$", trigger_edit, {"edit_what": "Consumer"}, name="edit_consumer" ), url(r"^th/trigger/edit/thanks", TriggerEditedTemplateView.as_view(), name="trigger_edit_thanks"), url(r"^th/trigger/delete/thanks", TriggerDeletedTemplateView.as_view(), name="trigger_delete_thanks"), url(r"^th/trigger/onoff/(?P<trigger_id>\d+)$", trigger_on_off, name="trigger_on_off"), url(r"^th/trigger/fire/(?P<trigger_id>\d+)$", fire_trigger, name="fire_trigger"), url(r"^th/trigger/all/(?P<switch>(on|off))$", trigger_switch_all_to, name="trigger_switch_all_to"), # **************************************** # * service # **************************************** url(r"^th/service/$", UserServiceListView.as_view(), name="user_services"), url(r"^th/service/(?P<action>\w+)$", UserServiceListView.as_view(), name="user_services"), url(r"^th/service/add/$", UserServiceCreateView.as_view(), name="add_service"), url(r"^th/service/edit/(?P<pk>\d+)$", UserServiceUpdateView.as_view(), name="edit_service"), url(r"^th/service/delete/(?P<pk>\d+)$", UserServiceDeleteView.as_view(), name="delete_service"), url(r"^th/service/renew/(?P<pk>\d+)$", renew_service, name="renew_service"), url(r"^th/service/delete/$", UserServiceDeleteView.as_view(), name="delete_service"), url( r"^th/service/onoff/(?P<user_service_id>\d+)/(?P<switch>" r"(on|off))$", service_related_triggers_switch_to, name="service_related_triggers_switch_to", ), # **************************************** # wizard # **************************************** url(
url(r'^th/trigger/edit/thanks', TriggerEditedTemplateView.as_view(), name="trigger_edit_thanks"), url(r'^th/trigger/delete/thanks', TriggerDeletedTemplateView.as_view(), name="trigger_delete_thanks"), url(r'^th/trigger/onoff/(?P<trigger_id>\d+)$', trigger_on_off, name="trigger_on_off"), url(r'^th/trigger/all/(?P<switch>(on|off))$', trigger_switch_all_to, name="trigger_switch_all_to"), # **************************************** # * service # **************************************** url(r'^th/service/$', UserServiceListView.as_view(), name='user_services'), url(r'^th/service/add/(?P<service_name>\w+)$', UserServiceCreateView.as_view(), name='add_service'), url(r'^th/service/edit/(?P<pk>\d+)$', UserServiceUpdateView.as_view(), name='edit_service'), url(r'^th/service/delete/(?P<pk>\d+)$', UserServiceDeleteView.as_view(), name='delete_service'), url(r'^th/service/renew/(?P<pk>\d+)$', renew_service, name="renew_service"), url(r'^th/service/delete/$', UserServiceDeleteView.as_view(), name='delete_service'), url(r'^th/service/onoff/(?P<user_service_id>\d+)/(?P<switch>(on|off))$',