Esempio n. 1
0
def test_answer_question():
    response = handler(REQUEST_ANSWER, None)
    assert response
    assert (
        response["session_state"]["question_type"] == "attention"
    )  # Сохранили тип вопроса
    assert "Верно" in response["response"]["text"]
Esempio n. 2
0
def test_tour_repeat():
    response = handler(REQUEST_REPEAT, None)
    assert (
        "Прислонившись спиной к колонне с открытой книгой в руках стоит князь Ярослав Мудрый"
        in response["response"]["text"])
    assert response["user_state_update"]["tour_id"] == 1
    assert response["user_state_update"]["tour_level"] == 0
Esempio n. 3
0
def test_play_game():
    response = handler(REQUEST, None)

    # 1. В качестве сцены должны установить старт викторины
    assert response["session_state"]["scene"] == "StartGame"

    # Должены быть кнопки с типами вопросов
    button_titles = "\n".join(
        b["title"] for b in response["response"]["buttons"]).lower()
    assert "простой" in button_titles
Esempio n. 4
0
def test_welcome():
    response = handler(INITIAL_REQUEST, None)

    # 1. В качестве сцены должны установить начальную
    assert response["session_state"]["scene"] == "Welcome"

    # 2. Среди сценариев должны быть викторина и экскурсия
    button_titles = "\n".join(
        b["title"] for b in response["response"]["buttons"]
    ).lower()
    assert "экскурс" in button_titles
    assert "викторин" in button_titles

    # 3. Навык должен рассказывать о своих возможностях
    assert "я могу" in response["response"]["text"].lower()
Esempio n. 5
0
def test_accept():
    response = handler(REQUEST_ACCEPT, None)
    assert response
    assert "Задаю простой вопрос" in response["response"]["text"]
Esempio n. 6
0
def test_play_game():
    response = handler(REQUEST, None)
    assert response
    assert "Задаю простой вопрос" in response["response"]["text"]
Esempio n. 7
0
def test_debug():
    response = handler(REQUEST, None)
    assert response["session_state"]["scene"] == "Debug"
Esempio n. 8
0
def test_tour_end():
    response = handler(REQUEST_END, None)
    assert "На этом наша экскурсия закончена" in response["response"]["text"]
Esempio n. 9
0
def test_tour_return():
    response = handler(REQUEST_RETURN, None)
    assert "В прошлый раз Вы" in response["response"]["text"]
Esempio n. 10
0
def test_tour_start():
    response = handler(REQUEST_START, None)
    assert "Я готова начать" in response["response"]["text"]
Esempio n. 11
0
def test_who_is_to_tour():
    response = handler(REQUEST_RETURN_TOUR, None)
    assert response["session_state"]["scene"] == "TourStep"
Esempio n. 12
0
def test_who_is_end():
    response = handler(REQUEST_RETURN, None)
    assert response["session_state"]["scene"] == "StartGame"
Esempio n. 13
0
def test_who_is():
    response = handler(REQUEST, None)
    assert response["session_state"]["scene"] == "WhoIs"
    assert response["session_state"]["previous"] == "StartGame"
Esempio n. 14
0
def test_who_is_dont_know():
    response = handler(REQUEST_DONT_KNOW, None)
    assert response["session_state"]["scene"] == "WhoIs"
Esempio n. 15
0
def test_fallback():
    response = handler(REQUEST, None)
    assert response
    assert "Извините" in response["response"]["text"]
    assert "question_type" in response["session_state"]