Skip to content

Commit

Permalink
fixed broker creation from config
Browse files Browse the repository at this point in the history
  • Loading branch information
tmbo committed Dec 4, 2019
1 parent 57a0253 commit d232b5e
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions tests/core/test_broker.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def test_pika_broker_from_config():
cfg = read_endpoint_config(
"data/test_endpoints/event_brokers/pika_endpoint.yml", "event_broker"
)
actual = EventBroker.from_endpoint_config(cfg)
actual = EventBroker.create(cfg)

assert isinstance(actual, PikaEventBroker)
assert actual.host == "localhost"
Expand All @@ -50,7 +50,7 @@ def test_pika_message_property_app_id(monkeypatch: MonkeyPatch):
def test_no_broker_in_config():
cfg = read_endpoint_config(DEFAULT_ENDPOINTS_FILE, "event_broker")

actual = EventBroker.from_endpoint_config(cfg)
actual = EventBroker.create(cfg)

assert actual is None

Expand All @@ -59,7 +59,7 @@ def test_sql_broker_from_config():
cfg = read_endpoint_config(
"data/test_endpoints/event_brokers/sql_endpoint.yml", "event_broker"
)
actual = EventBroker.from_endpoint_config(cfg)
actual = EventBroker.create(cfg)

assert isinstance(actual, SQLEventBroker)
assert actual.engine.name == "sqlite"
Expand All @@ -69,7 +69,7 @@ def test_sql_broker_logs_to_sql_db():
cfg = read_endpoint_config(
"data/test_endpoints/event_brokers/sql_endpoint.yml", "event_broker"
)
actual = EventBroker.from_endpoint_config(cfg)
actual = EventBroker.create(cfg)

assert isinstance(actual, SQLEventBroker)

Expand All @@ -89,7 +89,7 @@ def test_file_broker_from_config():
cfg = read_endpoint_config(
"data/test_endpoints/event_brokers/file_endpoint.yml", "event_broker"
)
actual = EventBroker.from_endpoint_config(cfg)
actual = EventBroker.create(cfg)

assert isinstance(actual, FileEventBroker)
assert actual.path == "rasa_event.log"
Expand All @@ -98,7 +98,7 @@ def test_file_broker_from_config():
def test_file_broker_logs_to_file(tmpdir):
fname = tmpdir.join("events.log").strpath

actual = EventBroker.from_endpoint_config(
actual = EventBroker.create(
EndpointConfig(**{"type": "file", "path": fname})
)

Expand All @@ -117,7 +117,7 @@ def test_file_broker_logs_to_file(tmpdir):
def test_file_broker_properly_logs_newlines(tmpdir):
fname = tmpdir.join("events.log").strpath

actual = EventBroker.from_endpoint_config(
actual = EventBroker.create(
EndpointConfig(**{"type": "file", "path": fname})
)

Expand All @@ -136,12 +136,12 @@ def test_file_broker_properly_logs_newlines(tmpdir):

def test_load_custom_broker_name():
config = EndpointConfig(**{"type": "rasa.core.brokers.file.FileProducer"})
assert EventBroker.from_endpoint_config(config)
assert EventBroker.create(config)


def test_load_non_existent_custom_broker_name():
config = EndpointConfig(**{"type": "rasa.core.brokers.my.MyProducer"})
assert EventBroker.from_endpoint_config(config) is None
assert EventBroker.create(config) is None


def test_kafka_broker_from_config():
Expand Down

0 comments on commit d232b5e

Please sign in to comment.