Skip to content

Commit

Permalink
add support for special case
Browse files Browse the repository at this point in the history
  • Loading branch information
pinzon committed Nov 22, 2024
1 parent 08f6506 commit f96e699
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ format: venv ## Run ruff and black to format the whole codebase
($(VENV_RUN); python -m ruff check --output-format=full --fix .; python -m black .)

lint: venv ## Run code linter to check code style and check if formatter would make changes
($(VENV_RUN); python -m ruff check --show-source . && python -m black --check .)
($(VENV_RUN); python -m ruff check --show-files . && python -m black --check .)

install: venv
$(VENV_RUN); $(PIP_CMD) install -e ".[test,dev]"
Expand Down
2 changes: 2 additions & 0 deletions aws_json_term_matcher/matcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ def compare(self, entity_value, comparator, value):
return value.ip_is_in_range(entity_value)

if comparator_value == "=":
if value == "*" and entity_value is not None:
return True
return entity_value == value
elif comparator_value == "!=":
return entity_value != value
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "aws-json-term-matcher"
version = "0.1.4"
version = "0.1.5"
authors = [
{ name = 'Cristopher Pinzon', email = '[email protected]' }
]
Expand Down
2 changes: 2 additions & 0 deletions tests/test_matcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@
'{ ($.detail-type = "ShopUnavailable") && (($.resources[1] = "arn:aws:states:us-east-1:111222333444:execution:OrderProcessorWorkflow:d57d4769-72fd") || ($.resources[0] = "arn:aws:states:us-east-1:111222333444:execution:OrderProcessorWorkflow:d57d4769-72fd"))}',
True,
),
# Special cases
('{$.eventType = "*"}', True),
]


Expand Down

0 comments on commit f96e699

Please sign in to comment.