PEP fixes

This commit is contained in:
Philip Ridout 2018-10-22 21:42:25 +01:00
parent bdec3f407b
commit aa744e0d99
5 changed files with 8 additions and 11 deletions

View File

@ -275,9 +275,6 @@ class Settings(QtCore.QSettings):
('songuasge/db hostname', 'songusage/db hostname', []), ('songuasge/db hostname', 'songusage/db hostname', []),
('songuasge/db database', 'songusage/db database', []), ('songuasge/db database', 'songusage/db database', []),
('presentations / Powerpoint Viewer', '', []), ('presentations / Powerpoint Viewer', '', []),
('songuasge/db hostname', 'songusage/db hostname', []),
('songuasge/db hostname', 'songusage/db hostname', []),
('songuasge/db hostname', 'songusage/db hostname', []),
('bibles/proxy name', '', []), # Just remove these bible proxy settings. They weren't used in 2.4! ('bibles/proxy name', '', []), # Just remove these bible proxy settings. They weren't used in 2.4!
('bibles/proxy address', '', []), ('bibles/proxy address', '', []),
('bibles/proxy username', '', []), ('bibles/proxy username', '', []),

View File

@ -609,4 +609,4 @@ def create_separated_list(string_list):
last=string_list[-1]) last=string_list[-1])
else: else:
list_to_string = '' list_to_string = ''
return list_to_string return list_to_string

View File

@ -51,7 +51,6 @@ def upgrade_2(session, metadata):
Remove the individual proxy settings, after the implementation of central proxy settings. Remove the individual proxy settings, after the implementation of central proxy settings.
Added in 2.5 (3.0 development) Added in 2.5 (3.0 development)
""" """
# TODO: Test
settings = Settings() settings = Settings()
op = get_upgrade_op(session) op = get_upgrade_op(session)
metadata_table = Table('metadata', metadata, autoload=True) metadata_table = Table('metadata', metadata, autoload=True)
@ -80,7 +79,8 @@ def upgrade_2(session, metadata):
https_proxy = proxy https_proxy = proxy
settings.setValue('advanced/proxy https', proxy) settings.setValue('advanced/proxy https', proxy)
if http_proxy or https_proxy: if http_proxy or https_proxy:
username, = session.execute(select([metadata_table.c.value], metadata_table.c.key == 'proxy_username')).first() username, = session.execute(
select([metadata_table.c.value], metadata_table.c.key == 'proxy_username')).first()
proxy, = session.execute(select([metadata_table.c.value], metadata_table.c.key == 'proxy_password')).first() proxy, = session.execute(select([metadata_table.c.value], metadata_table.c.key == 'proxy_password')).first()
settings.setValue('advanced/proxy username', username) settings.setValue('advanced/proxy username', username)
settings.setValue('advanced/proxy password', proxy) settings.setValue('advanced/proxy password', proxy)

View File

@ -162,6 +162,7 @@ def test_check_same_instance():
def test_get_language_from_settings(): def test_get_language_from_settings():
assert LanguageManager.get_language() == 'en' assert LanguageManager.get_language() == 'en'
def test_get_language_from_settings_returns_unchanged_if_unknown_format(): def test_get_language_from_settings_returns_unchanged_if_unknown_format():
Settings().setValue('core/language', '(foobar)') Settings().setValue('core/language', '(foobar)')
assert LanguageManager.get_language() == '(foobar)' assert LanguageManager.get_language() == '(foobar)'

View File

@ -146,7 +146,6 @@ class TestProxyMetaUpgrade(TestCase, TestMixin):
assert conn.execute('SELECT * FROM metadata WHERE key = "version"').first().value == '2' assert conn.execute('SELECT * FROM metadata WHERE key = "version"').first().value == '2'
self.mocked_settings_instance.setValue.assert_not_called() self.mocked_settings_instance.setValue.assert_not_called()
def test_upgrade_2_http_selected(self): def test_upgrade_2_http_selected(self):
""" """
Test that upgrade 2 completes properly when the user chooses to use a HTTP proxy Test that upgrade 2 completes properly when the user chooses to use a HTTP proxy
@ -167,7 +166,7 @@ class TestProxyMetaUpgrade(TestCase, TestMixin):
assert conn.execute('SELECT * FROM metadata WHERE key = "version"').first().value == '2' assert conn.execute('SELECT * FROM metadata WHERE key = "version"').first().value == '2'
assert self.mocked_settings_instance.setValue.call_args_list == [ assert self.mocked_settings_instance.setValue.call_args_list == [
call('advanced/proxy http', 'proxy_server'), call('advanced/proxy username', 'proxy_username'), call('advanced/proxy http', 'proxy_server'), call('advanced/proxy username', 'proxy_username'),
call('advanced/proxy password', 'proxy_password'), call('advanced/proxy mode', ProxyMode.MANUAL_PROXY)] call('advanced/proxy password', 'proxy_password'), call('advanced/proxy mode', ProxyMode.MANUAL_PROXY)]
def test_upgrade_2_https_selected(self): def test_upgrade_2_https_selected(self):
@ -214,6 +213,6 @@ class TestProxyMetaUpgrade(TestCase, TestMixin):
assert conn.execute('SELECT * FROM metadata WHERE key = "version"').first().value == '2' assert conn.execute('SELECT * FROM metadata WHERE key = "version"').first().value == '2'
assert self.mocked_settings_instance.setValue.call_args_list == [ assert self.mocked_settings_instance.setValue.call_args_list == [
call('advanced/proxy http', 'proxy_server'), call('advanced/proxy https', 'proxy_server'), call('advanced/proxy http', 'proxy_server'), call('advanced/proxy https', 'proxy_server'),
call('advanced/proxy username', 'proxy_username'), call('advanced/proxy password', 'proxy_password'), call('advanced/proxy username', 'proxy_username'), call('advanced/proxy password', 'proxy_password'),
call('advanced/proxy mode', ProxyMode.MANUAL_PROXY)] call('advanced/proxy mode', ProxyMode.MANUAL_PROXY)]