generated from CodeYourFuture/Module-Template
-
-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathcustom_json_provider_test.py
More file actions
29 lines (23 loc) · 742 Bytes
/
custom_json_provider_test.py
File metadata and controls
29 lines (23 loc) · 742 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import datetime
from datetime import timezone
import unittest
from flask import Flask
from custom_json_provider import CustomJsonProvider
class TestCustomJsonProvider(unittest.TestCase):
def test_datetime(self):
serialised = CustomJsonProvider(Flask("Dummy")).dumps(
{
"timestamp": datetime.datetime(
year=2020,
month=3,
day=4,
hour=14,
minute=15,
second=16,
tzinfo=timezone.utc,
)
}
)
self.assertEqual(serialised, """{"timestamp": "2020-03-04T14:15:16+00:00"}""")
if __name__ == "__main__":
unittest.main()