From 312e53834708e37be87253605dfabdc2ff4d71b3 Mon Sep 17 00:00:00 2001 From: fmiquiza Date: Fri, 29 Jun 2018 15:54:15 -0400 Subject: [PATCH 1/3] Adding fix for issue and validation --- SoftLayer/managers/ticket.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SoftLayer/managers/ticket.py b/SoftLayer/managers/ticket.py index 553f32600..93b915097 100644 --- a/SoftLayer/managers/ticket.py +++ b/SoftLayer/managers/ticket.py @@ -5,7 +5,6 @@ :license: MIT, see LICENSE for more details. """ - from SoftLayer import utils @@ -38,6 +37,8 @@ def list_tickets(self, open_status=True, closed_status=True): call = 'getOpenTickets' elif closed_status: call = 'getClosedTickets' + else: + raise ValueError("open_status and closed_status cannot both be False") return self.client.call('Account', call, mask=mask) From 7e982d488e790f64a87ae1d5c13784c1a979113e Mon Sep 17 00:00:00 2001 From: fmiquiza Date: Fri, 29 Jun 2018 15:59:03 -0400 Subject: [PATCH 2/3] Adding unit test --- tests/managers/ticket_tests.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/managers/ticket_tests.py b/tests/managers/ticket_tests.py index 2ebbfced7..975077a1b 100644 --- a/tests/managers/ticket_tests.py +++ b/tests/managers/ticket_tests.py @@ -43,6 +43,14 @@ def test_list_tickets_closed(self): self.assertIn(result['id'], [100, 101]) self.assert_called_with('SoftLayer_Account', 'getClosedTickets') + def test_list_tickets_false(self): + exception = self.assertRaises(ValueError, + self.ticket.list_tickets, + open_status=False, + closed_status=False) + + self.assertEquals('open_status and closed_status cannot both be False', str(exception)) + def test_list_subjects(self): list_expected_ids = [1001, 1002, 1003, 1004, 1005] From e834590be87b3ac1e595e58c02cda7d3c9211d61 Mon Sep 17 00:00:00 2001 From: fmiquiza Date: Fri, 29 Jun 2018 16:12:50 -0400 Subject: [PATCH 3/3] Fixing -tox analysis error --- tests/managers/ticket_tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/managers/ticket_tests.py b/tests/managers/ticket_tests.py index 975077a1b..50ed7b29a 100644 --- a/tests/managers/ticket_tests.py +++ b/tests/managers/ticket_tests.py @@ -49,7 +49,7 @@ def test_list_tickets_false(self): open_status=False, closed_status=False) - self.assertEquals('open_status and closed_status cannot both be False', str(exception)) + self.assertEqual('open_status and closed_status cannot both be False', str(exception)) def test_list_subjects(self): list_expected_ids = [1001, 1002, 1003, 1004, 1005]