robotframework-requests icon indicating copy to clipboard operation
robotframework-requests copied to clipboard

Keywords for TRACE and CONNECT HTTP methods

Open PaulBrandUWV opened this issue 1 year ago • 3 comments

Adds keywords for CONNECT and TRACE HTTP methods. Fixes documentation for default value for allow_redirects. Limits versions for flask and werkzeug to make sure local http server works. Fixes some unit tests related to optional allow_redirect argument. Updates documentation.

All unit tests pass All acceptance tests pass

PaulBrandUWV avatar Apr 30 '24 22:04 PaulBrandUWV

On my machine there are failures on all test_RequestsOnSessionKeywords Seems mock is not working and the test tries to really connect to the network.

utests/test_RequestsOnSessionKeywords.py:16 (test_common_request_file_descriptor_closing)
self = <urllib3.connection.HTTPConnection object at 0x108753640>

    def _new_conn(self):
        """Establish a socket connection and set nodelay settings on it.
    
        :return: New socket connection.
        """
        extra_kw = {}
        if self.source_address:
            extra_kw["source_address"] = self.source_address
    
        if self.socket_options:
            extra_kw["socket_options"] = self.socket_options
    
        try:
>           conn = connection.create_connection(
                (self._dns_host, self.port), self.timeout, **extra_kw
            )

/Users/luca/.virtualenvs/robotframework-requests/lib/python3.9/site-packages/urllib3/connection.py:174: 

lucagiove avatar May 03 '24 23:05 lucagiove

By the way it's a nice work. Thanks, I should try to understand why GitHub pipelines stop running... :(

lucagiove avatar May 03 '24 23:05 lucagiove

I think approval from a maintainer will make the workflows run? It seems you are using a pretty old version of python (3.9). I ran all tests on 3.12 with a fresh virtualenv.

PaulBrandUWV avatar May 04 '24 19:05 PaulBrandUWV

I think approval from a maintainer will make the workflows run? It seems you are using a pretty old version of python (3.9). I ran all tests on 3.12 with a fresh virtualenv.

I approved but I had issues also with my commits.. I'll check it out if you have some suggestion is welcomed. Anyhow we should cover multiple python versions maybe we can review a bit the supported matrix.

lucagiove avatar May 05 '24 08:05 lucagiove

@lucagiove Sorry, it was my mistake. Not sure which unit test I ran on my system before, they should not have passed. I fixed them in my latest commit.

I think support for python 2 can be dropped. Robot Framework currently supports >=3.8.

PaulBrandUWV avatar May 05 '24 18:05 PaulBrandUWV

Yes I agree I should drop some legacy python versions. Actually I should have a matrix between robot and python versions on different OS.

lucagiove avatar May 06 '24 11:05 lucagiove

Yes I agree I should drop some legacy python versions. Actually I should have a matrix between robot and python versions on different OS.

I've made a pull request that removes support for python 2. Yeah compatibility with different Robot Framework versions would be nice. What about different versions of requests?

PaulBrandUWV avatar May 06 '24 11:05 PaulBrandUWV

Codecov Report

Attention: Patch coverage is 90.32258% with 12 lines in your changes are missing coverage. Please review.

Project coverage is 88.60%. Comparing base (a9e8f91) to head (d93c3a4).

Files Patch % Lines
src/RequestsLibrary/utils.py 33.33% 6 Missing :warning:
src/RequestsLibrary/SessionKeywords.py 83.33% 3 Missing and 1 partial :warning:
src/RequestsLibrary/compat.py 33.33% 2 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #390      +/-   ##
==========================================
+ Coverage   83.98%   88.60%   +4.62%     
==========================================
  Files           9        9              
  Lines         437      465      +28     
  Branches      102      116      +14     
==========================================
+ Hits          367      412      +45     
+ Misses         65       51      -14     
+ Partials        5        2       -3     
Flag Coverage Δ
acceptance 84.94% <89.51%> (+0.96%) :arrow_up:
unit 59.56% <57.25%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar May 07 '24 06:05 codecov[bot]

@lucagiove I just merged with master after the last two PR's were merged, Thanks! This PR should be good to be merged now.

PaulBrandUWV avatar May 07 '24 06:05 PaulBrandUWV

Yeah compatibility with different Robot Framework versions would be nice. What about different versions of requests?

Yes you're right.

lucagiove avatar May 07 '24 11:05 lucagiove

@lucagiove I just merged with master after the last two PR's were merged, Thanks! This PR should be good to be merged now.

Great, now let me have a deeper look at the code.

Can I ask why you added support for these methods? You needed to run tests with them?

lucagiove avatar May 07 '24 11:05 lucagiove

@lucagiove I just merged with master after the last two PR's were merged, Thanks! This PR should be good to be merged now.

Great, now let me have a deeper look at the code.

Can I ask why you added support for these methods? You needed to run tests with them?

Yeah I needed some tests to make sure our rest api did not allow these methods (http 405)

PaulBrandUWV avatar May 07 '24 19:05 PaulBrandUWV

@lucagiove did you have a chance to check the code? I'm testing with a modified version of requestslibrary now but would like to stick to the stable or pre release version

PaulBrandUWV avatar May 14 '24 12:05 PaulBrandUWV

I fixed the default values for "allow_redirection" argument. Only HEAD and HEAD on session keywords do not allow redirects by default just like python requests.

PaulBrandUWV avatar May 25 '24 19:05 PaulBrandUWV

ouch now it is a quite big review... 😅

Yeah, most of the changed lines are formatting. Maybe i should have done the changes to the acceptance tests in a separate PR.

PaulBrandUWV avatar May 27 '24 20:05 PaulBrandUWV

@lucagiove Thanks!

PaulBrandUWV avatar May 28 '24 09:05 PaulBrandUWV