Skip to content
Snippets Groups Projects
Commit 1c7455cd authored by Jean-Paul Calderone's avatar Jean-Paul Calderone
Browse files

Start of a test that needs the database, too, darn.

parent 6f5d903b
Branches
No related tags found
1 merge request!8HTTP API for Voucher redemption
......@@ -83,11 +83,18 @@ make_spec_db :: VoucherDatabase d => IO d -> Spec
make_spec_db getDatabase =
before (getDatabase >>= return . app) $
describe "redemptionServer" $
do
it "responds to redemption of an unpaid voucher with 400 (Invalid Request)" $
property $ \(voucher :: Voucher) (tokens :: [BlindedToken]) ->
do
post path (encode $ Redeem voucher tokens) `shouldRespondWith` 400
it "responds to redemption of a paid voucher with 200 (OK)" $
property $ \(voucher :: Voucher) (tokens :: [BlindedToken]) ->
do
payForVoucher database voucher
post path (encode $ Redeem voucher tokens) `shouldRespondWith` 200
spec_memory_db :: Spec
spec_memory_db =
make_spec_db memory
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment