Skip to content

Commit

Permalink
Testing azdev publish with AzureFirewall (#607)
Browse files Browse the repository at this point in the history
* Add tests. Fix static checks.

* Minor fixes.

* Bump version

* Update index.
  • Loading branch information
tjprescott authored Mar 28, 2019
1 parent ec5ae12 commit b56847f
Show file tree
Hide file tree
Showing 10 changed files with 326 additions and 20 deletions.
4 changes: 2 additions & 2 deletions src/azure-firewall/azext_firewall/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ def load_command_table(self, args):
load_command_table(self, args)
return self.command_table

def load_arguments(self, args):
def load_arguments(self, command):
from ._params import load_arguments
load_arguments(self, args)
load_arguments(self, command)


COMMAND_LOADER_CLS = AzureFirewallCommandsLoader
4 changes: 2 additions & 2 deletions src/azure-firewall/azext_firewall/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
# pylint: disable=line-too-long
import argparse

from knack.arguments import CLIArgumentType

from azure.cli.core.commands.parameters import (
get_resource_name_completion_list, tags_type, get_enum_type, get_location_type)
from azure.cli.core.commands.validators import get_default_location_from_resource_group

from knack.arguments import CLIArgumentType

from ._completers import get_af_subresource_completion_list
from ._validators import (
get_public_ip_validator, get_subnet_validator, validate_application_rule_protocols)
Expand Down
10 changes: 5 additions & 5 deletions src/azure-firewall/azext_firewall/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,19 @@
# --------------------------------------------------------------------------------------------

import sys
from knack.util import CLIError

from azure.cli.core.util import sdk_no_wait

from knack.util import CLIError

from ._client_factory import network_client_factory


def _get_property(items, name):
result = next((x for x in items if x.name.lower() == name.lower()), None)
if not result:
raise CLIError("Property '{}' does not exist".format(name))
else:
return result
return result


def _set_param(item, prop, value):
Expand Down Expand Up @@ -48,8 +49,7 @@ def get_func(cmd, resource_group_name, resource_name, item_name):
if not result:
raise CLIError("Item '{}' does not exist on {} '{}'".format(
item_name, resource, resource_name))
else:
return result
return result

func_name = 'get_network_resource_property_entry_{}_{}'.format(resource, prop)
setattr(sys.modules[__name__], func_name, get_func)
Expand Down
2 changes: 1 addition & 1 deletion src/azure-firewall/azext_firewall/_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def simple_validator(cmd, namespace):
# error if vnet-name is provided along with a subnet ID
if is_id and namespace.virtual_network_name:
raise usage_error
elif not is_id and not namespace.virtual_network_name:
if not is_id and not namespace.virtual_network_name:
raise usage_error

if not is_id:
Expand Down
3 changes: 1 addition & 2 deletions src/azure-firewall/azext_firewall/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ def _get_property(items, name):
result = next((x for x in items if x.name.lower() == name.lower()), None)
if not result:
raise CLIError("Property '{}' does not exist".format(name))
else:
return result
return result


def _upsert(parent, collection_name, obj_to_add, key_name, warn=True):
Expand Down
2 changes: 1 addition & 1 deletion src/azure-firewall/azext_firewall/tests/latest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
# --------------------------------------------------------------------------------------------

from azure.cli.core.profiles import register_resource_type
from ...profiles import CUSTOM_FIREWALL
from azext_firewall.profiles import CUSTOM_FIREWALL
register_resource_type('latest', CUSTOM_FIREWALL, '2018-08-01')

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from azure.cli.testsdk import (ScenarioTest, ResourceGroupPreparer, StorageAccountPreparer, JMESPathCheck, NoneCheck,
api_version_constraint)
from azure.cli.core.profiles import ResourceType
from ...profiles import CUSTOM_FIREWALL
from azext_firewall.profiles import CUSTOM_FIREWALL


class AzureFirewallScenario(ScenarioTest):
Expand All @@ -20,4 +20,7 @@ def test_azure_firewall(self, resource_group):
'rule1': 'rule1',
'rule2': 'rule2'
})
pass
self.cmd('network firewall create -g {rg} -n {af}')
self.cmd('network firewall show -g {rg} -n {af}')
self.cmd('network firewall list -g {rg}')
self.cmd('network firewall delete -g {rg} -n {af}')
2 changes: 1 addition & 1 deletion src/azure-firewall/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from codecs import open
from setuptools import setup, find_packages

VERSION = "0.1.1"
VERSION = "0.1.2"

CLASSIFIERS = [
'Development Status :: 4 - Beta',
Expand Down
8 changes: 4 additions & 4 deletions src/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -534,8 +534,8 @@
],
"azure-firewall": [
{
"downloadUrl": "https://azurecliprod.blob.core.windows.net/cli-extensions/azure_firewall-0.1.1-py2.py3-none-any.whl",
"filename": "azure_firewall-0.1.1-py2.py3-none-any.whl",
"downloadUrl": "https://azurecliprod.blob.core.windows.net/cli-extensions/azure_firewall-0.1.2-py2.py3-none-any.whl",
"filename": "azure_firewall-0.1.2-py2.py3-none-any.whl",
"metadata": {
"azext.isPreview": true,
"azext.minCliCoreVersion": "2.0.46",
Expand Down Expand Up @@ -574,9 +574,9 @@
"metadata_version": "2.0",
"name": "azure-firewall",
"summary": "Manage Azure Firewall resources.",
"version": "0.1.1"
"version": "0.1.2"
},
"sha256Digest": "f0e6114e5b4c08845a2ba0ea1d332d9f88d895ef122ef3a0fd2d960584b9feff"
"sha256Digest": "c6669dacba6a8d3c263e132237b58e39bc3749c44f174a10673f44e266205e1c"
}
],
"botservice": [
Expand Down

0 comments on commit b56847f

Please sign in to comment.