Skip to content

Commit acc179b

Browse files
authored
string representation testing for backend/communities/groups/models.py (#1156)
1 parent 5735215 commit acc179b

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# SPDX-License-Identifier: AGPL-3.0-or-later
2+
"""
3+
Test cases for the GroupImage model.
4+
"""
5+
6+
import pytest
7+
8+
from communities.groups.factories import GroupFactory, GroupImageFactory
9+
from content.factories import ImageFactory
10+
11+
pytestmark = pytest.mark.django_db
12+
13+
14+
def test_group_image_str() -> None:
15+
"""Test string representation of GroupImage model."""
16+
group = GroupFactory()
17+
image = ImageFactory()
18+
group_image = GroupImageFactory(group=group, image=image, sequence_index=1)
19+
20+
assert str(group_image) == f"{group_image.id}"

backend/communities/groups/tests/test_group_text.py

+8
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,11 @@ def test_group_text_languages() -> None:
4545
assert secondary_text.primary is False
4646
assert secondary_text.iso == "spa"
4747
assert secondary_text.description == "Description"
48+
49+
50+
def test_group_text_str_representation() -> None:
51+
"""Test string representation of GroupText model."""
52+
group = GroupFactory()
53+
group_text = GroupTextFactory(group=group, iso="eng")
54+
55+
assert str(group_text) == f"{group_text.group} - {group_text.iso}"

0 commit comments

Comments
 (0)