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
1 change: 1 addition & 0 deletions SoftLayer/CLI/ticket/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def get_ticket_results(mgr, ticket_id, update_count=1):
table.align['value'] = 'l'

table.add_row(['id', ticket['id']])
table.add_row(['Case_Number', ticket['serviceProviderResourceId']])
table.add_row(['title', ticket['title']])
table.add_row(['priority', PRIORITY_MAP[ticket.get('priority', 0)]])
if ticket.get('assignedUser'):
Expand Down
3 changes: 2 additions & 1 deletion SoftLayer/CLI/ticket/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def cli(env, is_open):
"""List tickets."""
ticket_mgr = SoftLayer.TicketManager(env.client)
table = formatting.Table([
'id', 'assigned_user', 'title', 'last_edited', 'status', 'updates', 'priority'
'id', 'Case_Number', 'assigned_user', 'title', 'last_edited', 'status', 'updates', 'priority'
])

tickets = ticket_mgr.list_tickets(open_status=is_open, closed_status=not is_open)
Expand All @@ -27,6 +27,7 @@ def cli(env, is_open):

table.add_row([
ticket['id'],
ticket['serviceProviderResourceId'],
user,
click.wrap_text(ticket['title']),
ticket['lastEditDate'],
Expand Down
3 changes: 3 additions & 0 deletions SoftLayer/fixtures/SoftLayer_Account.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@
getTickets = [
{
"accountId": 1234,
"serviceProviderResourceId": "CS123456",
"assignedUserId": 12345,
"createDate": "2013-08-01T14:14:04-07:00",
"id": 100,
Expand All @@ -355,6 +356,7 @@
},
{
"accountId": 1234,
"serviceProviderResourceId": "CS123456",
"assignedUserId": 12345,
"createDate": "2013-08-01T14:14:04-07:00",
"id": 101,
Expand All @@ -370,6 +372,7 @@
},
{
"accountId": 1234,
"serviceProviderResourceId": "CS123456",
"assignedUserId": 12345,
"createDate": "2014-03-03T09:44:01-08:00",
"id": 102,
Expand Down
4 changes: 4 additions & 0 deletions SoftLayer/fixtures/SoftLayer_Ticket.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
createCancelServerTicket = {'id': 1234, 'title': 'Server Cancellation Request'}
getObject = {
"accountId": 1234,
"serviceProviderResourceId": "CS123456",
"assignedUserId": 12345,
"createDate": "2013-08-01T14:14:04-07:00",
"id": 100,
Expand All @@ -26,6 +27,7 @@

createStandardTicket = {
"assignedUserId": 12345,
"serviceProviderResourceId": "CS123456",
"id": 100,
"contents": "body",
"subjectId": 1004,
Expand All @@ -34,6 +36,8 @@
edit = True
addUpdate = {}

gatList = getObject

addAttachedHardware = {
"id": 123,
"createDate": "2013-08-01T14:14:04-07:00",
Expand Down
5 changes: 2 additions & 3 deletions SoftLayer/managers/ticket.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def list_tickets(self, open_status=True, closed_status=True):
:param boolean open_status: include open tickets
:param boolean closed_status: include closed tickets
"""
mask = """mask[id, title, assignedUser[firstName, lastName], priority,
mask = """mask[id, serviceProviderResourceId, title, assignedUser[firstName, lastName], priority,
createDate, lastEditDate, accountId, status, updateCount]"""

call = 'getTickets'
Expand All @@ -39,7 +39,6 @@ def list_tickets(self, open_status=True, closed_status=True):
call = 'getClosedTickets'
else:
raise ValueError("open_status and closed_status cannot both be False")

return self.client.call('Account', call, mask=mask, iter=True)

def list_subjects(self):
Expand All @@ -53,7 +52,7 @@ def get_ticket(self, ticket_id):
:returns: dict -- information about the specified ticket

"""
mask = """mask[id, title, assignedUser[firstName, lastName],status,
mask = """mask[id, serviceProviderResourceId, title, assignedUser[firstName, lastName],status,
createDate,lastEditDate,updates[entry,editor],updateCount, priority]"""
return self.ticket.getObject(id=ticket_id, mask=mask)

Expand Down
3 changes: 3 additions & 0 deletions tests/CLI/modules/ticket_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def test_list(self):

expected = [{
'assigned_user': 'John Smith',
'Case_Number': 'CS123456',
'id': 102,
'last_edited': '2013-08-01T14:16:47-07:00',
'priority': 0,
Expand All @@ -34,6 +35,7 @@ def test_detail(self):
result = self.run_command(['ticket', 'detail', '1'])

expected = {
'Case_Number': 'CS123456',
'created': '2013-08-01T14:14:04-07:00',
'edited': '2013-08-01T14:16:47-07:00',
'id': 100,
Expand Down Expand Up @@ -235,6 +237,7 @@ def test_init_ticket_results(self):
def test_init_ticket_results_asigned_user(self):
mock = self.set_mock('SoftLayer_Ticket', 'getObject')
mock.return_value = {
"serviceProviderResourceId": "CS12345",
"id": 100,
"title": "Simple Title",
"priority": 1,
Expand Down