diff options
author | Matthew Lemon <y@yulqen.org> | 2024-09-09 15:24:16 +0100 |
---|---|---|
committer | Matthew Lemon <y@yulqen.org> | 2024-09-09 15:24:16 +0100 |
commit | e3b47f5218aa9155e933c58465aebc071485df40 (patch) | |
tree | fad4b49b154e6dd97fc5fcbab4162ab8549b377e | |
parent | 09b099e467df64ac8ce44bbe2d1f80cd1c00a126 (diff) |
Tests passing
-rw-r--r-- | engagements/tests/test_forms.py | 7 | ||||
-rw-r--r-- | engagements/views.py | 4 |
2 files changed, 5 insertions, 6 deletions
diff --git a/engagements/tests/test_forms.py b/engagements/tests/test_forms.py index 3c213c5..b9807dd 100644 --- a/engagements/tests/test_forms.py +++ b/engagements/tests/test_forms.py @@ -1,8 +1,7 @@ import pytest from django.forms import DateInput, Select, SelectMultiple -from engagements.forms import EngagementCreateForm -from engagements.forms import EngagementEffortCreateForm +from engagements.forms import EngagementCreateForm, EngagementEffortCreateForm from engagements.models import EngagementType pytestmark = pytest.mark.django_db @@ -102,10 +101,10 @@ def test_form_missing_required_fields(): assert "external_party" in form.errors -def test_form_engagement_type_queryset(): +def test_form_engagement_type_queryset(engagement_type): initial_data = {"engagement_type": EngagementType.objects.all()} form = EngagementCreateForm(initial=initial_data) - assert form.fields["engagement_type"].queryset == initial_data["engagement_type"] + assert form.fields["engagement_type"].queryset.first().name == initial_data["engagement_type"].first().name def test_form_engagement_type_queryset_without_initial(): diff --git a/engagements/views.py b/engagements/views.py index 88f2014..e66d679 100644 --- a/engagements/views.py +++ b/engagements/views.py @@ -2,12 +2,12 @@ from django.contrib.auth.decorators import login_required from django.contrib.auth.mixins import LoginRequiredMixin from django.db.models import Q from django.http import HttpResponse -from django.shortcuts import get_object_or_404 -from django.shortcuts import redirect, render +from django.shortcuts import get_object_or_404, redirect, render from django.template.loader import render_to_string from django.views.generic import ListView from instruments.models import SubInstrument + from .forms import ( EngagementCreateForm, EngagementEffortPlanningCreateForm, |