Skip to content

Commit

Permalink
Merge pull request #302 from valory-xyz/test/handlers
Browse files Browse the repository at this point in the history
Test/handlers
  • Loading branch information
Adamantios authored Jul 26, 2024
2 parents cdfed29 + 0a98eed commit 24c9932
Show file tree
Hide file tree
Showing 18 changed files with 833 additions and 26 deletions.
18 changes: 9 additions & 9 deletions packages/packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
"contract/valory/mech_activity/0.1.0": "bafybeiec6nnvfs6captlncrtjfygpp275vkfajvj4frrnab7thsca6337e",
"contract/valory/staking_token/0.1.0": "bafybeig4fl35dn7d5gnprux2nwsqbirm7zkiujz3xvrwcjuktz6hkq4as4",
"contract/valory/relayer/0.1.0": "bafybeihzgjyvhtorugjw3yldznqsbwo3aqpxowm7k2nrvj6qtwpsc7jl7u",
"skill/valory/market_manager_abci/0.1.0": "bafybeihuianzp5qrlxysdokrxzjrkt4pkruickdbzew5sngysel5obkwfm",
"skill/valory/decision_maker_abci/0.1.0": "bafybeifrmophhnc3dg6ii57im66wwkvglvec6bew5zqy2rhtrcnsx5vx5i",
"skill/valory/trader_abci/0.1.0": "bafybeihs25eobxugzytyoi7yy7f4srd3pp26dlx7k7jw3majqg4kwv7kti",
"skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeibyf7zwnvjbpk6nca7hj7mj7zxygr4j67jyq2vbk6gs22jwqma7eq",
"skill/valory/staking_abci/0.1.0": "bafybeiafzonb4h4ahn2n5mmbx4vtkckbylbzrxnr2gmrhhltw6xa35d6ve",
"skill/valory/check_stop_trading_abci/0.1.0": "bafybeieyw7kanelhv3dnbd5ypo26ivnyqfg3ueiqt6s4wkvoz3gvfisihe",
"agent/valory/trader/0.1.0": "bafybeia5e322is7dbiaao4x2zjfmiloijqjkffotljodrr2gjjnwb65e74",
"service/valory/trader/0.1.0": "bafybeibmp75hhxzt5w655jvulooiu44ibzrlkzqzp634fzcjzrf6scwlmi",
"service/valory/trader_pearl/0.1.0": "bafybeicffhnw4zj7qwxjanjrneqtwoglgwm4vpcu6drjjsts435tuit3be"
"skill/valory/market_manager_abci/0.1.0": "bafybeiai6djelf6d4dkxgkv46l24q2gz7736b3jdhbxslvcydpvnvrse6e",
"skill/valory/decision_maker_abci/0.1.0": "bafybeigykiciajiq5za7szupck5jbj6z6dvnmoufdam7eyigpn4mr6c6bq",
"skill/valory/trader_abci/0.1.0": "bafybeid23zogdrlauifqprlogztejgb2yl3ohcvqcat7nab2hgvez4bzru",
"skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeidcw2bzonvlgtyuv76zkutjs7qv5j4wgvi6azthqpyefds6i5cvdm",
"skill/valory/staking_abci/0.1.0": "bafybeiduborfqevheegy3plk7bzhkl4fukwixvlb57tenijdepintubbdi",
"skill/valory/check_stop_trading_abci/0.1.0": "bafybeiepylk35n3faurvp7dskjkdovehftzfjrjxfkpekzuaovt5gojxne",
"agent/valory/trader/0.1.0": "bafybeicdbgv3sricq6uafa6ps7rdjvqhelkbqktp5j4i6wzr2eetm4fn74",
"service/valory/trader/0.1.0": "bafybeiamvc7vbylrdgy5topv45bqailxjynxwq7xmhf4q3ly72prxyygqa",
"service/valory/trader_pearl/0.1.0": "bafybeigt6n7qc6mdh7gbdkqpkudm6khi25wks45mup73e45p2tf5vrvh2y"
},
"third_party": {
"protocol/open_aea/signing/1.0.0": "bafybeihv62fim3wl2bayavfcg3u5e5cxu3b7brtu4cn5xoxd6lqwachasi",
Expand Down
12 changes: 6 additions & 6 deletions packages/valory/agents/trader/aea-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ skills:
- valory/reset_pause_abci:0.1.0:bafybeiameewywqigpupy3u2iwnkfczeiiucue74x2l5lbge74rmw6bgaie
- valory/termination_abci:0.1.0:bafybeif2zim2de356eo3sipkmoev5emwadpqqzk3huwqarywh4tmqt3vzq
- valory/transaction_settlement_abci:0.1.0:bafybeic3tccdjypuge2lewtlgprwkbb53lhgsgn7oiwzyrcrrptrbeyote
- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeibyf7zwnvjbpk6nca7hj7mj7zxygr4j67jyq2vbk6gs22jwqma7eq
- valory/market_manager_abci:0.1.0:bafybeihuianzp5qrlxysdokrxzjrkt4pkruickdbzew5sngysel5obkwfm
- valory/decision_maker_abci:0.1.0:bafybeifrmophhnc3dg6ii57im66wwkvglvec6bew5zqy2rhtrcnsx5vx5i
- valory/trader_abci:0.1.0:bafybeihs25eobxugzytyoi7yy7f4srd3pp26dlx7k7jw3majqg4kwv7kti
- valory/staking_abci:0.1.0:bafybeiafzonb4h4ahn2n5mmbx4vtkckbylbzrxnr2gmrhhltw6xa35d6ve
- valory/check_stop_trading_abci:0.1.0:bafybeieyw7kanelhv3dnbd5ypo26ivnyqfg3ueiqt6s4wkvoz3gvfisihe
- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeidcw2bzonvlgtyuv76zkutjs7qv5j4wgvi6azthqpyefds6i5cvdm
- valory/market_manager_abci:0.1.0:bafybeiai6djelf6d4dkxgkv46l24q2gz7736b3jdhbxslvcydpvnvrse6e
- valory/decision_maker_abci:0.1.0:bafybeigykiciajiq5za7szupck5jbj6z6dvnmoufdam7eyigpn4mr6c6bq
- valory/trader_abci:0.1.0:bafybeid23zogdrlauifqprlogztejgb2yl3ohcvqcat7nab2hgvez4bzru
- valory/staking_abci:0.1.0:bafybeiduborfqevheegy3plk7bzhkl4fukwixvlb57tenijdepintubbdi
- valory/check_stop_trading_abci:0.1.0:bafybeiepylk35n3faurvp7dskjkdovehftzfjrjxfkpekzuaovt5gojxne
- valory/mech_interact_abci:0.1.0:bafybeih2cck5xu6yaibomwtm5zbcp6llghr3ighdnk56fzwu3ihu5xx35e
customs:
- valory/mike_strat:0.1.0:bafybeihjiol7f4ch4piwfikurdtfwzsh6qydkbsztpbwbwb2yrqdqf726m
Expand Down
2 changes: 1 addition & 1 deletion packages/valory/services/trader/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ license: Apache-2.0
fingerprint:
README.md: bafybeigtuothskwyvrhfosps2bu6suauycolj67dpuxqvnicdrdu7yhtvq
fingerprint_ignore_patterns: []
agent: valory/trader:0.1.0:bafybeia5e322is7dbiaao4x2zjfmiloijqjkffotljodrr2gjjnwb65e74
agent: valory/trader:0.1.0:bafybeicdbgv3sricq6uafa6ps7rdjvqhelkbqktp5j4i6wzr2eetm4fn74
number_of_agents: 4
deployment:
agent:
Expand Down
2 changes: 1 addition & 1 deletion packages/valory/services/trader_pearl/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ license: Apache-2.0
fingerprint:
README.md: bafybeibg7bdqpioh4lmvknw3ygnllfku32oca4eq5pqtvdrdsgw6buko7e
fingerprint_ignore_patterns: []
agent: valory/trader:0.1.0:bafybeia5e322is7dbiaao4x2zjfmiloijqjkffotljodrr2gjjnwb65e74
agent: valory/trader:0.1.0:bafybeicdbgv3sricq6uafa6ps7rdjvqhelkbqktp5j4i6wzr2eetm4fn74
number_of_agents: 1
deployment:
agent:
Expand Down
3 changes: 2 additions & 1 deletion packages/valory/skills/check_stop_trading_abci/skill.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ fingerprint:
payloads.py: bafybeidh5bqywun4chrbsci2xbcrnnzuys5sswxwbxq3yl2ksawi3xsi5q
rounds.py: bafybeigqkzikghmzjj2ceqrnvmiiagtris3livgvn6r5z5ossk73xcfqfy
tests/__init__.py: bafybeihv2cjk4va5bc5ncqtppqg2xmmxcro34bma36trtvk32gtmhdycxu
tests/test_handlers.py: bafybeigpmtx2hyunzn6nxk2x4bvvybek7jvuhbk34fqlj7fgfsszcoqhxy
tests/test_payloads.py: bafybeih7q7kdfxsf4ejxxqwjumwglfwwcrbqcjnuy42mkhnfwccxuhiviy
fingerprint_ignore_patterns: []
connections: []
Expand All @@ -24,7 +25,7 @@ contracts:
protocols: []
skills:
- valory/abstract_round_abci:0.1.0:bafybeiar2yhzxacfe3qqamqhaihtlcimquwedffctw55sowx6rac3cm3ui
- valory/staking_abci:0.1.0:bafybeiafzonb4h4ahn2n5mmbx4vtkckbylbzrxnr2gmrhhltw6xa35d6ve
- valory/staking_abci:0.1.0:bafybeiduborfqevheegy3plk7bzhkl4fukwixvlb57tenijdepintubbdi
behaviours:
main:
args: {}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2024 Valory AG
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ------------------------------------------------------------------------------
"""This module contains tests for the handlers for the check stop trading abci."""

from unittest.mock import MagicMock

import pytest
from aea.configurations.data_types import PublicId
from aea.skills.base import Handler

from packages.valory.skills.abstract_round_abci.handlers import ABCIRoundHandler
from packages.valory.skills.abstract_round_abci.handlers import (
ContractApiHandler as BaseContractApiHandler,
)
from packages.valory.skills.abstract_round_abci.handlers import (
HttpHandler as BaseHttpHandler,
)
from packages.valory.skills.abstract_round_abci.handlers import (
IpfsHandler as BaseIpfsHandler,
)
from packages.valory.skills.abstract_round_abci.handlers import (
LedgerApiHandler as BaseLedgerApiHandler,
)
from packages.valory.skills.abstract_round_abci.handlers import (
SigningHandler as BaseSigningHandler,
)
from packages.valory.skills.abstract_round_abci.handlers import (
TendermintHandler as BaseTendermintHandler,
)
from packages.valory.skills.check_stop_trading_abci.handlers import (
ABCICheckStopTradingHandler,
ContractApiHandler,
HttpHandler,
IpfsHandler,
LedgerApiHandler,
SigningHandler,
TendermintHandler,
)


@pytest.mark.parametrize(
"handler, base_handler",
[
(ABCICheckStopTradingHandler, ABCIRoundHandler),
(HttpHandler, BaseHttpHandler),
(SigningHandler, BaseSigningHandler),
(LedgerApiHandler, BaseLedgerApiHandler),
(ContractApiHandler, BaseContractApiHandler),
(TendermintHandler, BaseTendermintHandler),
(IpfsHandler, BaseIpfsHandler),
],
)
def test_handler(handler: Handler, base_handler: Handler) -> None:
"""Test that the 'handlers.py' of the CheckStopTradingAbci can be imported."""
handler = handler(
name="dummy_handler",
skill_context=MagicMock(skill_id=PublicId.from_str("dummy/skill:0.1.0")),
)

assert isinstance(handler, base_handler)
3 changes: 2 additions & 1 deletion packages/valory/skills/decision_maker_abci/skill.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ fingerprint:
tests/behaviours/dummy_strategy/dummy_strategy.py: bafybeig5e3xfr7gxsakfj4stbxqcwdiljl7klvgahkuwe3obzxgkg3qt2e
tests/behaviours/test_base.py: bafybeiagdrveenk62parzchxg2nd2krpzm2pflfv3p4gszjfpnv3r2kpf4
tests/conftest.py: bafybeidy5hw56kw5mxudnfbhvogofn6k4rqb4ux2bd45baedrrhmgyrude
tests/test_handlers.py: bafybeihpkgtjjm3uegpup6zkznpoaxqpu6kmp3ujiggrzbe73p5fzlq7im
tests/test_payloads.py: bafybeigsftkoc7ursy7okfznbwfiy3pk2kitndfgbn35ebbz4yoptkw3zy
utils/__init__.py: bafybeiazrfg3kwfdl5q45azwz6b6mobqxngxpf4hazmrnkhinpk4qhbbf4
utils/nevermined.py: bafybeigallaqxhqopznhjhefr6bukh4ojkz5vdtqyzod5dksshrf24fjgi
Expand All @@ -84,7 +85,7 @@ protocols:
- valory/http:1.0.0:bafybeifugzl63kfdmwrxwphrnrhj7bn6iruxieme3a4ntzejf6kmtuwmae
skills:
- valory/abstract_round_abci:0.1.0:bafybeiar2yhzxacfe3qqamqhaihtlcimquwedffctw55sowx6rac3cm3ui
- valory/market_manager_abci:0.1.0:bafybeihuianzp5qrlxysdokrxzjrkt4pkruickdbzew5sngysel5obkwfm
- valory/market_manager_abci:0.1.0:bafybeiai6djelf6d4dkxgkv46l24q2gz7736b3jdhbxslvcydpvnvrse6e
- valory/transaction_settlement_abci:0.1.0:bafybeic3tccdjypuge2lewtlgprwkbb53lhgsgn7oiwzyrcrrptrbeyote
- valory/mech_interact_abci:0.1.0:bafybeih2cck5xu6yaibomwtm5zbcp6llghr3ighdnk56fzwu3ihu5xx35e
behaviours:
Expand Down
Loading

0 comments on commit 24c9932

Please sign in to comment.