From 0dbb0c454c53785910c3d412f0c2af7d2264284c Mon Sep 17 00:00:00 2001 From: Arjan Zijderveld <5286904+arjanz@users.noreply.github.com> Date: Fri, 6 Oct 2023 16:59:59 +0200 Subject: [PATCH] Updated unit tests --- test/test_metadata.py | 5 ++++- test/test_runtime_call.py | 33 --------------------------------- 2 files changed, 4 insertions(+), 34 deletions(-) delete mode 100644 test/test_runtime_call.py diff --git a/test/test_metadata.py b/test/test_metadata.py index a259d7a..0adbb43 100644 --- a/test/test_metadata.py +++ b/test/test_metadata.py @@ -113,6 +113,7 @@ def test_metadata_registry_decode_v14(self): self.assertGreater(len(metadata_obj.get_signed_extensions().items()), 0) # Test runtime api + self.assertGreater(len(metadata_obj.get_runtime_apis()), 0) self.assertIsNotNone(metadata_obj.get_runtime_api('Core')) def test_metadata_registry_decode_v15(self): @@ -128,9 +129,11 @@ def test_metadata_registry_decode_v15(self): self.assertGreater(len(metadata_obj.get_signed_extensions().items()), 0) + # Test runtime api + self.assertGreater(len(metadata_obj.get_runtime_apis()), 0) self.assertIsNotNone(metadata_obj.get_runtime_api('Core')) - method = metadata_obj.get_runtime_api('AccountNonceApi').get_method('account_nonce') + self.assertIsNotNone(metadata_obj.get_runtime_api('AccountNonceApi').get_method('account_nonce')) # def test_pickle_test(self): diff --git a/test/test_runtime_call.py b/test/test_runtime_call.py deleted file mode 100644 index d891188..0000000 --- a/test/test_runtime_call.py +++ /dev/null @@ -1,33 +0,0 @@ -import unittest - -from scalecodec.base import RuntimeConfigurationObject -from scalecodec.type_registry import load_type_registry_preset - - -class RuntimeCallTestCase(unittest.TestCase): - - runtime_config: RuntimeConfigurationObject - - @classmethod - def setUpClass(cls): - cls.runtime_config = RuntimeConfigurationObject() - cls.runtime_config.clear_type_registry() - cls.runtime_config.update_type_registry(load_type_registry_preset("core")) - - def test_encode_runtime_calls(self): - for api, methods in self.runtime_config.type_registry["runtime_api"].items(): - - runtime_api_types = self.runtime_config.type_registry["runtime_api"][api].get("types", {}) - # Add runtime API types to registry - self.runtime_config.update_type_registry_types(runtime_api_types) - - for method, runtime_call in methods["methods"].items(): - runtime_call['api'] = api - runtime_call['method'] = method - - runtime_call_obj = self.runtime_config.create_scale_object("RuntimeCallDefinition") - runtime_call_obj.encode(runtime_call) - - self.assertEqual(runtime_call_obj.value['method'], method) - self.assertIn('params', runtime_call_obj.value) -