async def test_convo_params_are_cleared(async_kwik_e_mart_app, kwik_e_mart_app_path): """Tests that the params are cleared in one trip from app to mm.""" convo = Conversation(app=async_kwik_e_mart_app, app_path=kwik_e_mart_app_path) convo.params = Params( allowed_intents=['store_info.find_nearest_store'], target_dialogue_state='welcome') await convo.say('close door') assert convo.params == Params( previous_params=FrozenParams(allowed_intents=['store_info.find_nearest_store'], target_dialogue_state='welcome'))
def test_convo_params_are_cleared(kwik_e_mart_nlp, kwik_e_mart_app_path): """Tests that the params are cleared in one trip from app to mm.""" convo = Conversation(nlp=kwik_e_mart_nlp, app_path=kwik_e_mart_app_path) convo.params = Params(allowed_intents=['store_info.find_nearest_store'], target_dialogue_state='greeting') convo.say('close door') assert convo.params == Params( previous_params=FrozenParams( allowed_intents=('store_info.find_nearest_store', ), target_dialogue_state='greeting'), target_dialogue_state='send_store_hours_flow')
def test_immutability_of_sample_request_and_params(): """Test the immutability of the sample_request and params objects""" with pytest.raises(FrozenInstanceError): params = FrozenParams() params.allowed_intents = [] with pytest.raises(TypeError): params = FrozenParams() params.dynamic_resource["a"] = "b" with pytest.raises(FrozenInstanceError): request = Request() request.params = Params() with pytest.raises(TypeError): request = Request() request.frame["a"] = "b"