Skip to content

Commit

Permalink
remove unused variables
Browse files Browse the repository at this point in the history
  • Loading branch information
SalmanAsh committed Jul 22, 2024
1 parent 7986e5f commit 271bf29
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions api/views/agreement_signature_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import json
import typing as t
from datetime import timedelta
from unittest.mock import call, patch
from unittest.mock import patch

import requests
from codeforlife.tests import ModelViewSetTestCase
Expand All @@ -30,7 +30,9 @@ class TestAgreementSignatureViewSet(
fixtures = ["agreement_signatures", "contributors"]

def setUp(self):
self.contributor = Contributor.objects.get(pk=1)
self.contributor1 = Contributor.objects.get(pk=1)
self.contributor2 = Contributor.objects.get(pk=2)
self.contributor3 = Contributor.objects.get(pk=3)
self.agreement1 = AgreementSignature.objects.get(pk=1)
self.agreement2 = AgreementSignature.objects.get(pk=2)
self.agreement3 = AgreementSignature.objects.get(pk=3)
Expand All @@ -41,20 +43,20 @@ def test_get_queryset__retrieve(self):
"""Includes all of a contributor's agreement-signatures."""
self.assert_get_queryset(
values=AgreementSignature.objects.filter(
contributor=self.contributor
contributor=self.contributor1
),
action="retrieve",
kwargs={"contributor_pk": self.contributor.pk},
kwargs={"contributor_pk": self.contributor1.pk},
)

def test_get_queryset__list(self):
"""Includes all of a contributor's agreement-signatures."""
self.assert_get_queryset(
values=AgreementSignature.objects.filter(
contributor=self.contributor
contributor=self.contributor1
),
action="list",
kwargs={"contributor_pk": self.contributor.pk},
kwargs={"contributor_pk": self.contributor1.pk},
)

def test_get_queryset__check_signed(self):
Expand All @@ -64,10 +66,10 @@ def test_get_queryset__check_signed(self):
"""
self.assert_get_queryset(
values=AgreementSignature.objects.filter(
contributor=self.contributor
contributor=self.contributor1
).order_by("signed_at"),
action="check_signed",
kwargs={"contributor_pk": self.contributor.pk},
kwargs={"contributor_pk": self.contributor1.pk},
)

# test: actions
Expand Down Expand Up @@ -108,7 +110,7 @@ def test_check_signed__signed(self):
self.client.get(
self.reverse_action(
"check_signed",
kwargs={"contributor_pk": 1},
kwargs={"contributor_pk": self.contributor1.pk},
),
status_code_assertion=status.HTTP_200_OK,
)
Expand All @@ -127,7 +129,6 @@ def test_check_signed__no_response(self):
"""
API cannot process the get request.
"""
agreement_id = "76241fa5e96ce9a620472842fee1ddadfd13cd86"
response = requests.Response()
response.status_code = status.HTTP_500_INTERNAL_SERVER_ERROR
with patch.object(
Expand All @@ -136,7 +137,7 @@ def test_check_signed__no_response(self):
self.client.get(
self.reverse_action(
"check_signed",
kwargs={"contributor_pk": 3},
kwargs={"contributor_pk": self.contributor3.pk},
),
status_code_assertion=status.HTTP_500_INTERNAL_SERVER_ERROR,
)
Expand Down Expand Up @@ -167,7 +168,7 @@ def test_check_signed__not_signed(self):
self.client.get(
self.reverse_action(
"check_signed",
kwargs={"contributor_pk": 3},
kwargs={"contributor_pk": self.contributor3.pk},
),
status_code_assertion=status.HTTP_404_NOT_FOUND,
)
Expand Down Expand Up @@ -198,7 +199,7 @@ def test_check_signed__not_latest_agreement(self):
self.client.get(
self.reverse_action(
"check_signed",
kwargs={"contributor_pk": 2},
kwargs={"contributor_pk": self.contributor2.pk},
),
# pylint: disable-next=line-too-long
status_code_assertion=status.HTTP_451_UNAVAILABLE_FOR_LEGAL_REASONS,
Expand Down

0 comments on commit 271bf29

Please sign in to comment.