Commit Graph

133 Commits

Author SHA1 Message Date
Michael Snoyman
19bd528ac7
Version bump 2020-12-16 05:45:46 +02:00
Asad Saeeduddin
210c992601
Add MTL dependency 2020-12-15 19:59:28 -05:00
patrick brisbin
cb06004044
yesod-test version bump 2020-12-01 11:57:46 -05:00
Felix Yan
672b82d510
Drop dependency on semigroups
They are not needed on GHC we support.
2020-08-02 17:30:19 +08:00
Maximilian Tagher
1d67e3a359 1.6.10 2020-06-21 20:27:35 -04:00
Maximilian Tagher
f50d23ce49 .. 2020-06-20 15:01:26 -04:00
Maximilian Tagher
34927e3401 .. 2020-06-20 14:54:31 -04:00
Maximilian Tagher
e7cf662af7 Update yesod-test cabal file for distribution
Hackage is now requiring a higher cabal file version, and with that comes a requirement to specify the language of each module
2020-06-01 14:54:39 -04:00
Maximilian Tagher
ab8a994a34 .. 2020-05-31 16:38:09 -04:00
Michael Snoyman
804b114d91
Drop LTS 9 2020-01-07 13:36:58 +02:00
Maximilian Tagher
4f51153b09 Require latest yesod-core for yesod-test
(This was missing from #1646)
2019-12-01 08:06:10 -05:00
Maximilian Tagher
6d0b723eb1 [yesod-test] Adds requireJSONResponse function
This function checks that a response body is JSON, and parses it into a Haskell value. Having something like this function is pretty essential to using Yesod as a JSON API server, so I think it's a good addition. You can use it to parse a Haskell record directly (usually by adding FromJSON classes to your response types), or parse a Value and pull out individual fields, maybe using something like `aeson-lens` (though probably a testing-specific library would be better).

I debated over these things:

1. The name. I was thinking of something like [assert/require/decode/parse]JSON[Response/Body]. I ultimately went with requireJSONResponse:
	- decode/parse sound like the aeson functions that return Either or Maybe, and I wanted this function to throw an error if it failed
	- I'm open to using `assertJSONResponse`—it matches the other functions (`assertEq`) better—but I think it reads less like English.
	- I chose Response over Body because (a) It also checks the content-type header, which is not in the body (b) "Body" felt slightly in-the-weeds of HTTP; I think "response" is more approachable.
2. Should it require the JSON content type? You can definitely have a server that returns JSON without JSON content types, but I think that's a such a bad idea, it's more likely requiring it helps people if they accidentally don't add the header.
3. Should it take a String parameter to add to the error message? This would match `assertEq`, but other functions like `statusIs` don't take a message. Ultimately I went without it, because the messages felt like I was repeating myself: `(comment :: Comment) <- requireJSONResponse "the response has a comment"`
2019-11-24 15:31:05 -05:00
Maximilian Tagher
cbef19fae9 [yesod-test] Add testModifySite 2019-11-19 23:11:13 -08:00
Maximilian Tagher
ffd5ba0474 Add Basic Auth support to yesod-test
This allows setting username/password for HTTP basic auth, similar to the --user flag of curl.
2019-10-09 16:08:37 -07:00
Christopher League
3f98190645 Bump version to 1.6.6.2 2019-08-13 10:39:44 -04:00
Jonathan Lamothe
6fe7ee6e0d Documentation fix (#1577)
* fixed documentation

* bumped version

* updated ChangeLog
2019-01-26 12:53:04 +05:30
Maximilian Tagher
bedec86c74 [yesod-test] Add utility functions to modify cookies 2019-01-14 16:12:32 -08:00
Dan Burton
bff8200ae4
Updated changelogs and versions for #1561 2018-10-11 14:21:17 -04:00
Steven Leiva
0a089c8cb0 bodyEquals prints actual body. 2018-06-14 09:00:48 -05:00
ncaq
708648798e deleted: unneed cabal build-depends by weeder
[weeder: Detect dead code](https://hackage.haskell.org/package/weeder)

deleted depends is

* mime-mail
* wai-eventsource

I sort build-depends, because duplicate depend some exist, to sort is detect to easy.
2018-06-09 13:15:21 +09:00
Tom Sydney Kerckhove
0aa1765b6c Updated according to review 2018-04-26 11:00:48 +02:00
pythonissam
a7d42846b5 add performMethod 2018-04-14 06:08:15 +00:00
Maximilian Tagher
a0963e77b2
Merge branch 'master' into bylabel-contain 2018-02-09 22:20:02 -08:00
pythonissam
b8f93e6203 Update the version to 1.6.2 2018-02-10 04:16:07 +00:00
Ryan Scott
3408e1e630 Adapt to Semigroup changes in base-4.11 2018-02-04 20:09:37 -05:00
pythonissam
88a23129fd Version bump 2018-02-03 08:40:38 +00:00
pythonissam
064f41d9e9 created new byLabel-related functions 2018-02-03 08:39:40 +00:00
Michael Snoyman
e3bb03f9af
Missing import 2018-01-15 17:56:20 +02:00
Michael Snoyman
a210ce59d7
Get it all compiling again 2018-01-15 17:08:55 +02:00
Michael Snoyman
25acc5799b
Version bumps and changelog updates 2018-01-15 15:57:36 +02:00
Michael Snoyman
ed40b136ea
Fix broken Haddocks 2017-12-30 18:06:45 +02:00
pythonissam
e5c04a0b8e Version bump 2017-12-02 09:57:40 +00:00
Michael Snoyman
4f14b9b82d
Add a stricter lower bound 2017-08-22 11:25:51 +03:00
Sebastián Estrella
a58a4d88cd Add implicit param HasCallStack to assertions 2017-07-19 22:47:00 -05:00
Mark Wotton
ee9ef1eac5 add clickOn function (closes #1406) 2017-06-14 13:40:44 -04:00
Amitai Burstein
b8d2647a6a Add assertNotEq 2017-04-11 20:46:49 +03:00
Michael Snoyman
cdc6c8ae04 Version bumps/changelog updates 2017-02-08 11:20:31 +02:00
Michael Snoyman
03c1ee4807 Compilation fix for GHC 7.8 2016-12-07 08:54:53 -05:00
Michael Snoyman
9c38a4b08e Version bump for #1314 2016-12-01 06:53:41 +02:00
Amitaibu
ac0229dff0 Bump cabal version and export function 2016-09-01 14:19:38 +03:00
Michael Snoyman
dae1a34d4c Version bump for #1259 2016-08-10 08:48:57 +03:00
Chris Allen
13d9f58db7 Added assertEq, deprecated assertEqual
use assertEq instead
2016-08-10 00:08:24 -05:00
Maxime Bourget
6addf3923d Changes spec name and bump version to 1.5.1.1 2016-04-12 21:42:33 +01:00
Mark Wotton
62961ef931 fix exception test 2016-03-21 12:34:38 -04:00
Mark Wotton
df6834a335 add followRedirect 2016-03-21 12:13:23 -04:00
Chris Allen
289471d122 appropriate version bump 2016-03-20 12:50:17 -05:00
Chris Allen
7e10d87492 better error formatting, bumping version 2016-03-17 14:33:15 -05:00
Greg Weber
ac6e8f6195 version bump for 1.5.0.1 2015-08-25 23:17:56 -07:00
Maximilian Tagher
479a19e65a yesod-test: have request not default to the form-urlencoded Content-Type
* Only set the Content-Type to "application/x-www-form-urlencoded" if key-value pairs are added
* Previously the "application/x-www-form-urlencoded" Content-Type would be added even if you set a binary request body.
	* You could add your own Content-Type with addRequestHeader, but this resulted in multiple Content-Type headers.
* Closes #1063
2015-08-24 20:27:28 -07:00
Greg Weber
95e6084634 Merge branch 'test-middleware'
Conflicts:
	yesod-test/yesod-test.cabal
2015-08-20 17:38:30 -07:00