async def test_only_getting_e2e_conversation_tests_if_e2e_enabled( tmp_path: Path): from rasa.shared.core.training_data.structures import StoryGraph import rasa.shared.core.training_data.loading as core_loading config = {"imports": ["bots/Bot A"]} config_path = str(tmp_path / "config.yml") utils.dump_obj_as_yaml_to_file(config_path, config) story_file = tmp_path / "bots" / "Bot A" / "data" / "stories.yml" story_file.parent.mkdir(parents=True) rasa.shared.utils.io.write_text_file( """ stories: - story: story steps: - intent: greet - action: utter_greet """, story_file, ) test_story = """ stories: - story: story test steps: - user: hello intent: greet - action: utter_greet """ story_test_file = tmp_path / "bots" / "Bot A" / "test_stories.yml" rasa.shared.utils.io.write_text_file(test_story, story_test_file) selector = MultiProjectImporter(config_path) story_steps = await core_loading.load_data_from_resource( resource=str(story_test_file), domain=Domain.empty(), template_variables=None, use_e2e=True, exclusion_percentage=None, ) expected = StoryGraph(story_steps) actual = await selector.get_stories(use_e2e=True) assert expected.as_story_string() == actual.as_story_string()
def create_zip_file( nlu: TrainingData, domain: Domain, stories: StoryGraph, config: Dict, bot: Text ): """ adds training files to zip :param nlu: nlu data :param domain: domain data :param stories: stories data :param config: config data :param bot: bot id :return: None """ directory = Utility.save_files( nlu.nlu_as_markdown().encode(), domain.as_yaml().encode(), stories.as_story_string().encode(), yaml.dump(config).encode(), ) zip_path = os.path.join(tempfile.gettempdir(), bot) zip_file = shutil.make_archive(zip_path, format="zip", root_dir=directory) shutil.rmtree(directory) return zip_file