Projet

Général

Profil

0004-misc-fix-test-failures-with-pytest-s-reuse-db-param-.patch

Lauréline Guérin, 14 octobre 2019 14:50

Télécharger (2,83 ko)

Voir les différences:

Subject: [PATCH 4/4] misc: fix test failures with pytest's --reuse-db param
 (#36608)

 tests/test_atos_genesys.py |  3 ++-
 tests/test_gesbac.py       | 11 +++++++----
 2 files changed, 9 insertions(+), 5 deletions(-)
tests/test_atos_genesys.py
107 107
            'password': 'xyz',
108 108
            'email': 'john.doe@example.com'
109 109
        }))
110
    link = Link.objects.latest('pk')
110 111
    assert response.json['err'] == 0
111
    assert response.json['link_id'] == 1
112
    assert response.json['link_id'] == link.pk
112 113
    assert response.json['new']
113 114
    assert Link.objects.filter(
114 115
        name_id='zob', id_per='789', resource=genesys).count() == 1
tests/test_gesbac.py
77 77
    assert resource.form_set.filter(status='new').count() == 1
78 78
    form = resource.form_set.get(status='new')
79 79
    assert len(form.demand_data) == 2
80
    expected_filename = '%s%s-4200142.csv' % (resource.output_files_prefix,
81
                                              timestamp.strftime('%y%m%d-%H%M%S'))
80
    expected_filename = '%s%s-%s.csv' % (resource.output_files_prefix,
81
                                         timestamp.strftime('%y%m%d-%H%M%S'),
82
                                         form.get_gesbac_id())
82 83
    assert response.json['data']['filename'] == expected_filename
83 84
    assert resource.form_set.filter(status='new').count() == 1
84 85
    with sftpserver.serve_content({'output': {expected_filename: 'content'}}):
......
90 91
    assert resource.form_set.filter(status='new').count() == 1
91 92
    form = resource.form_set.get(status='new')
92 93
    assert len(form.demand_data) == 2
93
    assert response.json['data']['filename'] == '%s%s-4200242.csv' % (resource.output_files_prefix,
94
                                                                      timestamp.strftime('%y%m%d-%H%M%S'))
94
    expected_filename = '%s%s-%s.csv' % (resource.output_files_prefix,
95
                                         timestamp.strftime('%y%m%d-%H%M%S'),
96
                                         form.get_gesbac_id())
97
    assert response.json['data']['filename'] == expected_filename
95 98
    with sftpserver.serve_content({'output': {response.json['data']['filename']: 'content'}}):
96 99
        resource.jobs()
97 100
    assert resource.form_set.filter(status='sent').count() == 2
98
-