mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-04-15 09:51:21 +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]
|
||||
return component
|
||||
|
||||
def get(self, component_id):
|
||||
def get_component(self, component_id):
|
||||
"""Return a component given the component's ID."""
|
||||
return self.components[component_id]
|
||||
|
||||
|
||||
@ -111,7 +111,7 @@ class MediaWikiServiceView(views.ServiceView):
|
||||
actions.superuser_run('mediawiki', ['private-mode', 'disable'])
|
||||
messages.success(self.request, _('Private mode disabled'))
|
||||
|
||||
mediawiki.app.get('shortcut-mediawiki').login_required = \
|
||||
new_config['enable_private_mode']
|
||||
shortcut = mediawiki.app.get_component('shortcut-mediawiki')
|
||||
shortcut.login_required = new_config['enable_private_mode']
|
||||
|
||||
return super().form_valid(form)
|
||||
|
||||
@ -66,13 +66,13 @@ def test_app_remove(app_with_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."""
|
||||
app = app_with_components
|
||||
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):
|
||||
app.get('x-invalid-component')
|
||||
app.get_component('x-invalid-component')
|
||||
|
||||
|
||||
def test_app_enable(app_with_components):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user