-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pytest_httpserver: extend HTTPServer to support writing behave test s… #166
Conversation
Codecov Report
@@ Coverage Diff @@
## master #166 +/- ##
==========================================
+ Coverage 94.54% 94.89% +0.34%
==========================================
Files 3 4 +1
Lines 477 548 +71
==========================================
+ Hits 451 520 +69
- Misses 26 28 +2
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
29a012a
to
95e903a
Compare
I need help to figure out what is the problem with the coding style. |
I've started looking at your code. Regarding coding style errors: since you started working on this, a pre-commit check has been added to the project, so you can set it up if you want so it will check all the coding style + linting for each commit. To do that you would need to run If you don't want to do that (that's also fine, but the CI will catch the errors), you can run |
95e903a
to
9e89177
Compare
8aa364b
to
fcd95f5
Compare
@matez0 I looked at your changes briefly and it looks good for the first sight. I think I'll review it today evening. Thanks! |
The functionalities of the interface are responding: - with a JSON object, - with raw data, - with a Response object. This separation makes these functionalities reusable by derivation.
…test steps in real order Although HTTPServer is suitable in itself to use in behave tests, but because of the expectation on a request has to be done before the request is performed the test steps of checking the request and sending the response also has to be before the test step triggering the request. This makes a confusing test specification like: Then SUT sends an other request to server When server responds something When a request is sent to SUT Then SUT responds something Using the BlockingHttpServer, the server blocks until the request is asserted and then it blocks again until the response is performed. The test steps can be written in real order: When a request is sent to SUT Then SUT sends an other request to server When server responds something Then SUT responds something
fcd95f5
to
642c70f
Compare
Thank you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks very much for the refactoring I think it looks very good and nicely separated everything!
I have found minor things, so same applies as before: if you don't want to do that because you already put the effort, please let me know, and I'll do it.
Documentation also needs to be fixed and updated, but I'll do that once your PR is merged. I need to prepare a release note also.
If you can fixup this changes quickly, that would be fine for me. |
Ok, then I merge this, and will fix in another PR. |
…teps in real order
HTTPServer is suitable in itself to use in behave tests,
but because of the expectation on a request has to be done
before the request is performed
the test steps of checking the request and sending the response
also has to be before the test step triggering the request.
This makes a confusing test specification like:
Then SUT sends an other request to server
When server responds something
When a request is sent to SUT
Then SUT responds something
Using the BlockingHttpServer, the server blocks until the request is asserted
and then it blocks again until the response is performed.
The test steps can be written in real order:
When a request is sent to SUT
Then SUT sends an other request to server
When server responds something
Then SUT responds something