Skip to content

Commit

Permalink
fix mypy and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
1101-1 committed Dec 4, 2024
1 parent 8aa9056 commit 505ddb2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions plugins/gcp/test/test_collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ def all_base_classes(cls: Type[Any]) -> Set[Type[Any]]:
expected_declared_properties = ["kind", "_kind_display"]
expected_props_in_hierarchy = ["_kind_service", "_metadata"]
for rc in all_resources:
if not rc._model_export:
continue
for prop in expected_declared_properties:
assert prop in rc.__dict__, f"{rc.__name__} missing {prop}"
with_bases = (all_base_classes(rc) | {rc}) - {GcpResource, BaseResource}
Expand Down
8 changes: 4 additions & 4 deletions plugins/gcp/test/test_scc.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@
from .random_client import roundtrip


class DefaultDict(dict):
# for random location name we use the default global location
def __init__(self, default_value: Any, *args, **kwargs):
class DefaultDict(dict): # type: ignore
def __init__(self, default_value: Any, *args: Any, **kwargs: Any):
super().__init__(*args, **kwargs)
self.default_value = default_value

def get(self, key, default=None):
def get(self, key: str, default: Any = None):
if key in self:
return super().get(key, default)
return self.default_value


def test_gcp_scc_findings(random_builder: GraphBuilder) -> None:
firewall = roundtrip(GcpFirewall, random_builder)
# for random location name we will use the default global location
random_builder.region_by_name = DefaultDict(random_builder.fallback_global_region)
GcpSccFinding.collect_resources(random_builder)

Expand Down

0 comments on commit 505ddb2

Please sign in to comment.