Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

missing test coverage for backend/communities/models.py #1152

Merged
merged 2 commits into from
Mar 10, 2025
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