tests: Update tests, and fix some bugs.
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
# limitations under the License. -
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
from tests.api_tests import *
|
||||
from tests.rpc_tests import *
|
||||
from tests.config_tests import TestConfig
|
||||
from tests.miners_tests import MinersTest
|
||||
from tests.network_tests import NetworkTest
|
||||
|
||||
@@ -128,9 +128,9 @@ class TestConfig(unittest.TestCase):
|
||||
def test_am_modern_serialize(self):
|
||||
correct_config = {
|
||||
"bitmain-fan-ctrl": True,
|
||||
"bitmain-fan-pwn": "90",
|
||||
"bitmain-fan-pwm": "90",
|
||||
"freq-level": "100",
|
||||
"miner-mode": "0",
|
||||
"miner-mode": 0,
|
||||
"pools": [
|
||||
{
|
||||
"url": "stratum+tcp://stratum.test.io:3333",
|
||||
|
||||
35
tests/config_tests/fans.py
Normal file
35
tests/config_tests/fans.py
Normal file
@@ -0,0 +1,35 @@
|
||||
import unittest
|
||||
|
||||
from pyasic.config import FanModeConfig
|
||||
|
||||
|
||||
class TestFanConfig(unittest.TestCase):
|
||||
def test_serialize_and_deserialize(self):
|
||||
for fan_mode in FanModeConfig:
|
||||
with self.subTest(
|
||||
msg=f"Test serialization and deserialization of fan config",
|
||||
fan_mode=fan_mode,
|
||||
):
|
||||
conf = fan_mode()
|
||||
dict_conf = conf.as_dict()
|
||||
self.assertEqual(conf, FanModeConfig.from_dict(dict_conf))
|
||||
|
||||
def test_bosminer_deserialize_and_serialize(self):
|
||||
for fan_mode in FanModeConfig:
|
||||
with self.subTest(
|
||||
msg=f"Test serialization and deserialization of bosminer fan config",
|
||||
fan_mode=fan_mode,
|
||||
):
|
||||
conf = fan_mode()
|
||||
bos_conf = conf.as_bosminer()
|
||||
self.assertEqual(conf, FanModeConfig.from_bosminer(bos_conf))
|
||||
|
||||
def test_am_modern_deserialize_and_serialize(self):
|
||||
for fan_mode in FanModeConfig:
|
||||
with self.subTest(
|
||||
msg=f"Test serialization and deserialization of antminer modern fan config",
|
||||
fan_mode=fan_mode,
|
||||
):
|
||||
conf = fan_mode()
|
||||
am_conf = conf.as_am_modern()
|
||||
self.assertEqual(conf, FanModeConfig.from_am_modern(am_conf))
|
||||
Reference in New Issue
Block a user