Skip to content

Commit

Permalink
fix: allow source to be string and enum (#256)
Browse files Browse the repository at this point in the history
* allowing both BlobSource and string source values

* add test

* using isinstance, removed extra if check

* mypy fix

---------

Co-authored-by: Victoria Hall <[email protected]>
  • Loading branch information
hallvictoria and Victoria Hall authored Oct 9, 2024
1 parent c0e1748 commit 5f656ad
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion azure/functions/decorators/blob.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ def __init__(self,
**kwargs):
self.path = path
self.connection = connection
self.source = source.value if source else None
if isinstance(source, BlobSource):
self.source = source.value
else:
self.source = source # type: ignore
super().__init__(name=name, data_type=data_type)

@staticmethod
Expand Down
2 changes: 1 addition & 1 deletion tests/decorators/test_blob.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def test_blob_trigger_creation_with_source_as_string(self):
trigger = BlobTrigger(name="req",
path="dummy_path",
connection="dummy_connection",
source=BlobSource.EVENT_GRID,
source="EventGrid",
data_type=DataType.UNDEFINED,
dummy_field="dummy")

Expand Down

0 comments on commit 5f656ad

Please sign in to comment.