Projet

Général

Profil

0001-toulouse_maelis-add-civility-to-RL-required-properti.patch

Nicolas Roche, 28 juillet 2022 15:56

Télécharger (7,12 ko)

Voir les différences:

Subject: [PATCH] toulouse_maelis: add civility to RL required properties
 (#67787)

 passerelle/contrib/toulouse_maelis/schemas.py  | 2 +-
 tests/data/toulouse_maelis/Q_create_family.xml | 1 +
 tests/data/toulouse_maelis/Q_update_family.xml | 1 +
 tests/test_toulouse_maelis.py                  | 6 ++++++
 4 files changed, 9 insertions(+), 1 deletion(-)
passerelle/contrib/toulouse_maelis/schemas.py
223 223
    ],
224 224
}
225 225

  
226 226
RLINFO_SCHEMA = {
227 227
    '$schema': 'http://json-schema.org/draft-04/schema#',
228 228
    'title': 'RLInfo',
229 229
    'description': "Informations sur le responsable légal",
230 230
    'type': 'object',
231
    'required': ['firstname', 'lastname', 'quality', 'dateBirth', 'adresse'],
231
    'required': ['firstname', 'lastname', 'civility', 'quality', 'dateBirth', 'adresse'],
232 232
    'properties': {
233 233
        'civility': {
234 234
            'description': 'civilité (depuis référenciel)',
235 235
            'oneOf': [{'type': 'null'}, {'type': 'string'}],
236 236
        },
237 237
        'quality': {
238 238
            'description': 'Qualité',
239 239
            'type': 'string',
tests/data/toulouse_maelis/Q_create_family.xml
11 11
  <soap-env:Body>
12 12
    <ns0:createFamily xmlns:ns0="family.ws.maelis.sigec.com">
13 13
      <categorie>ACCEUI</categorie>
14 14
      <situation>C</situation>
15 15
      <rl1>
16 16
        <lastname>Doe</lastname>
17 17
        <firstname>Jhon</firstname>
18 18
        <quality>AU</quality>
19
        <civility>M.</civility>
19 20
        <dateBirth>1938-07-26</dateBirth>
20 21
        <adresse>
21 22
          <street1>Chateau</street1>
22 23
          <town>Paris</town>
23 24
          <zipcode>75014</zipcode>
24 25
        </adresse>
25 26
      </rl1>
26 27
    </ns0:createFamily>
tests/data/toulouse_maelis/Q_update_family.xml
12 12
    <ns0:updateFamily xmlns:ns0="family.ws.maelis.sigec.com">
13 13
      <dossierNumber>1312</dossierNumber>
14 14
      <categorie>BI</categorie>
15 15
      <situation>C</situation>
16 16
      <rl1>
17 17
        <lastname>Doe</lastname>
18 18
        <firstname>Jhon</firstname>
19 19
        <quality>AU</quality>
20
        <civility>M.</civility>
20 21
        <dateBirth>1938-07-26</dateBirth>
21 22
        <adresse>
22 23
          <street1>Chateau</street1>
23 24
          <town>Paris</town>
24 25
          <zipcode>75014</zipcode>
25 26
        </adresse>
26 27
      </rl1>
27 28
    </ns0:updateFamily>
tests/test_toulouse_maelis.py
690 690
@mock.patch('passerelle.utils.Request.post')
691 691
def test_create_family(mocked_post, mocked_get, con, app):
692 692
    mocked_get.return_value = FAMILY_SERVICE_WSDL
693 693
    mocked_post.return_value = CREATE_FAMILY
694 694
    url = get_endpoint('create-family')
695 695
    params = {
696 696
        'categorie': 'ACCEUI',
697 697
        'situation': 'C',
698
        'rl1/civility': 'M.',
698 699
        'rl1/firstname': 'Jhon',
699 700
        'rl1/lastname': 'Doe',
700 701
        'rl1/quality': 'AU',
701 702
        'rl1/dateBirth': '1938-07-26',
702 703
        'rl1/adresse/street1': 'Chateau',
703 704
        'rl1/adresse/town': 'Paris',
704 705
        'rl1/adresse/zipcode': '75014',
705 706
    }
......
716 717
    assert Link.objects.get(resource=con, family_id='196545', name_id='local')
717 718

  
718 719

  
719 720
def test_create_family_already_linked_error(con, app):
720 721
    url = get_endpoint('create-family')
721 722
    params = {
722 723
        'categorie': 'ACCEUI',
723 724
        'situation': 'C',
725
        'rl1/civility': 'M.',
724 726
        'rl1/firstname': 'Jhon',
725 727
        'rl1/lastname': 'Doe',
726 728
        'rl1/quality': 'AU',
727 729
        'rl1/dateBirth': '1938-07-26',
728 730
        'rl1/adresse/street1': 'Chateau',
729 731
        'rl1/adresse/town': 'Paris',
730 732
        'rl1/adresse/zipcode': '75014',
731 733
    }
......
740 742
@mock.patch('passerelle.utils.Request.post')
741 743
def test_create_family_maelis_error(mocked_post, mocked_get, con, app):
742 744
    mocked_get.return_value = FAMILY_SERVICE_WSDL
743 745
    mocked_post.return_value = CREATE_FAMILY_ERR
744 746
    url = get_endpoint('create-family')
745 747
    params = {
746 748
        'categorie': 'ACCEUI',
747 749
        'situation': 'C',
750
        'rl1/civility': 'M.',
748 751
        'rl1/firstname': 'Jhon',
749 752
        'rl1/lastname': 'Doe',
750 753
        'rl1/quality': 'AU',
751 754
        'rl1/dateBirth': '1938-07-26',
752 755
        'rl1/adresse/street1': 'Chateau',
753 756
        'rl1/adresse/town': 'Paris',
754 757
        'rl1/adresse/zipcode': '75014',
755 758
    }
......
763 766
@mock.patch('passerelle.utils.Request.post')
764 767
def test_update_family(mocked_post, mocked_get, con, app):
765 768
    mocked_get.return_value = FAMILY_SERVICE_WSDL
766 769
    mocked_post.return_value = UPDATE_FAMILY
767 770
    url = get_endpoint('update-family')
768 771
    params = {
769 772
        'categorie': 'BI',
770 773
        'situation': 'C',
774
        'rl1/civility': 'M.',
771 775
        'rl1/firstname': 'Jhon',
772 776
        'rl1/lastname': 'Doe',
773 777
        'rl1/quality': 'AU',
774 778
        'rl1/dateBirth': '1938-07-26',
775 779
        'rl1/adresse/street1': 'Chateau',
776 780
        'rl1/adresse/town': 'Paris',
777 781
        'rl1/adresse/zipcode': '75014',
778 782
    }
......
783 787
    assert resp.json['err'] == 0
784 788

  
785 789

  
786 790
def test_update_family_already_not_linked_error(con, app):
787 791
    url = get_endpoint('update-family')
788 792
    params = {
789 793
        'categorie': 'BI',
790 794
        'situation': 'C',
795
        'rl1/civility': 'M.',
791 796
        'rl1/firstname': 'Jhon',
792 797
        'rl1/lastname': 'Doe',
793 798
        'rl1/quality': 'AU',
794 799
        'rl1/dateBirth': '1938-07-26',
795 800
        'rl1/adresse/street1': 'Chateau',
796 801
        'rl1/adresse/town': 'Paris',
797 802
        'rl1/adresse/zipcode': '75014',
798 803
    }
......
834 839
def test_update_family_soap_error(mocked_post, mocked_get, con, app):
835 840
    mocked_get.return_value = FAMILY_SERVICE_WSDL
836 841
    mocked_post.return_value = UPDATE_FAMILY_500
837 842
    url = get_endpoint('update-family')
838 843
    params = {
839 844
        'nbChild': '100',
840 845
        'categorie': 'BI',
841 846
        'situation': 'C',
847
        'rl1/civility': 'M.',
842 848
        'rl1/firstname': 'Jhon',
843 849
        'rl1/lastname': 'Doe',
844 850
        'rl1/quality': 'AU',
845 851
        'rl1/dateBirth': '1938-07-26',
846 852
        'rl1/adresse/street1': 'Chateau',
847 853
        'rl1/adresse/town': 'Paris',
848 854
        'rl1/adresse/zipcode': '75014',
849 855
    }
850
-