Skip to content

Commit

Permalink
Merge pull request #374 from DontShaveTheYak/develop
Browse files Browse the repository at this point in the history
Release v0.13.1
  • Loading branch information
shadycuz authored Nov 12, 2024
2 parents cf2cfaf + 4862f7e commit 26160d8
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 23 deletions.
24 changes: 12 additions & 12 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ mypy = "^1.0.0"
types-requests = "^2.28.11"
types-PyYAML = "^6.0.12"
cfn-lint = "1.18.4"
setuptools = {version = "75.3.0", python = ">=3.12"}
setuptools = {version = "75.4.0", python = ">=3.12"}

[tool.coverage.paths]
source = ["src", "*/site-packages"]
Expand Down
6 changes: 4 additions & 2 deletions src/cloud_radar/cf/unit/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
import ipaddress
import json
import re
from typing import TYPE_CHECKING, Any, Callable, Dict, List # noqa: I101
from functools import cache
from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional # noqa: I101

import requests

Expand All @@ -25,7 +26,7 @@
# The maps are a nested dictionary.
Mapping = Dict[str, Dict[str, Dict[str, Any]]]

REGION_DATA = None
REGION_DATA: Optional[List[dict]] = None


def base64(_t: "Template", value: Any) -> str:
Expand Down Expand Up @@ -877,6 +878,7 @@ def get_region_azs(region_name: str) -> List[str]:
raise Exception(f"Unable to find region {region_name}.")


@cache
def _fetch_region_data() -> List[dict]:
"""Fetchs Region JSON from URL.
Expand Down
17 changes: 9 additions & 8 deletions tests/test_cf/test_unit/test_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,21 +407,22 @@ def test_fetch_region_data(mocker):

mock_r = mock_post.return_value

mock_r.status_code = 200
mock_r.status_code = 500

result = functions._fetch_region_data()
functions._fetch_region_data()

assert result == "TestData"
mock_r.raise_for_status.assert_called()

mock_r.raise_for_status.assert_not_called()
# need to reset the mock
mock_r.reset_mock()

assert result == "TestData"
mock_r.status_code = 200

mock_r.status_code = 500
result = functions._fetch_region_data()

functions._fetch_region_data()
assert result == "TestData"

mock_r.raise_for_status.assert_called()
mock_r.raise_for_status.assert_not_called()


def test_import_value():
Expand Down

0 comments on commit 26160d8

Please sign in to comment.