Skip to content

Commit a511285

Browse files
Merge pull request #1487 from allmightyspiff/issues1486
#1486 fixed newly failing unit tests
2 parents 9e00da4 + eff3bf2 commit a511285

File tree

3 files changed

+20
-18
lines changed

3 files changed

+20
-18
lines changed

SoftLayer/CLI/virt/create.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def _parse_create_args(client, args):
177177
help="Forces the VS to only have access the private network")
178178
@click.option('--like', is_eager=True, callback=_update_with_like_args,
179179
help="Use the configuration from an existing VS")
180-
@click.option('--network', '-n', help="Network port speed in Mbps")
180+
@click.option('--network', '-n', help="Network port speed in Mbps", type=click.INT)
181181
@helpers.multi_option('--tag', '-g', help="Tags to add to the instance")
182182
@click.option('--template', '-t', is_eager=True,
183183
callback=template.TemplateCallback(list_args=['disk', 'key', 'tag']),

tests/CLI/modules/vs/vs_create_tests.py

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def test_create(self, confirm_mock):
4242
'hostname': 'host',
4343
'startCpus': 2,
4444
'operatingSystemReferenceCode': 'UBUNTU_LATEST',
45-
'networkComponents': [{'maxSpeed': '100'}],
45+
'networkComponents': [{'maxSpeed': 100}],
4646
'supplementalCreateObjectOptions': {'bootMode': None}},)
4747
self.assert_called_with('SoftLayer_Virtual_Guest', 'generateOrderTemplate', args=args)
4848

@@ -225,7 +225,7 @@ def test_create_with_integer_image_guid(self, confirm_mock):
225225
'supplementalCreateObjectOptions': {'bootMode': None},
226226
'blockDeviceTemplateGroup': {'globalIdentifier': 'aaaa1111bbbb2222'},
227227
'datacenter': {'name': 'dal05'},
228-
'networkComponents': [{'maxSpeed': '100'}]
228+
'networkComponents': [{'maxSpeed': 100}]
229229
},)
230230

231231
self.assert_called_with('SoftLayer_Virtual_Guest', 'generateOrderTemplate', args=args)
@@ -257,7 +257,7 @@ def test_create_with_flavor(self, confirm_mock):
257257
'bootMode': None,
258258
'flavorKeyName': 'B1_1X2X25'},
259259
'operatingSystemReferenceCode': 'UBUNTU_LATEST',
260-
'networkComponents': [{'maxSpeed': '100'}]},)
260+
'networkComponents': [{'maxSpeed': 100}]},)
261261

262262
self.assert_called_with('SoftLayer_Virtual_Guest', 'generateOrderTemplate', args=args)
263263

@@ -351,21 +351,11 @@ def test_create_with_host_id(self, confirm_mock):
351351
'domain': 'example.com',
352352
'localDiskFlag': True,
353353
'hourlyBillingFlag': True,
354-
'supplementalCreateObjectOptions': {
355-
'bootMode': None
356-
},
357-
'dedicatedHost': {
358-
'id': 123
359-
},
354+
'supplementalCreateObjectOptions': {'bootMode': None},
355+
'dedicatedHost': {'id': 123},
360356
'operatingSystemReferenceCode': 'UBUNTU_LATEST',
361-
'datacenter': {
362-
'name': 'dal05'
363-
},
364-
'networkComponents': [
365-
{
366-
'maxSpeed': '100'
367-
}
368-
]
357+
'datacenter': {'name': 'dal05'},
358+
'networkComponents': [{'maxSpeed': 100}]
369359
},)
370360

371361
self.assert_called_with('SoftLayer_Virtual_Guest', 'generateOrderTemplate', args=template_args)

tests/api_tests.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,18 @@ def test_simple_call(self):
9696
offset=None,
9797
)
9898

99+
def test_simple_call_2(self):
100+
mock = self.set_mock('SoftLayer_SERVICE', 'METHOD')
101+
mock.return_value = {"test": "result"}
102+
103+
resp = self.client.call('SERVICE', 'METHOD', {'networkComponents': [{'maxSpeed': 100}]})
104+
105+
self.assertEqual(resp, {"test": "result"})
106+
self.assert_called_with('SoftLayer_SERVICE', 'METHOD',
107+
mask=None, filter=None, identifier=None,
108+
args=({'networkComponents': [{'maxSpeed': 100}]},), limit=None, offset=None,
109+
)
110+
99111
def test_verify_request_false(self):
100112
client = SoftLayer.BaseClient(transport=self.mocks)
101113
mock = self.set_mock('SoftLayer_SERVICE', 'METHOD')

0 commit comments

Comments
 (0)