Skip to content

Commit 4e2a570

Browse files
committed
Add simple tests for Assembly
1 parent 531cbf2 commit 4e2a570

File tree

2 files changed

+141
-0
lines changed

2 files changed

+141
-0
lines changed

test/data/assembly.json

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
{
2+
"assembly": {
3+
"organisation": {
4+
"id": 686,
5+
"self": "api.notubiz.nl/organisations/686"
6+
},
7+
"gremium": {
8+
"id": 12330,
9+
"self": "api.notubiz.nl/organisations/686/gremia/12330"
10+
},
11+
"module_items": [],
12+
"documents": [],
13+
"id": 1253866,
14+
"self": "/events/assemblies/1253866",
15+
"type": "assembly",
16+
"permission_group": "public",
17+
"body": "council",
18+
"confidential": 0,
19+
"announcement": true,
20+
"canceled": false,
21+
"inactive": false,
22+
"creation_date": "2024-07-01 09:37:21",
23+
"last_modified": "2024-12-13 10:33:57",
24+
"order": null,
25+
"live": false,
26+
"archive_state": "unarchived",
27+
"archive_state_last_modified": null,
28+
"allow_subscriptions": false,
29+
"subscriptions": [],
30+
"salutation": null,
31+
"template": false,
32+
"attributes": [
33+
{
34+
"id": 1,
35+
"reference_model": null,
36+
"value": "Raadsavond"
37+
},
38+
{
39+
"id": 50,
40+
"reference_model": null,
41+
"value": "Raadzaal / commissiekamer"
42+
},
43+
{
44+
"id": 72,
45+
"reference_model": null,
46+
"value": ""
47+
},
48+
{
49+
"id": 68,
50+
"reference_model": null,
51+
"value": ""
52+
},
53+
{
54+
"id": 3,
55+
"reference_model": null,
56+
"value": ""
57+
}
58+
],
59+
"plannings": [
60+
{
61+
"start_date": "2025-01-07 14:00:00",
62+
"end_date": null
63+
}
64+
],
65+
"meetings": [
66+
{
67+
"id": 1253869,
68+
"self": "api.notubiz.nl/events/meetings/1253869",
69+
"order": 1,
70+
"plannings": [
71+
{
72+
"start_date": "2025-01-07 17:00:00",
73+
"end_date": "2025-01-07 21:30:00"
74+
}
75+
]
76+
},
77+
{
78+
"id": 1253867,
79+
"self": "api.notubiz.nl/events/meetings/1253867",
80+
"order": 4,
81+
"plannings": [
82+
{
83+
"start_date": "2025-01-07 17:00:00",
84+
"end_date": "2025-01-07 21:00:00"
85+
}
86+
]
87+
},
88+
{
89+
"id": 1253868,
90+
"self": "api.notubiz.nl/events/meetings/1253868",
91+
"order": 6,
92+
"plannings": [
93+
{
94+
"start_date": "2025-01-07 14:00:00",
95+
"end_date": "2025-01-07 21:00:00"
96+
}
97+
]
98+
}
99+
]
100+
}
101+
}

test/test_assembly.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
from notubiz.api.dataclasses.assembly import Assembly
2+
from notubiz.api._converter import get_converter
3+
4+
import pytest
5+
from test.helpers import read_json
6+
7+
from datetime import datetime
8+
9+
test_file_path = "./test/data/assembly.json"
10+
11+
@pytest.fixture(scope="session")
12+
def input_json():
13+
json_object = read_json(test_file_path)["assembly"]
14+
return json_object
15+
16+
@pytest.fixture(scope="session")
17+
def input_assembly(input_json):
18+
return get_converter().structure(input_json, Assembly)
19+
20+
def test_assembly_event_inheritance(input_assembly):
21+
# Verify that inheritance of Event still works
22+
# by checking the same things as in test_events
23+
assert input_assembly.id == 1253866
24+
assert input_assembly.title == "Raadsavond"
25+
assert input_assembly.location == "Raadzaal / commissiekamer"
26+
27+
assert len(input_assembly.plannings) == 1
28+
assert input_assembly.plannings[0].start_date == datetime(2025, 1, 7, 14, 00)
29+
assert input_assembly.plannings[0].end_date == None
30+
31+
def test_assembly_meeting_list_structure(input_assembly):
32+
assert len(input_assembly.meetings) == 3
33+
34+
assert input_assembly.meetings[0].id == 1253869
35+
assert input_assembly.meetings[0].order == 1
36+
37+
assert input_assembly.meetings[2].id == 1253868
38+
assert input_assembly.meetings[2].order == 6
39+
assert input_assembly.meetings[2].plannings[0].start_date == datetime(2025, 1, 7, 14, 0, 0)
40+
assert input_assembly.meetings[2].plannings[0].end_date == datetime(2025, 1, 7, 21, 0, 0)

0 commit comments

Comments
 (0)