1
0
mirror of https://github.com/kevin1024/vcrpy.git synced 2025-12-08 16:53:23 +00:00
Commit Graph

21 Commits

Author SHA1 Message Date
Arthur Hamon
caa3a67bde feat(failure-message): reformat the message with the best requests matches (#459)
The message is less verbose and the display is improved for a better readability.
2019-08-06 09:57:13 +10:00
Arthur Hamon
0a01f0fb51 change all the matchers with an assert statement and refactor the requests_match function
In order to use the new assert mechanism that returns explicit assertion failure message, all the default matchers does not return a boolean, but only do an assert statement with a basic assertion message (value_1 != value_2).
The requests_match function has been refactored to use the 'get_matchers_results' function in order to have explicit failures that are logged if any.
Many unit tests have been changed as the matchers does not return a boolean value anymore.
Note: Only the matchers "body" and "raw_body" does not have an assertion message, the body values might be big and not useful to be display to spot the differences.
2019-06-27 22:22:10 +02:00
Arthur Hamon
46f5b8a187 add function to get the comparaison result of two request with a list of matchers
The function returns two list:
- the first one is the list of matchers names that have succeeded.
- the second is a list of tuples with the failed matchers names and the related assertion message like this ("matcher_name", "assertion_message").
If the second list is empty, it means that all the matchers have passed.
2019-06-27 22:22:10 +02:00
Arthur Hamon
940dec1dd6 add private function to evaluate a matcher
A matcher can now return other results than a boolean :
- An AssertionError exception meaning that the matcher failed, with the exception we get the assertion failure message.
- None, in case we do an assert in the matcher, meaning that the assertion has passed, the matcher is considered as a success then.
- Boolean that indicates if a matcher failed or not. If there is no match, a boolean does not give any clue what it is the differences compared to the assertion.
2019-06-27 22:22:10 +02:00
Arthur Hamon
de244a968f add function to format the assertion message
This function is used to prettify the assertion message when a matcher failed and return an assertion error.
2019-06-27 22:22:10 +02:00
Hugo
d0aa6bcc8d Rewrite unnecessary list/tuple literals as set literals 2018-01-15 09:54:11 +02:00
Ivan Malison
33a4fb98c6 Update unit tests for body matcher. Simplified logic. 2015-07-15 00:01:31 -07:00
Diaoul
c0286dfd97 Add body matcher unit tests 2015-07-11 23:22:42 +02:00
Max Shytikov
1190a0e62e Removed default '80' port of uri in tests 2014-05-04 02:11:49 +02:00
Max Shytikov
2fa1aaa1f7 Replaced 'url' mather with 'uri'. 2014-04-30 02:31:11 +02:00
Max Shytikov
7fe55ad8b8 Updated 'set' to be compatible with 2.6 2014-04-30 02:30:08 +02:00
Max Shytikov
4267828a3e Added 'scheme' to Request with matcher and test 2014-04-30 02:29:25 +02:00
Max Shytikov
5015dbd878 Improved test samples 2014-04-30 02:27:52 +02:00
Max Shytikov
9b188e986f Added query to Request with matcher and test 2014-04-30 02:27:52 +02:00
Max Shytikov
6b060e5666 Added path to Request with matcher and test 2014-04-30 02:27:52 +02:00
Max Shytikov
bd9fa773e8 Added port to Request with matcher and test 2014-04-30 02:27:52 +02:00
Max Shytikov
18ec57fa73 Added test and impl for Request 'host' attribute 2014-04-30 02:27:52 +02:00
Max Shytikov
6cca703eee Refactored unit test for matchers 2014-04-30 02:27:52 +02:00
Max Shytikov
edf1df9188 Replaced Request 'host, port, protocol, path' with 'uri' 2014-04-30 02:27:52 +02:00
Max Shytikov
792d665893 Added unit test for matcher 'url' 2014-04-30 02:27:51 +02:00
Max Shytikov
cd32f5114c Added unit test for matcher 'method' 2014-04-30 02:27:51 +02:00