Projet

Général

Profil

0001-tests-remove-useless-studio-fixture.patch

Lauréline Guérin, 15 décembre 2020 09:17

Télécharger (8,21 ko)

Voir les différences:

Subject: [PATCH 1/3] tests: remove useless studio fixture

 tests/admin_pages/test_all.py              |  6 +++---
 tests/admin_pages/test_card.py             | 18 +++++++++---------
 tests/backoffice_pages/test_all.py         |  2 +-
 tests/backoffice_pages/test_carddata.py    | 16 ++++++++--------
 tests/backoffice_pages/test_custom_view.py |  2 +-
 tests/conftest.py                          |  6 ------
 6 files changed, 22 insertions(+), 28 deletions(-)
tests/admin_pages/test_all.py
635 635
    assert 'Theme' not in resp.text
636 636

  
637 637

  
638
def test_settings_export_import(pub, studio):
638
def test_settings_export_import(pub):
639 639
    def wipe():
640 640
        FormDef.wipe()
641 641
        CardDef.wipe()
......
1409 1409
    assert pub.cfg['postgresql']['port'] == 5432
1410 1410

  
1411 1411

  
1412
def test_studio_home(pub, studio):
1412
def test_studio_home(pub):
1413 1413
    create_superuser(pub)
1414 1414
    app = login(get_app(pub))
1415 1415
    resp = app.get('/backoffice/')
......
1434 1434
    assert 'studio' not in resp.text
1435 1435

  
1436 1436

  
1437
def test_studio_workflows(pub, studio):
1437
def test_studio_workflows(pub):
1438 1438
    create_superuser(pub)
1439 1439
    app = login(get_app(pub))
1440 1440
    resp = app.get('/backoffice/workflows/')
tests/admin_pages/test_card.py
43 43
    clean_temporary_pub()
44 44

  
45 45

  
46
def test_cards_list(pub, studio):
46
def test_cards_list(pub):
47 47
    create_superuser(pub)
48 48

  
49 49
    CardDef.wipe()
......
84 84
    assert '<h2>Bar</h2>' in resp.text
85 85

  
86 86

  
87
def test_cards_new(pub, studio):
87
def test_cards_new(pub):
88 88
    CardDef.wipe()
89 89
    create_superuser(pub)
90 90
    app = login(get_app(pub))
......
99 99
    assert CardDef.get(1).disabled is False
100 100

  
101 101

  
102
def test_cards_delete(pub, studio):
102
def test_cards_delete(pub):
103 103
    CardDef.wipe()
104 104
    carddef = CardDef()
105 105
    carddef.name = 'card title'
......
127 127
    carddata.remove_self()  # don't keep leftovers
128 128

  
129 129

  
130
def test_cards_duplicate(pub, studio):
130
def test_cards_duplicate(pub):
131 131
    CardDef.wipe()
132 132
    carddef = CardDef()
133 133
    carddef.name = 'card title'
......
141 141
    assert CardDef.get(2).disabled is False
142 142

  
143 143

  
144
def test_card_workflow_change(pub, studio):
144
def test_card_workflow_change(pub):
145 145
    Workflow.wipe()
146 146
    workflow = Workflow(name='Workflow Two')
147 147
    workflow.add_status('plop')
......
179 179
    resp = resp.form.submit('submit').follow()
180 180

  
181 181

  
182
def test_card_digest_template(pub, studio):
182
def test_card_digest_template(pub):
183 183
    create_superuser(pub)
184 184

  
185 185
    CardDef.wipe()
......
239 239
    assert 'Existing cards will be updated in the background.' not in resp.text
240 240

  
241 241

  
242
def test_card_category(pub, studio):
242
def test_card_category(pub):
243 243
    create_superuser(pub)
244 244

  
245 245
    CardDef.wipe()
......
278 278
    assert '<span class="label">Category</span> <span class="value">Bar</span>' in resp.text
279 279

  
280 280

  
281
def test_card_user_support(pub, studio):
281
def test_card_user_support(pub):
282 282
    create_superuser(pub)
283 283

  
284 284
    CardDef.wipe()
......
299 299
    assert '<span class="label">User support</span> <span class="value">Optional</span>' in resp.text
