Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion SoftLayer/CLI/firewall/add.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
type=click.Choice(['vs', 'vlan', 'server']),
help='Firewall type',
required=True)
@click.option('--ha', '--high-availability',
@click.option('-ha', '--high-availability',
is_flag=True,
help='High available firewall option')
@environment.pass_env
Expand Down
22 changes: 14 additions & 8 deletions SoftLayer/fixtures/SoftLayer_Product_Package.py
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,7 @@
'itemCategory': {'categoryCode': 'Uplink Port Speeds'},
'prices': [{'id': 1122,
'hourlyRecurringFee': 0.0,
'recurringFee': 0.0,
'categories': [{'id': 26,
'name': 'Uplink Port Speeds',
'categoryCode': 'port_speed'}]}],
Expand All @@ -845,6 +846,7 @@
'itemCategory': {'categoryCode': 'Uplink Port Speeds'},
'prices': [{'id': 4477,
'hourlyRecurringFee': 0.0,
'recurringFee': 0.0,
'categories': [{'id': 26,
'name': 'Uplink Port Speeds',
'categoryCode': 'port_speed'}]}],
Expand All @@ -857,6 +859,7 @@
'itemCategory': {'categoryCode': 'RAM'},
'prices': [{'id': 1133,
'hourlyRecurringFee': 0.0,
'recurringFee': 0.0,
'categories': [{'id': 3,
'name': 'RAM',
'categoryCode': 'ram'}]}],
Expand All @@ -870,6 +873,7 @@
'itemCategory': {'categoryCode': 'Computing Instance'},
'prices': [{'id': 1007,
'hourlyRecurringFee': 0.0,
'recurringFee': 0.0,
'categories': [{'id': 80,
'name': 'Computing Instance',
'categoryCode': 'guest_core'}]}],
Expand All @@ -884,6 +888,7 @@
'prices': [{'id': 1144,
'locationGroupId': None,
'hourlyRecurringFee': 0.0,
'recurringFee': 0.0,
'categories': [{'id': 80,
'name': 'Computing Instance',
'categoryCode': 'guest_core'}]}],
Expand All @@ -898,6 +903,7 @@
'prices': [{'id': 332211,
'locationGroupId': 1,
'hourlyRecurringFee': 0.0,
'recurringFee': 0.0,
'categories': [{'id': 80,
'name': 'Computing Instance',
'categoryCode': 'guest_core'}]}],
Expand All @@ -908,7 +914,7 @@
'capacity': '1',
'description': '1 GB iSCSI Storage',
'itemCategory': {'categoryCode': 'iscsi'},
'prices': [{'id': 2222, 'hourlyRecurringFee': 0.0}],
'prices': [{'id': 2222, 'hourlyRecurringFee': 0.0, 'recurringFee': 0.0}],
},
{
'id': 1121,
Expand All @@ -924,55 +930,55 @@
'capacity': '4',
'description': '4 Portable Public IP Addresses',
'itemCategory': {'categoryCode': 'sov_sec_ip_addresses_pub'},
'prices': [{'id': 4444, 'hourlyRecurringFee': 0.0}],
'prices': [{'id': 4444, 'hourlyRecurringFee': 0.0, 'recurringFee': 0.0}],
},
{
'id': 8880,
'keyName': 'KeyName0199',
'capacity': '8',
'description': '8 Portable Public IP Addresses',
'itemCategory': {'categoryCode': 'sov_sec_ip_addresses_pub'},
'prices': [{'id': 8888, 'hourlyRecurringFee': 0.0}],
'prices': [{'id': 8888, 'hourlyRecurringFee': 0.0, 'recurringFee': 0.0}],
},
{
'id': 44400,
'keyName': 'KeyName0155',
'capacity': '4',
'description': '4 Portable Private IP Addresses',
'itemCategory': {'categoryCode': 'sov_sec_ip_addresses_priv'},
'prices': [{'id': 44441, 'hourlyRecurringFee': 0.0}],
'prices': [{'id': 44441, 'hourlyRecurringFee': 0.0, 'recurringFee': 0.0}],
},
{
'id': 88800,
'keyName': 'KeyName0144',
'capacity': '8',
'description': '8 Portable Private IP Addresses',
'itemCategory': {'categoryCode': 'sov_sec_ip_addresses_priv'},
'prices': [{'id': 88881, 'hourlyRecurringFee': 0.0}],
'prices': [{'id': 88881, 'hourlyRecurringFee': 0.0, 'recurringFee': 0.0}],
},
{
'id': 10,
'keyName': 'KeyName0341',
'capacity': '0',
'description': 'Global IPv4',
'itemCategory': {'categoryCode': 'global_ipv4'},
'prices': [{'id': 11, 'hourlyRecurringFee': 0.0}],
'prices': [{'id': 11, 'hourlyRecurringFee': 0.0, 'recurringFee': 0.0}],
},
{
'id': 66464,
'keyName': 'KeyName0211',
'capacity': '64',
'description': '/64 Block Portable Public IPv6 Addresses',
'itemCategory': {'categoryCode': 'static_ipv6_addresses'},
'prices': [{'id': 664641, 'hourlyRecurringFee': 0.0}],
'prices': [{'id': 664641, 'hourlyRecurringFee': 0.0, 'recurringFee': 0.0}],
},
{
'id': 610,
'keyName': 'KeyName031',
'capacity': '0',
'description': 'Global IPv6',
'itemCategory': {'categoryCode': 'global_ipv6'},
'prices': [{'id': 611, 'hourlyRecurringFee': 0.0}],
'prices': [{'id': 611, 'hourlyRecurringFee': 0.0, 'recurringFee': 0.0}],
}]

getItemPricesISCSI = [
Expand Down
22 changes: 22 additions & 0 deletions tests/CLI/modules/firewall_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
:license: MIT, see LICENSE for more details.
"""
import json
from unittest import mock

from SoftLayer import testing

Expand All @@ -28,3 +29,24 @@ def test_list_firewalls(self):
'firewall id': 'server:1234',
'server/vlan id': 1,
'type': 'Server - standard'}])

@mock.patch('SoftLayer.CLI.formatting.confirm')
def test_add_vs(self, confirm_mock):
confirm_mock.return_value = True
result = self.run_command(['firewall', 'add', '1000', '--firewall-type=vlan', '-ha'])
self.assert_no_fail(result)
self.assertIn("Firewall is being created!", result.output)

@mock.patch('SoftLayer.CLI.formatting.confirm')
def test_add_vlan(self, confirm_mock):
confirm_mock.return_value = True
result = self.run_command(['firewall', 'add', '1000', '--firewall-type=vs'])
self.assert_no_fail(result)
self.assertIn("Firewall is being created!", result.output)

@mock.patch('SoftLayer.CLI.formatting.confirm')
def test_add_server(self, confirm_mock):
confirm_mock.return_value = True
result = self.run_command(['firewall', 'add', '1000', '--firewall-type=server'])
self.assert_no_fail(result)
self.assertIn("Firewall is being created!", result.output)