Projet

Général

Profil

0001-tests-test-api-to-add-agenda-with-only-required-para.patch

Nicolas Roche, 08 octobre 2021 10:43

Télécharger (2 ko)

Voir les différences:

Subject: [PATCH 1/5] tests: test api to add agenda with only required
 parameters (#57670)

 tests/api/test_all.py | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
tests/api/test_all.py
655 655
        'minimal_booking_delay_in_working_days': True,
656 656
    }
657 657
    resp = app.post(api_url, params=params, status=400)
658 658
    assert resp.json['err']
659 659
    assert resp.json['errors'] == {
660 660
        'minimal_booking_delay_in_working_days': ['Option not available on meetings agenda']
661 661
    }
662 662

  
663
    # add an agenda using only required fields
664
    params = {
665
        'label': 'My Agenda',
666
        'slug': 'my-agenda',
667
    }
668
    resp = app.post(api_url, params=params)
669
    assert not resp.json['err']
670
    assert len(resp.json['data']) == 1
671
    agenda = Agenda.objects.get(slug='my-agenda')
672
    assert agenda.kind == 'events'
673

  
663 674
    settings.WORKING_DAY_CALENDAR = 'workalendar.europe.France'
664 675
    edit_group = Group.objects.create(name='Edit')
665 676
    view_group = Group.objects.create(name='View')
666 677

  
667 678
    # add a meetings agenda
668 679
    params = {
669 680
        'label': 'foo Meetings',
670 681
        'slug': 'foo-meetings',
......
694 705
        'anonymize_delay': 30,
695 706
        'edit_role': 'Edit',
696 707
        'view_role': 'View',
697 708
    }
698 709
    resp = app.post(api_url, params=params)
699 710
    assert not resp.json['err']
700 711
    assert len(resp.json['data']) == 1
701 712
    agenda = Agenda.objects.get(slug='foo-events')
713
    assert agenda.min_booking_datetime.date() == datetime.date(2021, 7, 12)
702 714
    assert agenda.edit_role == edit_group
703 715
    assert agenda.view_role == view_group
704
    assert agenda.min_booking_datetime.date() == datetime.date(2021, 7, 12)
705
-