Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion SoftLayer/managers/ticket.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

:license: MIT, see LICENSE for more details.
"""

from SoftLayer import utils


Expand Down Expand Up @@ -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)

Expand Down
8 changes: 8 additions & 0 deletions tests/managers/ticket_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down