From ef31af865a7c0d8f6881fd48655c47495813d894 Mon Sep 17 00:00:00 2001 From: Daniel Carrillo Date: Fri, 19 Feb 2021 17:45:07 +0100 Subject: [PATCH 1/2] Fix test --- tests/test_get_aws_ip_ranges_json.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_get_aws_ip_ranges_json.py b/tests/test_get_aws_ip_ranges_json.py index 7c5d3d1..b6a919c 100644 --- a/tests/test_get_aws_ip_ranges_json.py +++ b/tests/test_get_aws_ip_ranges_json.py @@ -84,4 +84,5 @@ def test_get_aws_ip_ranges_invalid_status(mocker, fs, create_cache_dir) -> None: with pytest.raises(digaws.UnexpectedRequestException) as e: digaws.get_aws_ip_ranges() - assert e.startswith('Unexpected response from') + + assert e.match('^Unexpected response from') From 204ec8f9ffe2b9899e7176e154dc9d2140af8537 Mon Sep 17 00:00:00 2001 From: Daniel Carrillo Date: Fri, 19 Feb 2021 17:46:04 +0100 Subject: [PATCH 2/2] Return an empty array when there is no data for json output --- digaws/__init__.py | 2 +- digaws/digaws.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/digaws/__init__.py b/digaws/__init__.py index 04d93c0..74fc766 100644 --- a/digaws/__init__.py +++ b/digaws/__init__.py @@ -1,2 +1,2 @@ -__version__ = '1.0.3' +__version__ = '1.0.4' __description__ = 'Look up canonical information for AWS IP addresses and networks' diff --git a/digaws/digaws.py b/digaws/digaws.py index 8ed391f..6d0e511 100755 --- a/digaws/digaws.py +++ b/digaws/digaws.py @@ -127,8 +127,7 @@ class DigAWSPrettyPrinter: item_dict.update({'network_border_group': prefix['network_border_group']}) data.append(item_dict) - if data: - print(json.dumps(data, indent=2)) + print(json.dumps(data, indent=2)) class DigAWS():