Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions backend/communities/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
OrganizationMemberFactory,
OrganizationTaskFactory,
)
from communities.models import Status, StatusType
from authentication.factories import UserFactory


pytestmark = pytest.mark.django_db

Expand All @@ -34,3 +37,23 @@ def test_str_methods() -> None:

assert str(group) == group.name
assert str(group_member) == str(group_member.id)

def test_status_and_status_type_str_methods() -> None:
"""Test the __str__ methods of the Status and StatusType models."""

status_type = StatusType.objects.create(name="Active")

# Create an organization to use with Status.
organization = OrganizationFactory.create()

# Create a user for the Status.
user = UserFactory.create()

status = Status.objects.create(
status_type=status_type,
org=organization,
user=user
)

assert str(status_type) == "Active"
assert str(status) == f"{organization.name} - {status_type}"
Loading