Skip to content

Commit

Permalink
fixed filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
MadsNyl committed Nov 11, 2024
1 parent 377aa3e commit 13b36d5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
4 changes: 1 addition & 3 deletions app/feedback/filters/feedback.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@ class FeedbackFilter(filters.FilterSet):
method="filter_feedback_type", label="List of feedback type"
)

status = filters.ModelChoiceFilter(
status = filters.CharFilter(
method="filter_status",
field_name="status",
label="List of feedback status",
queryset=Feedback.objects.all(),
)

ordering = OrderingFilter(
Expand Down
7 changes: 2 additions & 5 deletions app/tests/feedback/test_feedback_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,19 +280,16 @@ def test_status_filter_as_member(member):
"""A member should be able to filter feedbacks by status"""

BugFactory(author=member, status=Status.OPEN)
IdeaFactory(author=member, status=Status.OPEN)
IdeaFactory(author=member, status=Status.CLOSED)

url = f"{FEEDBACK_BASE_URL}?status={Status.OPEN}"
client = get_api_client(member)
response = client.get(url)

data = response.data

print(data)

results = data["results"]

assert response.status_code == status.HTTP_200_OK
assert data["count"] == 2
assert data["count"] == 1
assert results[0]["status"] == Status.OPEN
assert results[1]["status"] == Status.OPEN

0 comments on commit 13b36d5

Please sign in to comment.