debug: use INTERNAL_IPS.extend to preserve existing values (#65160)
This commit is contained in:
parent
95ee5d21f9
commit
8a7c81561c
|
@ -34,7 +34,7 @@ class HomeView(FormView):
|
|||
|
||||
@cached_property
|
||||
def debug_ips_variable(self):
|
||||
return get_setting_variable('INTERNAL_IPS')
|
||||
return get_setting_variable('INTERNAL_IPS.extend')
|
||||
|
||||
def get_initial(self):
|
||||
initial = super(HomeView, self).get_initial()
|
||||
|
|
|
@ -127,28 +127,28 @@ def test_debug_home(logged_app):
|
|||
page = page.form.submit().follow()
|
||||
|
||||
assert get_setting_variable('DEBUG_LOG').json is True
|
||||
assert get_setting_variable('INTERNAL_IPS').json == IP_LIST
|
||||
assert get_setting_variable('INTERNAL_IPS.extend').json == IP_LIST
|
||||
hobo_json = get_installed_services_dict()
|
||||
assert hobo_json['variables']['SETTING_DEBUG_LOG'] is True
|
||||
assert hobo_json['variables']['SETTING_INTERNAL_IPS'] == IP_LIST
|
||||
assert hobo_json['variables']['SETTING_INTERNAL_IPS.extend'] == IP_LIST
|
||||
|
||||
page.form['debug_log'] = False
|
||||
page.form['debug_ips'] = ''
|
||||
page = page.form.submit().follow()
|
||||
|
||||
assert get_setting_variable('DEBUG_LOG').json is False
|
||||
assert get_setting_variable('INTERNAL_IPS').json == []
|
||||
assert get_setting_variable('INTERNAL_IPS.extend').json == []
|
||||
hobo_json = get_installed_services_dict()
|
||||
assert hobo_json['variables']['SETTING_DEBUG_LOG'] is False
|
||||
assert hobo_json['variables']['SETTING_INTERNAL_IPS'] == []
|
||||
assert hobo_json['variables']['SETTING_INTERNAL_IPS.extend'] == []
|
||||
|
||||
# toggle-current-ip button
|
||||
page = logged_app.get('/debug/')
|
||||
page.form['debug_ips'] = IPS
|
||||
page = page.form.submit(name='toggle-current-ip').follow() # click
|
||||
assert get_setting_variable('INTERNAL_IPS').json == IP_LIST + ['127.0.0.1']
|
||||
assert get_setting_variable('INTERNAL_IPS.extend').json == IP_LIST + ['127.0.0.1']
|
||||
page = page.form.submit(name='toggle-current-ip').follow() # click again
|
||||
assert get_setting_variable('INTERNAL_IPS').json == IP_LIST
|
||||
assert get_setting_variable('INTERNAL_IPS.extend').json == IP_LIST
|
||||
|
||||
# wrong ips are not returned as a list
|
||||
page = logged_app.get('/debug/')
|
||||
|
|
Loading…
Reference in New Issue