Skip to content

Commit c95d49e

Browse files
committed
squash: django: test: timestamped resource
Signed-off-by: Jonas Remmert <jremmert@gmx.net>
1 parent 6e866d8 commit c95d49e

File tree

1 file changed

+57
-17
lines changed

1 file changed

+57
-17
lines changed

server/django/sensordata/tests/test_post_timestamped_resource.py

Lines changed: 57 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,63 @@
1313

1414
TEST_PAYLOAD = '''
1515
{
16-
"ep" : "urn:imei:100000000000000",
17-
"val" : {
18-
"empty" : false,
19-
"timestamps" : [ null ],
20-
"nodes" : {
21-
"/3303/0/5700" : {
22-
"kind" : "singleResource",
23-
"id" : 5700,
24-
"type" : "FLOAT",
25-
"value" : "22.19110046564394"
26-
},
27-
"/3304/0/5700" : {
28-
"kind" : "singleResource",
29-
"id" : 5700,
30-
"type" : "FLOAT",
31-
"value" : "52.237076014801175"
16+
"ep": "urn:imei:100000000000000",
17+
"val": [
18+
{
19+
"null": {
20+
"nodes": {
21+
"/3303/0/5700": {
22+
"kind": "singleResource",
23+
"id": 5700,
24+
"type": "FLOAT",
25+
"value": "20.145982801948204"
26+
},
27+
"/3304/0/5700": {
28+
"kind": "singleResource",
29+
"id": 5700,
30+
"type": "FLOAT",
31+
"value": "51.200783720985235"
32+
}
33+
}
34+
}
35+
},
36+
{
37+
"2024-09-13T19:06:17.032059888Z": {
38+
"nodes": {
39+
"/10300/0/0": {
40+
"kind": "singleResource",
41+
"id": 0,
42+
"type": "INTEGER",
43+
"value": "8"
44+
}
45+
}
46+
}
47+
},
48+
{
49+
"2024-09-13T19:06:18.032059888Z": {
50+
"nodes": {
51+
"/10300/0/0": {
52+
"kind": "singleResource",
53+
"id": 0,
54+
"type": "INTEGER",
55+
"value": "9"
56+
}
57+
}
58+
}
59+
},
60+
{
61+
"2024-09-13T19:06:19.032059888Z": {
62+
"nodes": {
63+
"/10300/0/0": {
64+
"kind": "singleResource",
65+
"id": 0,
66+
"type": "INTEGER",
67+
"value": "10"
68+
}
69+
}
3270
}
3371
}
34-
}
72+
]
3573
}
3674
'''
3775

@@ -44,6 +82,8 @@ def setUp(self):
4482
name="temperature", data_type=ResourceType.FLOAT)
4583
ResourceType.objects.create(object_id=3304, resource_id=5700,
4684
name="humidity", data_type=ResourceType.FLOAT)
85+
ResourceType.objects.create(object_id=10300, resource_id=0,
86+
name="humidity", data_type=ResourceType.INTEGER)
4787

4888

4989
def test_post_composite_resource(self):

0 commit comments

Comments
 (0)