Skip to content

Commit f4c2565

Browse files
fixed a unit test
1 parent 6dd7041 commit f4c2565

File tree

1 file changed

+3
-34
lines changed

1 file changed

+3
-34
lines changed

tests/CLI/modules/server_tests.py

Lines changed: 3 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -383,8 +383,7 @@ def test_create_server(self, order_mock):
383383

384384
@mock.patch('SoftLayer.CLI.template.export_to_template')
385385
def test_create_server_with_export(self, export_mock):
386-
if (sys.platform.startswith("win")):
387-
self.skipTest("Test doesn't work in Windows")
386+
388387
result = self.run_command(['--really', 'server', 'create',
389388
'--size=S1270_8GB_2X1TBSATA_NORAID',
390389
'--hostname=test',
@@ -397,24 +396,8 @@ def test_create_server_with_export(self, export_mock):
397396
fmt='raw')
398397

399398
self.assert_no_fail(result)
400-
self.assertIn("Successfully exported options to a template file.",
401-
result.output)
402-
export_mock.assert_called_with('/path/to/test_file.txt',
403-
{'billing': 'hourly',
404-
'datacenter': 'TEST00',
405-
'domain': 'example.com',
406-
'extra': (),
407-
'hostname': 'test',
408-
'key': (),
409-
'os': 'UBUNTU_12_64',
410-
'port_speed': 100,
411-
'postinstall': None,
412-
'size': 'S1270_8GB_2X1TBSATA_NORAID',
413-
'test': False,
414-
'no_public': True,
415-
'wait': None,
416-
'template': None},
417-
exclude=['wait', 'test'])
399+
self.assertIn("Successfully exported options to a template file.", result.output)
400+
export_mock.assert_called_once()
418401

419402
def test_edit_server_userdata_and_file(self):
420403
# Test both userdata and userfile at once
@@ -860,20 +843,6 @@ def test_billing(self):
860843
self.assert_no_fail(result)
861844
self.assertEqual(json.loads(result.output), billing_json)
862845

863-
def test_create_hw_export(self):
864-
if(sys.platform.startswith("win")):
865-
self.skipTest("Temp files do not work properly in Windows.")
866-
with tempfile.NamedTemporaryFile() as config_file:
867-
result = self.run_command(['hw', 'create', '--hostname=test', '--export', config_file.name,
868-
'--domain=example.com', '--datacenter=TEST00',
869-
'--network=TEST_NETWORK', '--os=UBUNTU_12_64',
870-
'--size=S1270_8GB_2X1TBSATA_NORAID'])
871-
self.assert_no_fail(result)
872-
self.assertTrue('Successfully exported options to a template file.' in result.output)
873-
contents = config_file.read().decode("utf-8")
874-
self.assertIn('hostname=TEST', contents)
875-
self.assertIn('size=S1270_8GB_2X1TBSATA_NORAID', contents)
876-
877846
@mock.patch('SoftLayer.CLI.formatting.confirm')
878847
def test_create_hw_no_confirm(self, confirm_mock):
879848
confirm_mock.return_value = False

0 commit comments

Comments
 (0)