Skip to content

Commit 6dae28c

Browse files
Daniel Cabero BarriosDaniel Cabero Barrios
authored andcommitted
add the new services id
1 parent 0c0d364 commit 6dae28c

File tree

6 files changed

+16
-5
lines changed

6 files changed

+16
-5
lines changed

SoftLayer/CLI/ticket/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ def get_ticket_results(mgr, ticket_id, update_count=1):
3232
table.align['value'] = 'l'
3333

3434
table.add_row(['id', ticket['id']])
35+
table.add_row(['Case_Number', ticket['serviceProviderResourceId']])
3536
table.add_row(['title', ticket['title']])
3637
table.add_row(['priority', PRIORITY_MAP[ticket.get('priority', 0)]])
3738
if ticket.get('assignedUser'):

SoftLayer/CLI/ticket/list.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def cli(env, is_open):
1616
"""List tickets."""
1717
ticket_mgr = SoftLayer.TicketManager(env.client)
1818
table = formatting.Table([
19-
'id', 'assigned_user', 'title', 'last_edited', 'status', 'updates', 'priority'
19+
'id', 'Case_Number', 'assigned_user', 'title', 'last_edited', 'status', 'updates', 'priority'
2020
])
2121

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

2828
table.add_row([
2929
ticket['id'],
30+
ticket['serviceProviderResourceId'],
3031
user,
3132
click.wrap_text(ticket['title']),
3233
ticket['lastEditDate'],

SoftLayer/fixtures/SoftLayer_Account.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,7 @@
340340
getTickets = [
341341
{
342342
"accountId": 1234,
343+
"serviceProviderResourceId": "CS123456",
343344
"assignedUserId": 12345,
344345
"createDate": "2013-08-01T14:14:04-07:00",
345346
"id": 100,
@@ -355,6 +356,7 @@
355356
},
356357
{
357358
"accountId": 1234,
359+
"serviceProviderResourceId": "CS123456",
358360
"assignedUserId": 12345,
359361
"createDate": "2013-08-01T14:14:04-07:00",
360362
"id": 101,
@@ -370,6 +372,7 @@
370372
},
371373
{
372374
"accountId": 1234,
375+
"serviceProviderResourceId": "CS123456",
373376
"assignedUserId": 12345,
374377
"createDate": "2014-03-03T09:44:01-08:00",
375378
"id": 102,

SoftLayer/fixtures/SoftLayer_Ticket.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
createCancelServerTicket = {'id': 1234, 'title': 'Server Cancellation Request'}
22
getObject = {
33
"accountId": 1234,
4+
"serviceProviderResourceId": "CS123456",
45
"assignedUserId": 12345,
56
"createDate": "2013-08-01T14:14:04-07:00",
67
"id": 100,
@@ -26,6 +27,7 @@
2627

2728
createStandardTicket = {
2829
"assignedUserId": 12345,
30+
"serviceProviderResourceId": "CS123456",
2931
"id": 100,
3032
"contents": "body",
3133
"subjectId": 1004,
@@ -34,6 +36,8 @@
3436
edit = True
3537
addUpdate = {}
3638

39+
list = getObject
40+
3741
addAttachedHardware = {
3842
"id": 123,
3943
"createDate": "2013-08-01T14:14:04-07:00",

SoftLayer/managers/ticket.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def list_tickets(self, open_status=True, closed_status=True):
2828
:param boolean open_status: include open tickets
2929
:param boolean closed_status: include closed tickets
3030
"""
31-
mask = """mask[id, title, assignedUser[firstName, lastName], priority,
31+
mask = """mask[id, serviceProviderResourceId, title, assignedUser[firstName, lastName], priority,
3232
createDate, lastEditDate, accountId, status, updateCount]"""
3333

3434
call = 'getTickets'
@@ -39,7 +39,6 @@ def list_tickets(self, open_status=True, closed_status=True):
3939
call = 'getClosedTickets'
4040
else:
4141
raise ValueError("open_status and closed_status cannot both be False")
42-
4342
return self.client.call('Account', call, mask=mask, iter=True)
4443

4544
def list_subjects(self):
@@ -53,7 +52,7 @@ def get_ticket(self, ticket_id):
5352
:returns: dict -- information about the specified ticket
5453
5554
"""
56-
mask = """mask[id, title, assignedUser[firstName, lastName],status,
55+
mask = """mask[id, serviceProviderResourceId, title, assignedUser[firstName, lastName],status,
5756
createDate,lastEditDate,updates[entry,editor],updateCount, priority]"""
5857
return self.ticket.getObject(id=ticket_id, mask=mask)
5958

tests/CLI/modules/ticket_tests.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def test_list(self):
2121

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

3637
expected = {
38+
'Case_Number': 'CS123456',
3739
'created': '2013-08-01T14:14:04-07:00',
3840
'edited': '2013-08-01T14:16:47-07:00',
3941
'id': 100,
@@ -235,6 +237,7 @@ def test_init_ticket_results(self):
235237
def test_init_ticket_results_asigned_user(self):
236238
mock = self.set_mock('SoftLayer_Ticket', 'getObject')
237239
mock.return_value = {
240+
"serviceProviderResourceId": "CS12345",
238241
"id": 100,
239242
"title": "Simple Title",
240243
"priority": 1,
@@ -296,4 +299,4 @@ def test_ticket_update_no_body(self, edit_mock):
296299
edit_mock.return_value = 'Testing1'
297300
result = self.run_command(['ticket', 'update', '100'])
298301
self.assert_no_fail(result)
299-
self.assert_called_with('SoftLayer_Ticket', 'addUpdate', args=({'entry': 'Testing1'},), identifier=100)
302+
self.assert_called_with('SoftLayer_Ticket', 'addUpdate', args=({'entry': 'Testing1'},), identifier=100)

0 commit comments

Comments
 (0)