From accff2bcad15925edfeb2ad4ff86529e7ea5a4b1 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone <exarkun@twistedmatrix.com> Date: Wed, 13 Nov 2019 14:46:51 -0500 Subject: [PATCH] make a better assertion in test for getting a voucher with the web api --- src/_zkapauthorizer/tests/test_client_resource.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/_zkapauthorizer/tests/test_client_resource.py b/src/_zkapauthorizer/tests/test_client_resource.py index f810984..1df9393 100644 --- a/src/_zkapauthorizer/tests/test_client_resource.py +++ b/src/_zkapauthorizer/tests/test_client_resource.py @@ -53,8 +53,8 @@ from testtools.matchers import ( IsInstance, ContainsDict, AfterPreprocessing, + Is, Equals, - NotEquals, Always, GreaterThan, ) @@ -650,9 +650,11 @@ class VoucherTests(TestCase): ).encode("ascii"), ) if redeemed: - token_count_comparison = NotEquals + # Value duplicated from PaymentController.redeem default. Should + # do this better. + token_count_comparison = Equals(100) else: - token_count_comparison = Equals + token_count_comparison = Is(None) self.assertThat( getting, @@ -668,7 +670,7 @@ class VoucherTests(TestCase): number=Equals(voucher), created=Equals(now), redeemed=Equals(redeemed), - token_count=token_count_comparison(None), + token_count=token_count_comparison, ), ), ), -- GitLab