Skip to content

Commit

Permalink
Fix issue generating task to write AuditLog for Edge Identity Overrid…
Browse files Browse the repository at this point in the history
…es (#2119)

* Use simplejson

* Add unit test

* pip-compile using 3.11
  • Loading branch information
matthewelwell committed Apr 13, 2023
1 parent 9208a4d commit 25db9b0
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions api/requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,4 @@ backoff
pymemcache
google-re2
django-softdelete
simplejson
2 changes: 2 additions & 0 deletions api/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,8 @@ sentry-sdk==1.17.0
# via -r requirements.in
shortuuid==1.0.1
# via -r requirements.in
simplejson==3.19.1
# via -r requirements.in
six==1.16.0
# via
# -r requirements.in
Expand Down
2 changes: 1 addition & 1 deletion api/task_processor/models.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import json
import typing
import uuid
from datetime import datetime

import simplejson as json
from django.db import models
from django.utils import timezone

Expand Down
15 changes: 15 additions & 0 deletions api/tests/unit/task_processor/test_unit_task_processor_models.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
from decimal import Decimal

import pytest

from task_processor.decorators import register_task_handler
from task_processor.models import Task

Expand All @@ -20,3 +24,14 @@ def test_task_run():

# Then
assert result == my_callable(*args, **kwargs)


@pytest.mark.parametrize(
"input, expected_output",
(
({"value": Decimal("10")}, '{"value": 10}'),
({"value": Decimal("10.12345")}, '{"value": 10.12345}'),
),
)
def test_serialize_data_handles_decimal_objects(input, expected_output):
assert Task.serialize_data(input) == expected_output

0 comments on commit 25db9b0

Please sign in to comment.