Projet

Général

Profil

« Précédent | Suivant » 

Révision 80784d04

Ajouté par Frédéric Péters il y a plus de 5 ans

do not expose legacy features (#28512)

Voir les différences:

tests/test_admin_pages.py
65 65
def teardown_module(module):
66 66
    shutil.rmtree(pub.APP_DIR)
67 67

  
68
@pytest.fixture
69
def empty_siteoptions():
70
    open(os.path.join(pub.app_dir, 'site-options.cfg'), 'w').close()
71

  
68 72
def test_with_superuser():
69 73
    create_superuser()
70 74
    app = login(get_app(pub))
......
85 89
    del pub.cfg['admin-permissions']
86 90
    pub.write_cfg()
87 91

  
88
def test_aq_permissions_panel():
92
def test_aq_permissions_panel(empty_siteoptions):
89 93
    create_superuser()
90 94
    app = login(get_app(pub))
95
    resp = app.get('/backoffice/settings/')
96
    assert not 'aq/permissions' in resp.body
97

  
98
    with open(os.path.join(pub.app_dir, 'site-options.cfg'), 'w') as fd:
99
        if not pub.site_options.has_section('options'):
100
            pub.site_options.add_section('options')
101
        pub.site_options.set('options', 'auquotidien-links', 'true')
102
        pub.site_options.write(fd)
103

  
91 104
    resp = app.get('/backoffice/settings/')
92 105
    assert 'aq/permissions' in resp.body
93 106
    resp = app.get('/backoffice/settings/aq/permissions')
94 107

  
95
def test_menu_items():
108
def test_menu_items(empty_siteoptions):
96 109
    create_superuser()
97 110
    role = create_role()
98 111

  
112
    with open(os.path.join(pub.app_dir, 'site-options.cfg'), 'w') as fd:
113
        if not pub.site_options.has_section('options'):
114
            pub.site_options.add_section('options')
115
        pub.site_options.set('options', 'auquotidien-links', 'true')
116
        pub.site_options.write(fd)
117

  
99 118
    for area in ('links', 'announces', 'events', 'links', 'payments'):
119

  
120
        with open(os.path.join(pub.app_dir, 'site-options.cfg'), 'w') as fd:
121
            if not pub.site_options.has_section('options'):
122
                pub.site_options.add_section('options')
123
            pub.site_options.set('options', 'auquotidien-%s' % area, 'true')
124
            pub.site_options.write(fd)
125

  
100 126
        pub.cfg['aq-permissions'] = {area: None}
101 127
        pub.write_cfg()
102 128

  

Formats disponibles : Unified diff