def test_is_canfulfill_intent_name_match():
    test_canfulfill_intent_name = "TestIntent"
    test_handler_input = HandlerInput(
        request_envelope=RequestEnvelope(request=CanFulfillIntentRequest(
            intent=Intent(name=test_canfulfill_intent_name))))

    canfulfill_intent_name_wrapper = is_canfulfill_intent_name(test_canfulfill_intent_name)
    assert canfulfill_intent_name_wrapper(
        test_handler_input), "is_canfulfill_intent_name matcher didn't match with the " \
                             "correct intent name"
def test_is_intent_not_match_canfulfill_intent():
    test_intent_name = "TestIntent"
    test_handler_input = HandlerInput(
        request_envelope=RequestEnvelope(request=IntentRequest(
            intent=Intent(name=test_intent_name))))

    canfulfill_intent_name_wrapper = is_canfulfill_intent_name(test_intent_name)
    assert not canfulfill_intent_name_wrapper(
        test_handler_input), "is_canfulfill_intent_name matcher matched with the " \
                             "incorrect request type"
Beispiel #3
0
 def can_handle(self, handler_input):
     return is_canfulfill_intent_name(self.handler_name)(handler_input)