Skip to content

Commit 5a046cb

Browse files
author
Fernando Ojeda
committed
Add unit test.
1 parent ac7465f commit 5a046cb

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

tests/managers/hardware_tests.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,52 @@ def test_generate_create_dict_no_regions(self):
309309
self.assertIn("Could not find valid location for: 'wdc01'", str(ex))
310310

311311
def test_generate_create_dict(self):
312+
args = {
313+
'size': 'S1270_8GB_2X1TBSATA_NORAID',
314+
'hostname': 'unicorn',
315+
'domain': 'giggles.woo',
316+
'location': 'wdc07',
317+
'os': 'OS_UBUNTU_14_04_LTS_TRUSTY_TAHR_64_BIT',
318+
'port_speed': 10,
319+
'hourly': True,
320+
'extras': ['1_IPV6_ADDRESS'],
321+
'post_uri': 'http://example.com/script.php',
322+
'ssh_keys': [10],
323+
}
324+
325+
package = 'BARE_METAL_SERVER'
326+
location = 'wdc07'
327+
item_keynames = [
328+
'1_IP_ADDRESS',
329+
'UNLIMITED_SSL_VPN_USERS_1_PPTP_VPN_USER_PER_ACCOUNT',
330+
'REBOOT_KVM_OVER_IP',
331+
'OS_UBUNTU_14_04_LTS_TRUSTY_TAHR_64_BIT',
332+
'BANDWIDTH_0_GB_2',
333+
'10_MBPS_PUBLIC_PRIVATE_NETWORK_UPLINKS',
334+
'1_IPV6_ADDRESS'
335+
]
336+
hourly = True
337+
preset_keyname = 'S1270_8GB_2X1TBSATA_NORAID'
338+
extras = {
339+
'hardware': [{
340+
'domain': 'giggles.woo',
341+
'hostname': 'unicorn',
342+
}],
343+
'provisionScripts': ['http://example.com/script.php'],
344+
'sshKeys': [{'sshKeyIds': [10]}]
345+
}
346+
347+
data = self.hardware._generate_create_dict(**args)
348+
349+
self.assertEqual(package, data['package_keyname'])
350+
self.assertEqual(location, data['location'])
351+
for keyname in item_keynames:
352+
self.assertIn(keyname, data['item_keynames'])
353+
self.assertEqual(extras, data['extras'])
354+
self.assertEqual(preset_keyname, data['preset_keyname'])
355+
self.assertEqual(hourly, data['hourly'])
356+
357+
def test_generate_create_dict_by_router_network_component(self):
312358
args = {
313359
'size': 'S1270_8GB_2X1TBSATA_NORAID',
314360
'hostname': 'unicorn',

0 commit comments

Comments
 (0)