Projet

Général

Profil

0001-debug-use-INTERNAL_IPS.append-to-preserve-existing-v.patch

Benjamin Dauvergne, 12 mai 2022 15:45

Télécharger (2,66 ko)

Voir les différences:

Subject: [PATCH] debug: use INTERNAL_IPS.append to preserve existing values
 (#65160)

 hobo/debug/views.py   |  2 +-
 tests/test_manager.py | 12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)
hobo/debug/views.py
34 34

  
35 35
    @cached_property
36 36
    def debug_ips_variable(self):
37
        return get_setting_variable('INTERNAL_IPS')
37
        return get_setting_variable('INTERNAL_IPS.append')
38 38

  
39 39
    def get_initial(self):
40 40
        initial = super(HomeView, self).get_initial()
tests/test_manager.py
127 127
    page = page.form.submit().follow()
128 128

  
129 129
    assert get_setting_variable('DEBUG_LOG').json is True
130
    assert get_setting_variable('INTERNAL_IPS').json == IP_LIST
130
    assert get_setting_variable('INTERNAL_IPS.append').json == IP_LIST
131 131
    hobo_json = get_installed_services_dict()
132 132
    assert hobo_json['variables']['SETTING_DEBUG_LOG'] is True
133
    assert hobo_json['variables']['SETTING_INTERNAL_IPS'] == IP_LIST
133
    assert hobo_json['variables']['SETTING_INTERNAL_IPS.append'] == IP_LIST
134 134

  
135 135
    page.form['debug_log'] = False
136 136
    page.form['debug_ips'] = ''
137 137
    page = page.form.submit().follow()
138 138

  
139 139
    assert get_setting_variable('DEBUG_LOG').json is False
140
    assert get_setting_variable('INTERNAL_IPS').json == []
140
    assert get_setting_variable('INTERNAL_IPS.append').json == []
141 141
    hobo_json = get_installed_services_dict()
142 142
    assert hobo_json['variables']['SETTING_DEBUG_LOG'] is False
143
    assert hobo_json['variables']['SETTING_INTERNAL_IPS'] == []
143
    assert hobo_json['variables']['SETTING_INTERNAL_IPS.append'] == []
144 144

  
145 145
    # toggle-current-ip button
146 146
    page = logged_app.get('/debug/')
147 147
    page.form['debug_ips'] = IPS
148 148
    page = page.form.submit(name='toggle-current-ip').follow()  # click
149
    assert get_setting_variable('INTERNAL_IPS').json == IP_LIST + ['127.0.0.1']
149
    assert get_setting_variable('INTERNAL_IPS.append').json == IP_LIST + ['127.0.0.1']
150 150
    page = page.form.submit(name='toggle-current-ip').follow()  # click again
151
    assert get_setting_variable('INTERNAL_IPS').json == IP_LIST
151
    assert get_setting_variable('INTERNAL_IPS.append').json == IP_LIST
152 152

  
153 153
    # wrong ips are not returned as a list
154 154
    page = logged_app.get('/debug/')
155
-