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) diff --git a/tests/managers/ticket_tests.py b/tests/managers/ticket_tests.py index 2ebbfced7..50ed7b29a 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.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]