mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-09-19 04:59:01 +00:00
app: Rename get() method to get_component()
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
862d87920a
commit
e55a85bdd1
@ -46,7 +46,7 @@ class App:
|
|||||||
del self.components[component_id]
|
del self.components[component_id]
|
||||||
return component
|
return component
|
||||||
|
|
||||||
def get(self, component_id):
|
def get_component(self, component_id):
|
||||||
"""Return a component given the component's ID."""
|
"""Return a component given the component's ID."""
|
||||||
return self.components[component_id]
|
return self.components[component_id]
|
||||||
|
|
||||||
|
|||||||
@ -111,7 +111,7 @@ class MediaWikiServiceView(views.ServiceView):
|
|||||||
actions.superuser_run('mediawiki', ['private-mode', 'disable'])
|
actions.superuser_run('mediawiki', ['private-mode', 'disable'])
|
||||||
messages.success(self.request, _('Private mode disabled'))
|
messages.success(self.request, _('Private mode disabled'))
|
||||||
|
|
||||||
mediawiki.app.get('shortcut-mediawiki').login_required = \
|
shortcut = mediawiki.app.get_component('shortcut-mediawiki')
|
||||||
new_config['enable_private_mode']
|
shortcut.login_required = new_config['enable_private_mode']
|
||||||
|
|
||||||
return super().form_valid(form)
|
return super().form_valid(form)
|
||||||
|
|||||||
@ -66,13 +66,13 @@ def test_app_remove(app_with_components):
|
|||||||
assert 'test-leader-1' not in app.components
|
assert 'test-leader-1' not in app.components
|
||||||
|
|
||||||
|
|
||||||
def test_get(app_with_components):
|
def test_get_component(app_with_components):
|
||||||
"""Test retrieving a component from an App."""
|
"""Test retrieving a component from an App."""
|
||||||
app = app_with_components
|
app = app_with_components
|
||||||
component = app.components['test-leader-1']
|
component = app.components['test-leader-1']
|
||||||
assert app.get('test-leader-1') == component
|
assert app.get_component('test-leader-1') == component
|
||||||
with pytest.raises(KeyError):
|
with pytest.raises(KeyError):
|
||||||
app.get('x-invalid-component')
|
app.get_component('x-invalid-component')
|
||||||
|
|
||||||
|
|
||||||
def test_app_enable(app_with_components):
|
def test_app_enable(app_with_components):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user