From 2aaa0bf2870e5edab9bc314c534fa406d21a2156 Mon Sep 17 00:00:00 2001 From: Phill Ridout Date: Sun, 10 Jun 2018 07:38:42 +0100 Subject: [PATCH] break out the code using multiple when/thens --- .../openlp_core/widgets/test_widgets.py | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/tests/interfaces/openlp_core/widgets/test_widgets.py b/tests/interfaces/openlp_core/widgets/test_widgets.py index 8036cee3f..5353596fd 100644 --- a/tests/interfaces/openlp_core/widgets/test_widgets.py +++ b/tests/interfaces/openlp_core/widgets/test_widgets.py @@ -42,13 +42,14 @@ class TestProxyWidget(TestCase, TestMixin): Registry.create() self.setup_application() - def test_radio_button_exclusivity(self): + def test_radio_button_exclusivity_no_proxy(self): """ Test that only one radio button can be checked at a time, and that the line edits are only enabled when the `manual_proxy_radio` is checked """ - # GIVEN: An instance of the `openlp.core.common.widgets.widgets.ProxyWidget` + # GIVEN: An instance of the `openlp.core.common.widgets.widgets.ProxyWidget` with a radio already checked proxy_widget = ProxyWidget() + proxy_widget.manual_proxy_radio.setChecked(True) # WHEN: 'Checking' the `no_proxy_radio` button proxy_widget.no_proxy_radio.setChecked(True) @@ -61,6 +62,15 @@ class TestProxyWidget(TestCase, TestMixin): assert proxy_widget.username_edit.isEnabled() is False assert proxy_widget.password_edit.isEnabled() is False + def test_radio_button_exclusivity_system_proxy(self): + """ + Test that only one radio button can be checked at a time, and that the line edits are only enabled when the + `manual_proxy_radio` is checked + """ + # GIVEN: An instance of the `openlp.core.common.widgets.widgets.ProxyWidget` with a radio already checked + proxy_widget = ProxyWidget() + proxy_widget.manual_proxy_radio.setChecked(True) + # WHEN: 'Checking' the `use_sysem_proxy_radio` button proxy_widget.use_sysem_proxy_radio.setChecked(True) @@ -72,6 +82,15 @@ class TestProxyWidget(TestCase, TestMixin): assert proxy_widget.username_edit.isEnabled() is False assert proxy_widget.password_edit.isEnabled() is False + def test_radio_button_exclusivity_manual_proxy(self): + """ + Test that only one radio button can be checked at a time, and that the line edits are only enabled when the + `manual_proxy_radio` is checked + """ + # GIVEN: An instance of the `openlp.core.common.widgets.widgets.ProxyWidget` with a radio already checked + proxy_widget = ProxyWidget() + proxy_widget.no_proxy_radio.setChecked(True) + # WHEN: 'Checking' the `manual_proxy_radio` button proxy_widget.manual_proxy_radio.setChecked(True)