From 8742b35b270834c03063509edf2b2bfdfff686d4 Mon Sep 17 00:00:00 2001 From: Antoine MAZEAS Date: Fri, 6 Dec 2024 16:52:46 +0100 Subject: [PATCH] [client] enum value as "type" in make_struct... Signed-off-by: Antoine MAZEAS --- pyobas/signatures/signature_type.py | 2 +- test/signatures/test_signature_type.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pyobas/signatures/signature_type.py b/pyobas/signatures/signature_type.py index b8b16ca..8b2c410 100644 --- a/pyobas/signatures/signature_type.py +++ b/pyobas/signatures/signature_type.py @@ -22,7 +22,7 @@ def __init__( # } def make_struct_for_matching(self, data): struct = { - "type": self.match_policy.match_type, + "type": self.match_policy.match_type.value, "data": data, } diff --git a/test/signatures/test_signature_type.py b/test/signatures/test_signature_type.py index 8fefadf..b90b01b 100644 --- a/test/signatures/test_signature_type.py +++ b/test/signatures/test_signature_type.py @@ -14,7 +14,7 @@ def test_make_struct_create_expected_struct_for_simple_sig_type(self): data = "just a simple string" simple_struct = simple_signature_type.make_struct_for_matching(data=data) - self.assertEqual(simple_struct.get("type"), MatchTypes.MATCH_TYPE_SIMPLE) + self.assertEqual(simple_struct.get("type"), MatchTypes.MATCH_TYPE_SIMPLE.value) self.assertEqual(simple_struct.get("data"), data) self.assertFalse("score" in simple_struct.keys()) @@ -30,7 +30,7 @@ def test_make_struct_create_expected_struct_for_fuzzy_sig_type(self): data = "just another simple string" simple_struct = fuzzy_signature_type.make_struct_for_matching(data=data) - self.assertEqual(simple_struct.get("type"), MatchTypes.MATCH_TYPE_FUZZY) + self.assertEqual(simple_struct.get("type"), MatchTypes.MATCH_TYPE_FUZZY.value) self.assertEqual(simple_struct.get("data"), data) self.assertEqual(simple_struct.get("score"), fuzzy_signature_type_score) @@ -48,7 +48,7 @@ def test_make_struct_create_expected_struct_for_fuzzy_sig_type_when_score_is_0( data = "just another simple string" simple_struct = fuzzy_signature_type.make_struct_for_matching(data=data) - self.assertEqual(simple_struct.get("type"), MatchTypes.MATCH_TYPE_FUZZY) + self.assertEqual(simple_struct.get("type"), MatchTypes.MATCH_TYPE_FUZZY.value) self.assertEqual(simple_struct.get("data"), data) self.assertEqual(simple_struct.get("score"), fuzzy_signature_type_score)