Skip to content

Commit 29759b4

Browse files
Merge pull request #1171 from caberos/github-python/issues/1170
add the new services id
2 parents 81c4231 + 93cda54 commit 29759b4

File tree

6 files changed

+15
-4
lines changed

6 files changed

+15
-4
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
@@ -364,6 +364,7 @@
364364
getTickets = [
365365
{
366366
"accountId": 1234,
367+
"serviceProviderResourceId": "CS123456",
367368
"assignedUserId": 12345,
368369
"createDate": "2013-08-01T14:14:04-07:00",
369370
"id": 100,
@@ -379,6 +380,7 @@
379380
},
380381
{
381382
"accountId": 1234,
383+
"serviceProviderResourceId": "CS123456",
382384
"assignedUserId": 12345,
383385
"createDate": "2013-08-01T14:14:04-07:00",
384386
"id": 101,
@@ -394,6 +396,7 @@
394396
},
395397
{
396398
"accountId": 1234,
399+
"serviceProviderResourceId": "CS123456",
397400
"assignedUserId": 12345,
398401
"createDate": "2014-03-03T09:44:01-08:00",
399402
"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+
gatList = 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: 3 additions & 0 deletions
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,

0 commit comments

Comments
 (0)