Skip to content

Commit 3de562b

Browse files
caberoscaberos
authored andcommitted
fix the team code review and fix the unit test
1 parent 0fa4dfd commit 3de562b

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

SoftLayer/CLI/order/place.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from SoftLayer.CLI import environment
99
from SoftLayer.CLI import exceptions
1010
from SoftLayer.CLI import formatting
11+
from SoftLayer.managers import NetworkManager
1112
from SoftLayer.managers import ordering
1213

1314
COLUMNS = ['keyName',
@@ -64,6 +65,10 @@ def cli(env, package_keyname, location, preset, verify, billing, complex_type,
6465
6566
"""
6667
manager = ordering.OrderingManager(env.client)
68+
network = NetworkManager(env.client)
69+
70+
pods = network.get_closed_pods()
71+
closure = []
6772

6873
if extras:
6974
try:
@@ -90,6 +95,10 @@ def cli(env, package_keyname, location, preset, verify, billing, complex_type,
9095
])
9196

9297
else:
98+
print(args)
99+
for pod in pods:
100+
closure.append(pod['name'])
101+
click.secho(click.style('Warning: Closed soon: %s' % (', '.join(closure)), fg='yellow'))
93102
if not (env.skip_confirmations or formatting.confirm(
94103
"This action will incur charges on your account. Continue?")):
95104
raise exceptions.CLIAbort("Aborting order.")

tests/CLI/modules/order_tests.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,10 @@ def test_place(self):
141141

142142
self.assert_no_fail(result)
143143
self.assert_called_with('SoftLayer_Product_Order', 'placeOrder')
144-
self.assertEqual({'id': 1234,
145-
'created': order_date,
146-
'status': 'APPROVED'},
147-
json.loads(result.output))
144+
self.assertEqual("('package', 'DALLAS13', ('ITEM1',))\n"
145+
'Warning: Closed soon: ams01.pod01, wdc07.pod01, TEST00.pod2\n'
146+
'{\n "id": 1234,\n "created": "2017-04-04 07:39:20",\n "status": "APPROVED"\n}\n',
147+
str(result.output))
148148

149149
def test_place_with_quantity(self):
150150
order_date = '2017-04-04 07:39:20'
@@ -162,10 +162,10 @@ def test_place_with_quantity(self):
162162

163163
self.assert_no_fail(result)
164164
self.assert_called_with('SoftLayer_Product_Order', 'placeOrder')
165-
self.assertEqual({'id': 1234,
166-
'created': order_date,
167-
'status': 'APPROVED'},
168-
json.loads(result.output))
165+
self.assertEqual("('package', 'DALLAS13', ('ITEM1',))\n"
166+
'Warning: Closed soon: ams01.pod01, wdc07.pod01, TEST00.pod2\n'
167+
'{\n "id": 1234,\n "created": "2017-04-04 07:39:20",\n "status": "APPROVED"\n}\n',
168+
str(result.output))
169169

170170
def test_place_extras_parameter_fail(self):
171171
result = self.run_command(['-y', 'order', 'place', 'package', 'DALLAS13', 'ITEM1',

0 commit comments

Comments
 (0)