Skip to content

Commit

Permalink
updating first test to check for url
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Hopkins committed Nov 15, 2019
1 parent 8685726 commit b56a67b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions rasa/cli/x.py
Expand Up @@ -150,6 +150,8 @@ def _overwrite_endpoints_for_local_x(
if not endpoints.tracker_store or overwrite_existing_event_broker:
endpoints.event_broker = EndpointConfig(type="sql", db=DEFAULT_EVENTS_DB)

return endpoints


def _is_correct_event_broker(event_broker: EndpointConfig) -> bool:
return all(
Expand Down
10 changes: 10 additions & 0 deletions tests/cli/test_rasa_x.py
Expand Up @@ -9,6 +9,7 @@
import rasa.utils.io as io_utils
from rasa.cli import x
from rasa.utils.endpoints import EndpointConfig
from rasa.core.utils import AvailableEndpoints


def test_x_help(run: Callable[..., RunResult]):
Expand Down Expand Up @@ -79,6 +80,14 @@ def test_if_endpoint_config_is_invalid_in_local_mode(kwargs: Dict):
config = EndpointConfig(**kwargs)
assert not x._is_correct_event_broker(config)

def test_wait_time_between_pulls_custom():
#endpoint_config = EndpointConfig(url="http://localhost:5002/api/projects/default/models/tag/production", wait_time_between_pulls=3)
endpoint_config = EndpointConfig(url="http://testserver:5002/models/default@latest", wait_time_between_pulls=5)
endpoints = AvailableEndpoints(model=endpoint_config)

updated_endpoints = x._overwrite_endpoints_for_local_x(endpoints, "test", "http://localhost")
updated_config = updated_endpoints.model
assert updated_config.url == 'http://localhost/projects/default/models/tag/production'

async def test_pull_runtime_config_from_server():
config_url = "http://example.com/api/config?token=token"
Expand All @@ -99,6 +108,7 @@ async def test_pull_runtime_config_from_server():
endpoints_path, credentials_path = await x._pull_runtime_config_from_server(
config_url, 1, 0
)


with open(endpoints_path) as f:
assert f.read() == endpoint_config
Expand Down

0 comments on commit b56a67b

Please sign in to comment.