mirror of
https://github.com/ghndrx/prowler.git
synced 2026-02-10 23:05:05 +00:00
fix(version): execute check current version function only when -v (#2263)
This commit is contained in:
@@ -6,6 +6,7 @@ from prowler.config.config import check_current_version
|
||||
from prowler.providers.aws.aws_provider import get_aws_available_regions
|
||||
|
||||
MOCK_PROWLER_VERSION = "3.3.0"
|
||||
MOCK_OLD_PROWLER_VERSION = "0.0.0"
|
||||
|
||||
|
||||
def mock_prowler_get_latest_release(_):
|
||||
@@ -25,10 +26,16 @@ class Test_Config:
|
||||
@mock.patch("prowler.config.config.prowler_version", new=MOCK_PROWLER_VERSION)
|
||||
def test_check_current_version_with_latest(self):
|
||||
assert (
|
||||
check_current_version(MOCK_PROWLER_VERSION)
|
||||
== "(it is the latest version, yay!)"
|
||||
check_current_version()
|
||||
== f"Prowler {MOCK_PROWLER_VERSION} (it is the latest version, yay!)"
|
||||
)
|
||||
|
||||
@mock.patch(
|
||||
"prowler.config.config.requests.get", new=mock_prowler_get_latest_release
|
||||
)
|
||||
@mock.patch("prowler.config.config.prowler_version", new=MOCK_OLD_PROWLER_VERSION)
|
||||
def test_check_current_version_with_old(self):
|
||||
assert (
|
||||
check_current_version("0.0.0")
|
||||
== f"(latest is {MOCK_PROWLER_VERSION}, upgrade for the latest features)"
|
||||
check_current_version()
|
||||
== f"Prowler {MOCK_OLD_PROWLER_VERSION} (latest is {MOCK_PROWLER_VERSION}, upgrade for the latest features)"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user