tests: add more tests for miners.
This commit is contained in:
@@ -96,7 +96,10 @@ class TestAPIBase(unittest.IsolatedAsyncioTestCase):
|
||||
commands = self.api.commands
|
||||
|
||||
for command in commands:
|
||||
with self.subTest(msg=f"{self.api_str} {command}"):
|
||||
with self.subTest(
|
||||
msg=f"Test of command success on {self.api_str} API with command={command}",
|
||||
command=command,
|
||||
):
|
||||
api_func = getattr(self.api, command)
|
||||
mock_send_bytes.return_value = self.get_success_value(command)
|
||||
try:
|
||||
|
||||
@@ -39,6 +39,39 @@ class MinersTest(unittest.TestCase):
|
||||
isinstance(miner, MINER_CLASSES[miner_model][miner_api])
|
||||
)
|
||||
|
||||
def test_miner_data_map_keys(self):
|
||||
keys = [
|
||||
"api_ver",
|
||||
"env_temp",
|
||||
"errors",
|
||||
"fan_psu",
|
||||
"fans",
|
||||
"fault_light",
|
||||
"fw_ver",
|
||||
"hashboards",
|
||||
"hashrate",
|
||||
"hostname",
|
||||
"is_mining",
|
||||
"mac",
|
||||
"model",
|
||||
"nominal_hashrate",
|
||||
"pools",
|
||||
"uptime",
|
||||
"wattage",
|
||||
"wattage_limit",
|
||||
]
|
||||
warnings.filterwarnings("ignore")
|
||||
for miner_model in MINER_CLASSES.keys():
|
||||
for miner_api in MINER_CLASSES[miner_model].keys():
|
||||
with self.subTest(
|
||||
msg=f"Data map key check of miner using model={miner_model}, api={miner_api}",
|
||||
miner_model=miner_model,
|
||||
miner_api=miner_api,
|
||||
):
|
||||
miner = MINER_CLASSES[miner_model][miner_api]("127.0.0.1")
|
||||
miner_keys = sorted(list(miner.data_locations.keys()))
|
||||
self.assertEqual(miner_keys, keys)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user