Merge pull request #571 from dod-ccpo/custom-json-encoder

Use a custom JSON encoder
This commit is contained in:
patricksmithdds
2019-01-23 16:09:23 -05:00
committed by GitHub
6 changed files with 28 additions and 16 deletions

15
tests/utils/test_json.py Normal file
View File

@@ -0,0 +1,15 @@
import json
from atst.utils.json import CustomJSONEncoder
from tests.factories import AttachmentFactory
encoder = CustomJSONEncoder()
def test_custom_encoder_serializes_attachments():
filename = "jar_jar_is_secretly_a_sith_lord.pdf"
attachment = AttachmentFactory.create(filename=filename)
encoded = encoder.encode({"file": attachment})
expected = json.dumps({"file": filename})
assert encoded == expected