From 663281ecccbecae30782115683d29f3d52671917 Mon Sep 17 00:00:00 2001 From: Rebecca Graber Date: Tue, 8 Aug 2023 08:20:09 -0400 Subject: [PATCH] fixup!: changes from review --- CHANGELOG.rst | 2 +- openedx_events/data.py | 12 ++++++------ openedx_events/tests/test_data.py | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index cf58d373..4c744ee5 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -14,7 +14,7 @@ Change Log Unreleased ---------- -[8.5.0] - 2023-06-08 +[8.5.0] - 2023-08-08 -------------------- Changed ~~~~~~~ diff --git a/openedx_events/data.py b/openedx_events/data.py index da645289..9ca6730b 100644 --- a/openedx_events/data.py +++ b/openedx_events/data.py @@ -86,9 +86,9 @@ class EventsMetadata: validator=attr.validators.instance_of(tuple), ) - def as_json(self): + def as_json_data(self): """ - Convert instance to json-compatible dictionary. + Returns a json-compatible dictionary of the instance. """ def value_serializer(inst, field, value): # pylint: disable="unused-argument" if isinstance(value, UUID): @@ -99,14 +99,14 @@ def value_serializer(inst, field, value): # pylint: disable="unused-argument" return value return attrs.asdict(self, value_serializer=value_serializer) - def as_json_string(self): + def as_json(self): """ - Convert instance to json string. + Serialize instance to json string. """ - return json.dumps(self.as_json()) + return json.dumps(self.as_json_data()) @classmethod - def from_json_string(cls, json_string): + def from_json(cls, json_string): """ Create an instance from a json string. diff --git a/openedx_events/tests/test_data.py b/openedx_events/tests/test_data.py index be7286b8..04f4f7ad 100644 --- a/openedx_events/tests/test_data.py +++ b/openedx_events/tests/test_data.py @@ -23,6 +23,6 @@ def setUp(self) -> None: ) def test_events_metadata_to_and_from_json(self): - as_json = self.metadata.as_json_string() - from_json = EventsMetadata.from_json_string(as_json) + as_json = self.metadata.as_json() + from_json = EventsMetadata.from_json(as_json) self.assertEqual(self.metadata, from_json)