Skip to content

Commit

Permalink
add integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
Tawakalt committed Oct 20, 2023
1 parent ec92c75 commit f667920
Show file tree
Hide file tree
Showing 2 changed files with 106 additions and 0 deletions.
64 changes: 64 additions & 0 deletions data/test/test_integration/domain_with_null_active_loop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
version: "3.1"

intents:
- greet
- goodbye
- affirm
- deny
- mood_great
- mood_unhappy
- bot_challenge
- block

entities:
- account_type

slots:
account_type:
type: categorical
influence_conversation: true
values:
- savings
- checking
- credit
mappings:
- type: from_entity
entity: account_type
# uncomment below to make the story conflict happen
conditions:
- active_loop: null

responses:
utter_block_account:
- text: "your account has been blocked"

utter_checking:
- text: "checking account"

utter_credit:
- text: "credit account"

utter_nothing:
- text: "no account type was specified"

utter_goodbye:
- text: "Bye"

utter_iamabot:
- text: "I am a bot, powered by Rasa."

utter_greet:
- text: "Hey! How are you?"

utter_cheer_up:
- text: 'Here is something to cheer you up'

utter_did_that_help:
- text: Did that help you?

utter_happy:
- text: Great, carry on!

session_config:
session_expiration_time: 60
carry_over_slots_to_new_session: true
42 changes: 42 additions & 0 deletions tests/integration_tests/core/test_cli_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,45 @@ def test_rasa_validate_quiet_no_errors(
"you can use `rasa telemetry disable`." in output_text
assert "To learn more, check out"
"https://rasa.com/docs/rasa/telemetry/telemetry." in output_text


def test_rasa_validate_null_active_loop_no_errors(
run: Callable[..., RunResult], request: FixtureRequest
):
# Test captures the subprocess output for the command run
# and validates that the data in 'data/test/test_integration' throws no cli errors

test_data_dir = Path(request.config.rootdir, "data", "test", "test_integration")
test_config_dir = Path(request.config.rootdir, "data", "test_config")
source_file = (test_data_dir).absolute()
domain_file = (test_data_dir / "domain_with_null_active_loop.yml").absolute()
config_file = (test_config_dir / "config_unique_assistant_id.yml").absolute()
result = run(
"data",
"validate",
"--data",
str(source_file),
"-d",
str(domain_file),
"-c",
str(config_file),
)
assert result.ret == 0

stderr_text = str(result.stderr)
assert "INFO" in stderr_text
assert "Validating intents..." in stderr_text
assert "Validating utterances..." in stderr_text
assert "Story structure validation..." in stderr_text
assert "Validating utterances..." in stderr_text
assert "Considering all preceding turns for conflict analysis." in stderr_text
assert "No story structure conflicts found." in stderr_text

output_text = "".join(result.outlines)
assert "Rasa Open Source reports anonymous usage telemetry"
"to help improve the product" in output_text
assert "for all its users." in output_text
assert "If you'd like to opt-out,"
"you can use `rasa telemetry disable`." in output_text
assert "To learn more, check out"
"https://rasa.com/docs/rasa/telemetry/telemetry." in output_text

0 comments on commit f667920

Please sign in to comment.