1+ # -*- coding: utf-8 -*-
2+ # ------------------------------------------------------------------------------
3+ #
4+ # Copyright 2023 {{author}}
5+ # Copyright 2023 valory-xyz
6+ #
7+ # Licensed under the Apache License, Version 2.0 (the "License");
8+ # you may not use this file except in compliance with the License.
9+ # You may obtain a copy of the License at
10+ #
11+ # http://www.apache.org/licenses/LICENSE-2.0
12+ #
13+ # Unless required by applicable law or agreed to in writing, software
14+ # distributed under the License is distributed on an "AS IS" BASIS,
15+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+ # See the License for the specific language governing permissions and
17+ # limitations under the License.
18+ #
19+ # ------------------------------------------------------------------------------
20+
21+ """This package contains a behaviour test that is autogenerated from the protocol `{{protocol_name}}`."""
22+
23+ import json
24+ import logging
25+ from typing import cast
26+ from pathlib import Path
27+ from unittest.mock import patch
28+ import pytest
29+
30+ from aea.test_tools.test_skill import BaseSkillTestCase
31+ from aea.protocols.dialogue.base import DialogueMessage
32+
33+ from packages.{{public_id.author}}.skills.{{public_id.name}} import PUBLIC_ID
34+ from packages.{{public_id.author}}.skills.{{public_id.name}}.behaviours import (
35+ {{class_name}}FsmBehaviour,
36+ )
37+
38+ ROOT_DIR = Path(__file__).parent.parent.parent.parent.parent.parent
39+
40+
41+ class BaseTestCase(BaseSkillTestCase):
42+ """Base test case for the fsm."""
43+
44+ path_to_skill = Path(ROOT_DIR, "packages", PUBLIC_ID.author, "skills", PUBLIC_ID.name)
45+
46+ {% for state in states %}
47+ class Test{{state}}Act(BaseSkillTestCase):
48+ """Test {{state}}."""
49+ round_class = {{class_name}}FsmBehaviour.{{state}}
50+
51+ def test_act(self):
52+ """Test the act method of the round."""
53+ round = self.round_class(name="test", skill_context=self.skill.skill_context)
54+ round.act()
55+ assert round.is_done()
56+ {% endfor %}
0 commit comments