Skip to content

Commit

Permalink
Reactivate tests of topic create
Browse files Browse the repository at this point in the history
  • Loading branch information
reiterl committed Jul 29, 2023
1 parent 246067f commit 7a301c9
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions tests/system/action/topic/test_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,71 @@ def test_create_multiple_with_existing_sequential_number(self) -> None:
topic = self.get_model("topic/3")
self.assertEqual(topic.get("sequential_number"), 44)

def test_create_meeting_id_agenda_tag_ids_mismatch(self) -> None:
"""Tag 8 is from meeting 8 and a topic for meeting 1 should be created.
This should lead to an error."""
self.set_models(
{
"meeting/1": {"is_active_in_organization_id": 1},
"meeting/8": {
"is_active_in_organization_id": 1,
"tag_ids": [8],
},
"tag/8": {"name": "tag8", "meeting_id": 8},
}
)
response = self.request(
"topic.create",
{
"meeting_id": 1,
"title": "A",
"agenda_type": AgendaItem.INTERNAL_ITEM,
"agenda_duration": 60,
"agenda_tag_ids": [8],
},
)
self.assert_status_code(response, 400)
assert (
"The following models do not belong to meeting 1: ['tag/8']"
in response.json["message"]
)

def test_create_with_agenda_tag_ids(self) -> None:
"""Tag 1 is from meeting 1 and a topic for meeting 1 should be created."""
self.set_models(
{
"meeting/1": {"is_active_in_organization_id": 1, "tag_ids": [1]},
"tag/1": {"name": "test tag", "meeting_id": 1},
}
)
response = self.request(
"topic.create",
{
"meeting_id": 1,
"title": "A",
"agenda_type": AgendaItem.INTERNAL_ITEM,
"agenda_duration": 60,
"agenda_tag_ids": [1],
},
)
self.assert_status_code(response, 200)
self.assert_model_exists(
"topic/1", {"meeting_id": 1, "title": "A", "agenda_item_id": 1}
)
self.assert_model_exists(
"agenda_item/1",
{
"meeting_id": 1,
"type": AgendaItem.INTERNAL_ITEM,
"duration": 60,
"tag_ids": [1],
},
)
self.assert_model_exists(
"tag/1",
{"meeting_id": 1, "name": "test tag", "tagged_ids": ["agenda_item/1"]},
)

def test_create_no_permission(self) -> None:
self.base_permission_test(
{}, "topic.create", {"meeting_id": 1, "title": "test"}
Expand Down

0 comments on commit 7a301c9

Please sign in to comment.