def test_answer_question(): response = handler(REQUEST_ANSWER, None) assert response assert ( response["session_state"]["question_type"] == "attention" ) # Сохранили тип вопроса assert "Верно" in response["response"]["text"]
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
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
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()
def test_accept(): response = handler(REQUEST_ACCEPT, None) assert response assert "Задаю простой вопрос" in response["response"]["text"]
def test_play_game(): response = handler(REQUEST, None) assert response assert "Задаю простой вопрос" in response["response"]["text"]
def test_debug(): response = handler(REQUEST, None) assert response["session_state"]["scene"] == "Debug"
def test_tour_end(): response = handler(REQUEST_END, None) assert "На этом наша экскурсия закончена" in response["response"]["text"]
def test_tour_return(): response = handler(REQUEST_RETURN, None) assert "В прошлый раз Вы" in response["response"]["text"]
def test_tour_start(): response = handler(REQUEST_START, None) assert "Я готова начать" in response["response"]["text"]
def test_who_is_to_tour(): response = handler(REQUEST_RETURN_TOUR, None) assert response["session_state"]["scene"] == "TourStep"
def test_who_is_end(): response = handler(REQUEST_RETURN, None) assert response["session_state"]["scene"] == "StartGame"
def test_who_is(): response = handler(REQUEST, None) assert response["session_state"]["scene"] == "WhoIs" assert response["session_state"]["previous"] == "StartGame"
def test_who_is_dont_know(): response = handler(REQUEST_DONT_KNOW, None) assert response["session_state"]["scene"] == "WhoIs"
def test_fallback(): response = handler(REQUEST, None) assert response assert "Извините" in response["response"]["text"] assert "question_type" in response["session_state"]