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:
Sunil Mohan Adapa 2019-05-31 11:41:33 -07:00 committed by James Valleroy
parent 862d87920a
commit e55a85bdd1
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
3 changed files with 6 additions and 6 deletions

View File

@ -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]

View File

@ -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)

View File

@ -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):