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
No related branches found
No related tags found
1 merge request!8HTTP API for Voucher redemption
...@@ -83,10 +83,17 @@ make_spec_db :: VoucherDatabase d => IO d -> Spec ...@@ -83,10 +83,17 @@ make_spec_db :: VoucherDatabase d => IO d -> Spec
make_spec_db getDatabase = make_spec_db getDatabase =
before (getDatabase >>= return . app) $ before (getDatabase >>= return . app) $
describe "redemptionServer" $ describe "redemptionServer" $
it "responds to redemption of an unpaid voucher with 400 (Invalid Request)" $
property $ \(voucher :: Voucher) (tokens :: [BlindedToken]) ->
do do
post path (encode $ Redeem voucher tokens) `shouldRespondWith` 400 it "responds to redemption of an unpaid voucher with 400 (Invalid Request)" $
property $ \(voucher :: Voucher) (tokens :: [BlindedToken]) ->
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 :: Spec
spec_memory_db = spec_memory_db =
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment