Projet

Général

Profil

0007-pricing-billing-date-views-67675.patch

Lauréline Guérin, 29 juillet 2022 22:03

Télécharger (23 ko)

Voir les différences:

Subject: [PATCH 07/14] pricing: billing date views (#67675)

 lingo/pricing/forms.py                        |  39 +++-
 ...ager_agenda_pricing_billing_date_form.html |  30 +++
 .../manager_agenda_pricing_detail.html        |  33 ++-
 lingo/pricing/urls.py                         |  15 ++
 lingo/pricing/views.py                        |  97 +++++++-
 tests/pricing/manager/test_agenda_pricing.py  | 218 +++++++++++++++++-
 6 files changed, 427 insertions(+), 5 deletions(-)
 create mode 100644 lingo/pricing/templates/lingo/pricing/manager_agenda_pricing_billing_date_form.html
lingo/pricing/forms.py
24 24

  
25 25
from lingo.agendas.chrono import ChronoError, get_event, get_subscriptions
26 26
from lingo.agendas.models import Agenda, CheckType
27
from lingo.pricing.models import AgendaPricing, Criteria, CriteriaCategory, PricingError
27
from lingo.pricing.models import AgendaPricing, BillingDate, Criteria, CriteriaCategory, PricingError
28 28

  
29 29

  
30 30
class ExportForm(forms.Form):
......
216 216
                            None,
217 217
                            _('Agenda "%s" has already a pricing overlapping this period.') % agenda.label,
218 218
                        )
219
            if (
220
                old_flat_fee_schedule != new_flat_fee_schedule
221
                and new_flat_fee_schedule is False
222
                and self.instance.billingdates.exists()
223
            ):
224
                self.add_error(
225
                    'flat_fee_schedule',
226
                    _('Some billing dates are are defined for this pricing; please delete them first.'),
227
                )
228
            if (
229
                old_flat_fee_schedule == new_flat_fee_schedule
230
                and new_flat_fee_schedule is True
231
                and (old_date_start != new_date_start or old_date_end != new_date_end)
232
            ):
233
                if (
234
                    self.instance.billingdates.filter(date_start__lt=new_date_start).exists()
235
                    or self.instance.billingdates.filter(date_start__gte=new_date_end).exists()
236
                ):
237
                    self.add_error(None, _('Some billing dates are outside the pricing period.'))
219 238

  
220 239
        return cleaned_data
221 240

  
......
241 260
        return agenda
242 261

  
243 262

  
263
class AgendaPricingBillingDateForm(forms.ModelForm):
264
    class Meta:
265
        model = BillingDate
266
        fields = ['date_start', 'label']
267
        widgets = {
268
            'date_start': forms.DateInput(attrs={'type': 'date'}, format='%Y-%m-%d'),
269
        }
270

  
271
    def clean_date_start(self):
272
        date_start = self.cleaned_data['date_start']
273
        if (
274
            date_start < self.instance.agenda_pricing.date_start
275
            or date_start >= self.instance.agenda_pricing.date_end
276
        ):
277
            raise forms.ValidationError(_('The billing start date must be within the period of the pricing.'))
278
        return date_start
279

  
280

  
244 281
class PricingMatrixForm(forms.Form):
245 282
    def __init__(self, *args, **kwargs):
246 283
        matrix = kwargs.pop('matrix')
lingo/pricing/templates/lingo/pricing/manager_agenda_pricing_billing_date_form.html
1
{% extends "lingo/pricing/manager_agenda_pricing_detail.html" %}
2
{% load i18n %}
3

  
4
{% block breadcrumb %}
5
{{ block.super }}
6
{% if form.instance.pk %}
7
<a href="{% url 'lingo-manager-agenda-pricing-billing-date-edit' object.pk form.instance.agenda_pricing.pk %}">{{ form.instance }}</a>
8
{% else %}
9
<a href="{% url 'lingo-manager-agenda-pricing-billing-date-add' object.pk %}">{% trans "New billing date" %}</a>
10
{% endif %}
11
{% endblock %}
12

  
13
{% block appbar %}
14
{% if form.instance.pk %}
15
<h2>{{ form.instance.agenda_pricing }} - {% trans "Edit billing date" %}</h2>
16
{% else %}
17
<h2>{{ form.instance.agenda_pricing }} - {% trans "New billing date" %}</h2>
18
{% endif %}
19
{% endblock %}
20

  
21
{% block content %}
22
<form method="post" enctype="multipart/form-data">
23
  {% csrf_token %}
24
  {{ form.as_p }}
25
  <div class="buttons">
26
    <button class="submit-button">{% trans "Save" %}</button>
27
    <a class="cancel" href="{% url 'lingo-manager-agenda-pricing-detail' object.pk %}">{% trans 'Cancel' %}</a>
28
  </div>
29
</form>
30
{% endblock %}
lingo/pricing/templates/lingo/pricing/manager_agenda_pricing_detail.html
31 31
    <button aria-controls="panel-agendas" aria-selected="false" id="tab-agendas" role="tab" tabindex="0">{% trans "Agendas" %}</button>
32 32
    {% endif %}
33 33
    <button aria-controls="panel-debug" aria-selected="false" id="tab-debug" role="tab" tabindex="0">{% trans "Test tool" %}</button>
34
    {% if object.flat_fee_schedule %}
35
    <button aria-controls="panel-billing-dates" aria-selected="false" id="tab-billing-dates" role="tab" tabindex="0">{% trans "Billing dates" %}</button>
36
    {% endif %}
34 37
    {% for matrix in iter_matrix %}
35 38
    <button aria-controls="panel-matrix-{{ matrix.criteria.slug }}" aria-selected="false" id="tab-matrix-{{ matrix.criteria.slug }}" role="tab" tabindex="-1">{% trans "Pricings" context 'amount' %}{% if matrix.criteria %} - {{ matrix.criteria.label }}{% endif %}</button>
36 39
    {% empty %}
......
119 122
            <pre>{{ pricing_data|pprint }}</pre>
120 123
        </div>
121 124
      </div>
122
  {% endwith %}
123
  {% endif %}
125
      {% endwith %}
126
      {% endif %}
124 127
    </div>
125 128

  
129
    {% if object.flat_fee_schedule %}
130
    <div aria-labelledby="tab-billing-dates" hidden id="panel-billing-dates" role="tabpanel" tabindex="0">
131
      {% if billing_dates %}
132
      <ul class="objects-list single-links">
133
        {% for billing_date in billing_dates %}
134
        <li>
135
          <a rel="popup" href="{% url 'lingo-manager-agenda-pricing-billing-date-edit' object.pk billing_date.pk %}">
136
            {{ billing_date.date_start|date:'d/m/Y' }} ({{ billing_date.label }})
137
          </a>
138
          <a class="delete" rel="popup" href="{% url 'lingo-manager-agenda-pricing-billing-date-delete' object.pk billing_date.pk %}">{% trans "remove"%}</a>
139
        </li>
140
        {% endfor %}
141
      </ul>
142
      {% else %}
143
      <div class="big-msg-info">
144
        {% blocktrans with date_start=object.date_start|date:'d/m/Y' %}
145
        No billing dates. The start date of the pricing ({{ date_start }}) is used as the only available billing date.
146
        {% endblocktrans %}
147
      </div>
148
      {% endif %}
149
      <div class="panel--buttons">
150
        <a class="pk-button" rel="popup" href="{% url 'lingo-manager-agenda-pricing-billing-date-add' object.pk %}">{% trans "New billing date" %}</a>
151
      </div>
152
    </div>
153
    {% endif %}
154

  
126 155
    {% for matrix in iter_matrix %}
127 156
    <div aria-labelledby="tab-matrix-{{ matrix.criteria.slug }}" hidden="" id="panel-matrix-{{ matrix.criteria.slug }}" role="tabpanel" tabindex="0">
128 157
      <table class="main pricing-matrix-{{ matrix.criteria.slug }}">
lingo/pricing/urls.py
198 198
        views.agenda_pricing_agenda_delete,
199 199
        name='lingo-manager-agenda-pricing-agenda-delete',
200 200
    ),
201
    url(
202
        r'^agenda-pricing/(?P<pk>\d+)/billing-date/add/$',
203
        views.agenda_pricing_billing_date_add,
204
        name='lingo-manager-agenda-pricing-billing-date-add',
205
    ),
206
    url(
207
        r'^agenda-pricing/(?P<pk>\d+)/billing-date/(?P<billing_date_pk>\d+)/$',
208
        views.agenda_pricing_billing_date_edit,
209
        name='lingo-manager-agenda-pricing-billing-date-edit',
210
    ),
