-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
96 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -107,5 +107,5 @@ venv.bak/ | |
# mypy | ||
.mypy_cache/ | ||
|
||
# OSX specific files | ||
# macOS specific files | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import unittest | ||
from dapr.ext.workflow.util import getAddress | ||
from unittest.mock import patch | ||
|
||
from dapr.conf import settings | ||
|
||
|
||
class DaprWorkflowUtilTest(unittest.TestCase): | ||
|
||
def test_get_address_default(self): | ||
expected = f"{settings.DAPR_RUNTIME_HOST}:{settings.DAPR_GRPC_PORT}" | ||
self.assertEqual(expected, getAddress()) | ||
|
||
def test_get_address_with_constructor_arguments(self): | ||
self.assertEqual("test.com:5000", getAddress("test.com", "5000")) | ||
|
||
def test_get_address_with_partial_constructor_arguments(self): | ||
expected = f"{settings.DAPR_RUNTIME_HOST}:5000" | ||
self.assertEqual(expected, getAddress(port="5000")) | ||
|
||
expected = f"test.com:{settings.DAPR_GRPC_PORT}" | ||
self.assertEqual(expected, getAddress(host="test.com")) | ||
|
||
@patch.object(settings, "DAPR_GRPC_ENDPOINT", "https://domain1.com:5000") | ||
def test_get_address_with_constructor_arguments_and_env_variable(self): | ||
self.assertEqual("test.com:5000", getAddress("test.com", "5000")) | ||
|
||
@patch.object(settings, "DAPR_GRPC_ENDPOINT", "https://domain1.com:5000") | ||
def test_get_address_with_env_variable(self): | ||
self.assertEqual("https://domain1.com:5000", getAddress()) |