300 300

  
301 301

  
302
def test_card_custom_view_data_source(pub, studio):
302
def test_card_custom_view_data_source(pub):
303 303
    user = create_superuser(pub)
304 304
    Role.wipe()
305 305
    role = Role(name='foobar')
tests/backoffice_pages/test_all.py
5591 5591
        assert not pq('.wf-links')
5592 5592

  
5593 5593

  
5594
def test_backoffice_create_carddata_from_formdata(pub, studio):
5594
def test_backoffice_create_carddata_from_formdata(pub):
5595 5595
    CardDef.wipe()
5596 5596
    FormDef.wipe()
5597 5597

  
tests/backoffice_pages/test_carddata.py
50 50
    clean_temporary_pub()
51 51

  
52 52

  
53
def test_carddata_management(pub, studio):
53
def test_carddata_management(pub):
54 54
    CardDef.wipe()
55 55
    user = create_user(pub)
56 56
    app = login(get_app(pub))
......
124 124
    assert resp.text.count('<tr') == 2  # header + row of data
125 125

  
126 126

  
127
def test_carddata_management_categories(pub, studio):
127
def test_carddata_management_categories(pub):
128 128
    user = create_user(pub)
129 129

  
130 130
    CardDef.wipe()
......
169 169
    assert '<h3>Bar</h3>' in resp.text
170 170

  
171 171

  
172
def test_carddata_management_user_support(pub, studio):
172
def test_carddata_management_user_support(pub):
173 173
    user = create_user(pub)
174 174

  
175 175
    CardDef.wipe()
......
198 198
    assert 'user_id' in resp.form.fields
199 199

  
200 200

  
201
def test_studio_card_item_link(pub, studio):
201
def test_studio_card_item_link(pub):
202 202
    user = create_user(pub)
203 203
    CardDef.wipe()
204 204
    carddef = CardDef()
......
261 261
        resp.click('card plop')
262 262

  
263 263

  
264
def test_backoffice_cards_import_data_from_csv(pub, studio):
264
def test_backoffice_cards_import_data_from_csv(pub):
265 265
    user = create_user(pub)
266 266

  
267 267
    data_source = {
......
377 377
    assert card2.data['5'].tm_mday == 3
378 378

  
379 379

  
380
def test_backoffice_cards_import_data_csv_user_support(pub, studio):
380
def test_backoffice_cards_import_data_csv_user_support(pub):
381 381
    user = create_user(pub)
382 382
    user.name_identifiers = [str(uuid.uuid4())]
383 383
    user.store()
......
478 478
    assert '(line numbers 4, 5, 7, 8, 9 and more)' in resp.text
479 479

  
480 480

  
481
def test_backoffice_cards_wscall_failure_display(http_requests, pub, studio):
481
def test_backoffice_cards_wscall_failure_display(http_requests, pub):
482 482
    if not pub.is_using_postgresql():
483 483
        pytest.skip('this requires SQL')
484 484
        return
......
543 543
    assert pub.loggederror_class.select()[0].get_formdata().data == {'1': 'plop'}
544 544

  
545 545

  
546
def test_block_card_item_link(pub, studio, blocks_feature):
546
def test_block_card_item_link(pub, blocks_feature):
547 547
    user = create_user(pub)
548 548
    CardDef.wipe()
549 549
    carddef = CardDef()
tests/backoffice_pages/test_custom_view.py
459 459
    assert resp.location == 'http://example.net/backoffice/management/form-title/1/?plop'
460 460

  
461 461

  
462
def test_carddata_custom_view(pub, studio):
462
def test_carddata_custom_view(pub):
463 463
    user = create_user(pub)
464 464

  
465 465
    CardDef.wipe()
tests/conftest.py
43 43
    return site_options(request, pub, 'options', 'welco_url', 'http://welco.example.net')
44 44

  
45 45

  
46
@pytest.fixture
47
def studio(request, pub):
48
    # studio enabled is now the default
49
    return
50

  
51

  
52 46
@pytest.fixture
53 47
def blocks_feature(request, pub):
54 48
    return site_options(request, pub, 'options', 'fields-blocks', 'true')
55
-