Beispiel #1
0
def test_mrsrequestcreateview_get(srf):
    request = srf.get(reverse('mrsrequest:wizard'))
    view = MRSRequestCreateView(request=request)
    response = view.dispatch(request)

    assert response.status_code == 200
    assert view.object.is_allowed(request)

    # This is what the user should post as mrsrequest_uuid
    assert view.mrsrequest_uuid == str(view.object.id)
Beispiel #2
0
admin.site.site_header = 'MRS Admin' + TITLE_SUFFIX
admin.site.site_title = 'MRS Admin' + TITLE_SUFFIX

crudlfap.site.title = 'MRS Admin' + TITLE_SUFFIX
crudlfap.site.urlpath = 'admin'
crudlfap.site.views['home'] = views.Dashboard

handler400 = 'mrs.views.bad_request_view'
handler403 = 'mrs.views.forbidden_view'
handler404 = 'mrs.views.not_found_view'
handler500 = 'mrs.views.internal_server_error_view'

urlpatterns = [
    crudlfap.site.get_urlpattern(),
    path('',
         MRSRequestCreateView.as_view(template_name='index.html'),
         name='index'),
    path('favicon.ico', views.StaticView.as_view(path='img/favicon.ico', )),
    path('demande', MRSRequestCreateView.as_view(), name='demande'),
    # too early for this little one
    # path(
    #     'modifier-demande/<pk>/<token>',
    #     MRSRequestUpdateView.as_view(),
    #     name='demande-update'
    # ),
    path('annuler-demande/<pk>/<token>',
         MRSRequestCancelView.as_view(),
         name='demande-cancel'),
    path('contact', ContactView.as_view(), name='contact'),
    path('mentions-legales', views.LegalView.as_view(), name='legal'),
    path('faq', views.FaqView.as_view(), name='faq'),
Beispiel #3
0
def test_mrsrequestcreateview_post_responds_with_new_and_allowed_uuid(srf):
    m = MRSRequest(id='e29db065-0566-48be-822d-66bd3277d823')
    request = srf.post('/', dict(mrsrequest_uuid=m.id))
    m.allow(request)
    response = MRSRequestCreateView(request=request).dispatch(request)
    assert response.status_code == 200
Beispiel #4
0
def test_mrsrequestcreateview_post_fail_with_existing_allowed_uuid(srf):
    m = MRSRequest.objects.create(id='e29db065-0566-48be-822d-66bd3277d823')
    request = srf.post('/', dict(mrsrequest_uuid=m.id))
    m.allow(request)
    response = MRSRequestCreateView(request=request).dispatch(request)
    assert response.status_code == 400
Beispiel #5
0
def test_mrsrequestcreateview_post_fail_with_unallowed_uuid(srf):
    request = srf.post(
        '/', dict(mrsrequest_uuid='e29db065-0566-48be-822d-66bd3277d823'))
    response = MRSRequestCreateView(request=request).dispatch(request)
    assert response.status_code == 400
Beispiel #6
0
def test_mrsrequestcreateview_post_fail_with_malformated_uuid(srf):
    request = srf.post('/', dict(mrsrequest_uuid='123'))
    response = MRSRequestCreateView(request=request).dispatch(request)
    assert response.status_code == 400
Beispiel #7
0
def test_mrsrequestcreateview_post_fail_without_uuid(srf):
    request = srf.post('/')
    response = MRSRequestCreateView(request=request).dispatch(request)
    assert response.status_code == 400
Beispiel #8
0
 path('', views.IndexView.as_view(), name='index'),
 # TBD : move the following static files to nginx or traefik
 path('favicon.ico', views.StaticView.as_view(path='img/favicon.ico', )),
 path('apple-touch-icon.png',
      views.StaticView.as_view(path='img/apple-touch-icon.png', )),
 path(
     'apple-touch-icon-precomposed.png',
     views.StaticView.as_view(
         path='img/apple-touch-icon-precomposed.png', )),
 path('apple-touch-icon-120x120.png',
      views.StaticView.as_view(path='img/apple-touch-icon-120x120.png', )),
 path(
     'apple-touch-icon-120x120-precomposed.png',
     views.StaticView.as_view(
         path='img/apple-touch-icon-120x120-precomposed.png', )),
 path('demande', MRSRequestCreateView.as_view(), name='demande'),
 # too early for this little one
 # path(
 #     'modifier-demande/<pk>/<token>',
 #     MRSRequestUpdateView.as_view(),
 #     name='demande-update'
 # ),
 path('annuler-demande/<pk>/<token>',
      MRSRequestCancelView.as_view(),
      name='demande-cancel'),
 path('contact', ContactView.as_view(), name='contact'),
 path('mentions-legales', views.LegalView.as_view(), name='legal'),
 path('faq', views.FaqView.as_view(), name='faq'),
 path(
     'manifest.json',
     views.StaticView.as_view(