Пример #1
0
 def test_get(self):
     template_name = 'services/service_form.html'
     t = self.create_triggerservice()
     # Setup request and view.
     request = RequestFactory().get('th/service/edit/')
     request.user = self.user
     view = UserServiceUpdateView.as_view(template_name=template_name)
     # Run.
     response = view(request, user=request.user, pk=t.id)
     # Check.
     self.assertEqual(response.status_code, 200)
     self.assertEqual(response.template_name[0], template_name)
Пример #2
0
 def test_get(self):
     template_name = 'services/service_form.html'
     t = self.create_triggerservice()
     # Setup request and view.
     request = RequestFactory().get('th/service/edit/')
     request.user = self.user
     view = UserServiceUpdateView.as_view(template_name=template_name)
     # Run.
     response = view(request, user=request.user, pk=t.id)
     # Check.
     self.assertEqual(response.status_code, 200)
     self.assertEqual(response.template_name[0], template_name)
Пример #3
0
 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(),
     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
Пример #4
0
     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(),
     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"),
 # ****************************************
Пример #5
0
      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
 # ****************************************
Пример #6
0
 ),
 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(
     r"^th/service/create/$",
     UserServiceWizard.as_view([ProviderForm, DummyForm, ConsumerForm, DummyForm, ServicesDescriptionForm]),
     name="create_service",