def test_delete_session_entity_type(capsys):
    intent_ids = intent_management._get_intent_ids(PROJECT_ID,
                                                   INTENT_DISPLAY_NAME)

    for intent_id in intent_ids:
        intent_management.delete_intent(PROJECT_ID, intent_id)

    intent_management.list_intents(PROJECT_ID)
    out, _ = capsys.readouterr()

    assert INTENT_DISPLAY_NAME not in out

    intent_ids = intent_management._get_intent_ids(PROJECT_ID,
                                                   INTENT_DISPLAY_NAME)

    assert len(intent_ids) == 0
def test_delete_session_entity_type(capsys):
    intent_ids = intent_management._get_intent_ids(
        PROJECT_ID, INTENT_DISPLAY_NAME)

    for intent_id in intent_ids:
        intent_management.delete_intent(PROJECT_ID, intent_id)

    intent_management.list_intents(PROJECT_ID)
    out, _ = capsys.readouterr()

    assert INTENT_DISPLAY_NAME not in out

    intent_ids = intent_management._get_intent_ids(
        PROJECT_ID, INTENT_DISPLAY_NAME)

    assert len(intent_ids) == 0
def test_create_intent(capsys):
    intent_management.create_intent(PROJECT_ID, INTENT_DISPLAY_NAME,
                                    TRAINING_PHRASE_PARTS, MESSAGE_TEXTS)

    intent_ids = intent_management._get_intent_ids(PROJECT_ID,
                                                   INTENT_DISPLAY_NAME)

    assert len(intent_ids) == 1

    intent_management.list_intents(PROJECT_ID)

    out, _ = capsys.readouterr()

    assert INTENT_DISPLAY_NAME in out

    for message_text in MESSAGE_TEXTS:
        assert message_text in out
def test_create_intent(capsys):
    intent_management.create_intent(
        PROJECT_ID, INTENT_DISPLAY_NAME, TRAINING_PHRASE_PARTS,
        MESSAGE_TEXTS)

    intent_ids = intent_management._get_intent_ids(
        PROJECT_ID, INTENT_DISPLAY_NAME)

    assert len(intent_ids) == 1

    intent_management.list_intents(PROJECT_ID)

    out, _ = capsys.readouterr()

    assert INTENT_DISPLAY_NAME in out

    for message_text in MESSAGE_TEXTS:
        assert message_text in out