211
    url(
212
        r'^agenda-pricing/(?P<pk>\d+)/billing-date/(?P<billing_date_pk>\d+)/delete/$',
213
        views.agenda_pricing_billing_date_delete,
214
        name='lingo-manager-agenda-pricing-billing-date-delete',
215
    ),
201 216
    url(
202 217
        r'^agenda-pricing/(?P<pk>\d+)/matrix/edit/$',
203 218
        views.agenda_pricing_matrix_edit,
lingo/pricing/views.py
45 45
from lingo.agendas.views import AgendaMixin
46 46
from lingo.pricing.forms import (
47 47
    AgendaPricingAgendaAddForm,
48
    AgendaPricingBillingDateForm,
48 49
    AgendaPricingForm,
49 50
    CheckTypeForm,
50 51
    CriteriaForm,
......
60 61
    PricingTestToolForm,
61 62
    PricingVariableFormSet,
62 63
)
63
from lingo.pricing.models import AgendaPricing, Criteria, CriteriaCategory, Pricing, PricingCriteriaCategory
64
from lingo.pricing.models import (
65
    AgendaPricing,
66
    BillingDate,
67
    Criteria,
68
    CriteriaCategory,
69
    Pricing,
70
    PricingCriteriaCategory,
71
)
64 72
from lingo.pricing.utils import export_site, import_site
65 73
from lingo.utils.misc import AgendaImportError
66 74

  
......
780 788
        if self.request.GET:
781 789
            form.is_valid()
782 790
        kwargs['test_tool_form'] = form
791
        kwargs['billing_dates'] = self.object.billingdates.order_by('date_start')
783 792
        return super().get_context_data(**kwargs)
784 793

  
785 794

  
......
892 901
agenda_pricing_agenda_delete = AgendaPricingAgendaDeleteView.as_view()
893 902

  
894 903

  
904
class AgendaPricingBillingDateAddView(FormView):
905
    template_name = 'lingo/pricing/manager_agenda_pricing_billing_date_form.html'
906
    model = AgendaPricing
907
    form_class = AgendaPricingBillingDateForm
908

  
909
    def dispatch(self, request, *args, **kwargs):
910
        self.object = get_object_or_404(AgendaPricing, pk=kwargs['pk'], flat_fee_schedule=True)
911
        return super().dispatch(request, *args, **kwargs)
912

  
913
    def get_form_kwargs(self):
914
        kwargs = super().get_form_kwargs()
915
        kwargs['instance'] = BillingDate(agenda_pricing=self.object)
916
        return kwargs
917

  
918
    def get_context_data(self, **kwargs):
919
        kwargs['object'] = self.object
920
        return super().get_context_data(**kwargs)
921

  
922
    def form_valid(self, form):
923
        form.save()
924
        return super().form_valid(form)
925

  
926
    def get_success_url(self):
927
        return '%s#open:billing-dates' % reverse('lingo-manager-agenda-pricing-detail', args=[self.object.pk])
928

  
929

  
930
agenda_pricing_billing_date_add = AgendaPricingBillingDateAddView.as_view()
931

  
932

  
933
class AgendaPricingBillingDateEditView(FormView):
934
    template_name = 'lingo/pricing/manager_agenda_pricing_billing_date_form.html'
935
    model = AgendaPricing
936
    form_class = AgendaPricingBillingDateForm
937

  
938
    def dispatch(self, request, *args, **kwargs):
939
        self.agenda_pricing = get_object_or_404(AgendaPricing, pk=kwargs['pk'], flat_fee_schedule=True)
940
        self.object = get_object_or_404(self.agenda_pricing.billingdates, pk=kwargs['billing_date_pk'])
941
        return super().dispatch(request, *args, **kwargs)
942

  
943
    def get_form_kwargs(self):
944
        kwargs = super().get_form_kwargs()
945
        kwargs['instance'] = self.object
946
        return kwargs
947

  
948
    def get_context_data(self, **kwargs):
949
        kwargs['object'] = self.agenda_pricing
950
        return super().get_context_data(**kwargs)
951

  
952
    def form_valid(self, form):
953
        form.save()
954
        return super().form_valid(form)
955

  
956
    def get_success_url(self):
957
        return '%s#open:billing-dates' % reverse(
958
            'lingo-manager-agenda-pricing-detail', args=[self.agenda_pricing.pk]
959
        )
960

  
961

  
962
agenda_pricing_billing_date_edit = AgendaPricingBillingDateEditView.as_view()
963

  
964

  
965
class AgendaPricingBillingDateDeleteView(DeleteView):
966
    template_name = 'lingo/manager_confirm_delete.html'
967
    model = BillingDate
968
    pk_url_kwarg = 'billing_date_pk'
969

  
970
    def dispatch(self, request, *args, **kwargs):
971
        self.agenda_pricing = get_object_or_404(AgendaPricing, pk=kwargs['pk'], subscription_required=True)
972
        return super().dispatch(request, *args, **kwargs)
973

  
974
    def get_queryset(self):
975
        return self.agenda_pricing.billingdates.all()
976

  
977
    def delete(self, request, *args, **kwargs):
978
        self.get_object().delete()
979
        return HttpResponseRedirect(self.get_success_url())
980

  
981
    def get_success_url(self):
982
        return '%s#open:billing-dates' % reverse(
983
            'lingo-manager-agenda-pricing-detail', args=[self.agenda_pricing.pk]
984
        )
985

  
986

  
987
agenda_pricing_billing_date_delete = AgendaPricingBillingDateDeleteView.as_view()
988

  
989

  
895 990
class AgendaPricingMatrixEdit(FormView):
896 991
    template_name = 'lingo/pricing/manager_agenda_pricing_matrix_form.html'
897 992

  
tests/pricing/manager/test_agenda_pricing.py
7 7

  
8 8
from lingo.agendas.chrono import ChronoError
9 9
from lingo.agendas.models import Agenda, CheckType, CheckTypeGroup
10
from lingo.pricing.models import AgendaPricing, Criteria, CriteriaCategory, Pricing, PricingError
10
from lingo.pricing.models import AgendaPricing, BillingDate, Criteria, CriteriaCategory, Pricing, PricingError
11 11
from tests.utils import login
12 12

  
13 13
pytestmark = pytest.mark.django_db
......
124 124
    resp = resp.form.submit()
125 125
    assert resp.location.endswith('/manage/pricing/agenda-pricing/%s/' % agenda_pricing.pk)
126 126

  
127
    agenda_pricing.flat_fee_schedule = True
128
    agenda_pricing.save()
129
    agenda_pricing.billingdates.create(
130
        date_start=datetime.date(year=2021, month=9, day=1),
131
        label='Foo',
132
    )
133
    resp = app.get('/manage/pricing/agenda-pricing/%s/edit/' % agenda_pricing.pk)
134
    resp.form['flat_fee_schedule'] = False
135
    resp = resp.form.submit()
136
    assert resp.context['form'].errors['flat_fee_schedule'] == [
137
        'Some billing dates are are defined for this pricing; please delete them first.'
138
    ]
139

  
127 140

  
128 141
def test_edit_agenda_pricing_overlapping_flat_fee_schedule(app, admin_user):
129 142
    agenda1 = Agenda.objects.create(label='Foo bar 1')
......
263 276
    resp.form.submit().follow()
264 277

  
265 278

  
279
def test_edit_agenda_pricing_billing_date_start(app, admin_user):
280
    pricing = Pricing.objects.create(label='Model')
281
    agenda_pricing = AgendaPricing.objects.create(
282
        label='Foo Bar',
283
        pricing=pricing,
284
        date_start=datetime.date(year=2021, month=9, day=1),
285
        date_end=datetime.date(year=2022, month=9, day=1),
286
        flat_fee_schedule=True,
287
    )
288
    agenda_pricing.billingdates.create(
289
        date_start=datetime.date(year=2021, month=9, day=1),
290
        label='Foo',
291
    )
292

  
293
    app = login(app)
294
    resp = app.get('/manage/pricing/agenda-pricing/%s/edit/' % agenda_pricing.pk)
295
    # ok, date_start has not changed
296
    resp.form.submit().follow()
297

  
298
    resp = app.get('/manage/pricing/agenda-pricing/%s/edit/' % agenda_pricing.pk)
299
    # ok, billing date inside period
300
    resp.form['date_start'] = '2021-08-31'
301
    resp.form.submit().follow()
302

  
303
    resp = app.get('/manage/pricing/agenda-pricing/%s/edit/' % agenda_pricing.pk)
304
    resp.form['date_start'] = '2021-09-02'
305
    resp = resp.form.submit()
306
    assert resp.context['form'].non_field_errors() == ['Some billing dates are outside the pricing period.']
307

  
308
    # but don't check billing dates if not flat_fee_schedule
309
    agenda_pricing.flat_fee_schedule = False
310
    agenda_pricing.save()
311
    # ok
312
    resp = app.get('/manage/pricing/agenda-pricing/%s/edit/' % agenda_pricing.pk)
313
    resp.form.submit().follow()
314

  
315

  
316
def test_edit_agenda_pricing_billing_date_end(app, admin_user):
317
    pricing = Pricing.objects.create(label='Model')
318
    agenda_pricing = AgendaPricing.objects.create(
319
        label='Foo Bar',
320
        pricing=pricing,
321
        date_start=datetime.date(year=2021, month=9, day=1),
322
        date_end=datetime.date(year=2022, month=9, day=1),
323
        flat_fee_schedule=True,
324
    )
325
    agenda_pricing.billingdates.create(
326
        date_start=datetime.date(year=2022, month=9, day=1),
327
        label='Foo',
328
    )
329

  
330
    app = login(app)
331
    resp = app.get('/manage/pricing/agenda-pricing/%s/edit/' % agenda_pricing.pk)
332
    # ok, date_end has not changed
333
    resp.form.submit().follow()
334

  
335
    resp = app.get('/manage/pricing/agenda-pricing/%s/edit/' % agenda_pricing.pk)
336
    # ok, billing date inside period
337
    resp.form['date_end'] = '2022-09-02'
338
    resp.form.submit().follow()
339

  
340
    resp = app.get('/manage/pricing/agenda-pricing/%s/edit/' % agenda_pricing.pk)
341
    resp.form['date_end'] = '2022-09-01'
342
    resp = resp.form.submit()
343
    assert resp.context['form'].non_field_errors() == ['Some billing dates are outside the pricing period.']
344

  
345
    # but don't check billing dates if not flat_fee_schedule
346
    agenda_pricing.flat_fee_schedule = False
347
    agenda_pricing.save()
348
    # ok
349
    resp = app.get('/manage/pricing/agenda-pricing/%s/edit/' % agenda_pricing.pk)
350
    resp.form.submit().follow()
351

  
352

  
266 353
def test_detail_agenda_pricing(app, admin_user):
267 354
    pricing = Pricing.objects.create(label='Model')
268 355
    agenda_pricing = AgendaPricing.objects.create(
......
402 489
    )
403 490

  
404 491

  
492
def test_agenda_pricing_add_billing_date(app, admin_user):
493
    pricing = Pricing.objects.create(label='Model')
494
    agenda_pricing = AgendaPricing.objects.create(
495
        pricing=pricing,
496
        date_start=datetime.date(year=2021, month=9, day=1),
497
        date_end=datetime.date(year=2022, month=9, day=1),
498
        flat_fee_schedule=True,
499
    )
500

  
501
    app = login(app)
502
    resp = app.get('/manage/pricing/agenda-pricing/%s/' % agenda_pricing.pk)
503
    resp = resp.click(href='/manage/pricing/agenda-pricing/%s/billing-date/add/' % agenda_pricing.pk)
504
    resp.form['date_start'] = '2021-08-31'
505
    resp.form['label'] = 'Foo'
506
    resp = resp.form.submit()
507
    assert resp.context['form'].errors['date_start'] == [
508
        'The billing start date must be within the period of the pricing.'
509
    ]
510
    resp.form['date_start'] = '2022-09-01'
511
    resp = resp.form.submit()
512
    assert resp.context['form'].errors['date_start'] == [
513
        'The billing start date must be within the period of the pricing.'
514
    ]
515
    resp.form['date_start'] = '2022-08-31'
516
    resp = resp.form.submit()
517
    assert resp.location.endswith('/manage/pricing/agenda-pricing/%s/#open:billing-dates' % agenda_pricing.pk)
518

  
519
    assert agenda_pricing.billingdates.count() == 1
520
    billing_date = BillingDate.objects.latest('pk')
521
    assert billing_date.date_start == datetime.date(2022, 8, 31)
522
    assert billing_date.label == 'Foo'
523

  
524
    agenda_pricing.flat_fee_schedule = False
525
    agenda_pricing.save()
526
    app.get('/manage/pricing/agenda-pricing/%s/billing-date/add/' % agenda_pricing.pk, status=404)
527

  
528

  
529
def test_agenda_pricing_edit_billing_date(app, admin_user):
530
    pricing = Pricing.objects.create(label='Model')
531
    agenda_pricing = AgendaPricing.objects.create(
532
        pricing=pricing,
533
        date_start=datetime.date(year=2021, month=9, day=1),
534
        date_end=datetime.date(year=2022, month=9, day=1),
535
        flat_fee_schedule=True,
536
    )
537
    billing_date = agenda_pricing.billingdates.create(
538
        date_start=datetime.date(year=2021, month=8, day=31),
539
        label='Foo',
540
    )
541

  
542
    app = login(app)
543
    resp = app.get('/manage/pricing/agenda-pricing/%s/' % agenda_pricing.pk)
544
    resp = resp.click(
545
        href=r'/manage/pricing/agenda-pricing/%s/billing-date/%s/$' % (agenda_pricing.pk, billing_date.pk)
546
    )
547
    resp.form['label'] = 'Bar'
548
    resp = resp.form.submit()
549
    assert resp.context['form'].errors['date_start'] == [
550
        'The billing start date must be within the period of the pricing.'
551
    ]
552
    resp.form['date_start'] = '2022-09-01'
553
    resp = resp.form.submit()
554
    assert resp.context['form'].errors['date_start'] == [
555
        'The billing start date must be within the period of the pricing.'
556
    ]
557
    resp.form['date_start'] = '2022-08-31'
558
    resp = resp.form.submit()
559
    assert resp.location.endswith('/manage/pricing/agenda-pricing/%s/#open:billing-dates' % agenda_pricing.pk)
560

  
561
    assert agenda_pricing.billingdates.count() == 1
562
    billing_date.refresh_from_db()
563
    assert billing_date.date_start == datetime.date(2022, 8, 31)
564
    assert billing_date.label == 'Bar'
565

  
566
    agenda_pricing.flat_fee_schedule = False
567
    agenda_pricing.save()
568
    app.get(
569
        '/manage/pricing/agenda-pricing/%s/billing-date/%s/' % (agenda_pricing.pk, billing_date.pk),
570
        status=404,
571
    )
572

  
573

  
574
def test_agenda_pricing_delete_billing_date(app, admin_user):
575
    pricing = Pricing.objects.create(label='Model')
576
    agenda_pricing = AgendaPricing.objects.create(
577
        pricing=pricing,
578
        date_start=datetime.date(year=2021, month=9, day=1),
579
        date_end=datetime.date(year=2022, month=9, day=1),
580
        flat_fee_schedule=True,
581
    )
582
    billing_date1 = agenda_pricing.billingdates.create(
583
        date_start=datetime.date(year=2021, month=9, day=1),
584
        label='Foo',
585
    )
586
    billing_date2 = agenda_pricing.billingdates.create(
587
        date_start=datetime.date(year=2021, month=9, day=1),
588
        label='Bar',
589
    )
590

  
591
    app = login(app)
592
    resp = app.get('/manage/pricing/agenda-pricing/%s/' % agenda_pricing.pk)
593
    resp = resp.click(
594
        href='/manage/pricing/agenda-pricing/%s/billing-date/%s/delete'
595
        % (agenda_pricing.pk, billing_date1.pk)
596
    )
597
    resp = resp.form.submit()
598
    assert resp.location.endswith('/manage/pricing/agenda-pricing/%s/#open:billing-dates' % agenda_pricing.pk)
599

  
600
    assert agenda_pricing.billingdates.count() == 1
601

  
602
    agenda_pricing.flat_fee_schedule = False
603
    agenda_pricing.save()
604
    app.get(
605
        '/manage/pricing/agenda-pricing/%s/billing-date/%s/' % (agenda_pricing.pk, billing_date2.pk),
606
        status=404,
607
    )
608

  
609
    agenda_pricing2 = AgendaPricing.objects.create(
610
        pricing=pricing,
611
        date_start=datetime.date(year=2021, month=9, day=1),
612
        date_end=datetime.date(year=2022, month=9, day=1),
613
    )
614
    app.get(
615
        '/manage/pricing/agenda-pricing/%s/billing-date/%s/' % (agenda_pricing2.pk, billing_date2.pk),
616
        status=404,
617
    )
618
    app.get('/manage/pricing/agenda-pricing/%s/billing-date/%s/' % (0, billing_date2.pk), status=404)
619

  
620

  
405 621
def test_detail_agenda_pricing_3_categories(app, admin_user):
406 622
    category1 = CriteriaCategory.objects.create(label='Cat 1')
407 623
    Criteria.objects.create(label='Crit 1-1', slug='crit-1-1', category=category1, order=1)
408
-