summaryrefslogtreecommitdiff
path: root/suite/api_test.py
diff options
context:
space:
mode:
authorPeter LaFosse <peter@vector35.com>2022-02-01 11:31:35 -0500
committerPeter LaFosse <peter@vector35.com>2022-02-17 08:43:03 -0500
commit3e2fde191560413c4d19a240752974930e6c80db (patch)
tree357e976f9363dade0b165d3a165251e3b41e6d7b /suite/api_test.py
parent2e47077a2b32184f6b021abd01150a4c669b759d (diff)
Improve handling of bytes objects with Metadata
Diffstat (limited to 'suite/api_test.py')
-rw-r--r--suite/api_test.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/suite/api_test.py b/suite/api_test.py
index e6de3fa5..43196c44 100644
--- a/suite/api_test.py
+++ b/suite/api_test.py
@@ -311,7 +311,7 @@ class SettingsAPI(unittest.TestCase):
assert raw_view.get_load_settings(bvt_name) is None
-class MetaddataAPI(unittest.TestCase):
+class MetaddataAPI(TestWithBinaryView):
def test_metadata_basic_types(self):
# Core is tested thoroughly through the C++ unit tests here we focus on the python api side
md = Metadata(1)
@@ -395,6 +395,11 @@ class MetaddataAPI(unittest.TestCase):
assert Metadata({"a": 1, "b": 2}) != {"a": 1}
assert Metadata({"a": 1, "b": 2}) != Metadata({"a": 1})
+ def test_binaryview_storage(self):
+ data = b"some bytes\x00\xff\xff\xff\xfe\xff\xcd\xcc"
+ self.bv.store_metadata("SomeKey", data)
+ assert self.bv.query_metadata("SomeKey") == data
+ assert bytes(self.bv.query_metadata("SomeKey")) == data
class DemanglerTest(unittest.TestCase):
def get_type_string(self, t, n):