File tree 4 files changed +25
-10
lines changed
4 files changed +25
-10
lines changed Original file line number Diff line number Diff line change @@ -282,3 +282,21 @@ Trace Request
282
282
[Tags] trace
283
283
${resp } = TRACE ${HTTP_LOCAL_SERVER } /anything
284
284
Status Should Be OK ${resp }
285
+
286
+ Get request with get response
287
+ [Tags] get
288
+ GET ${HTTP_LOCAL_SERVER } /anything
289
+ Status Should Be OK
290
+ ${resp } = Get response
291
+ Should be equal ${resp.status_code } ${200 }
292
+ Should be equal ${resp.json() } [url] ${HTTP_LOCAL_SERVER } /anything
293
+
294
+ Post request with get response
295
+ [Tags] post
296
+ ${data } = Create dictionary key1=one key2=two key3=3
297
+ POST ${HTTP_LOCAL_SERVER } /anything json=${data }
298
+ Status Should Be OK
299
+ ${resp } = Get response
300
+ Should be equal ${resp.status_code } ${200 }
301
+ Should be equal ${resp.json() } [url] ${HTTP_LOCAL_SERVER } /anything
302
+ Should be equal ${resp.json() } [json] ${data }
Original file line number Diff line number Diff line change @@ -168,6 +168,13 @@ def get_file_for_streaming_upload(path):
168
168
"""
169
169
return open (path , "rb" )
170
170
171
+ @keyword ("Get response" )
172
+ def get_response (self ) -> requests .Response :
173
+ """
174
+ Returns the response from the last request.
175
+ """
176
+ return self .last_response
177
+
171
178
@keyword ("GET" )
172
179
@warn_if_equal_symbol_in_url_session_less
173
180
def session_less_get (
Original file line number Diff line number Diff line change 1
- import sys
2
-
3
- import pytest
4
-
5
1
from RequestsLibrary import RequestsLibrary
6
2
from utests import mock
7
3
@@ -69,14 +65,12 @@ def test_merge_url_with_session_url_path_slash_and_uri_endpoint():
69
65
assert url == 'http://www.domain.com/path/endpoint'
70
66
71
67
72
- @pytest .mark .skipif (sys .version_info < (3 , 0 ), reason = "different urljoin handling of double slash" )
73
68
def test_merge_url_with_session2trailing_and_endpoint ():
74
69
session , keywords = build_mocked_session_keywords ('http://www.domain.com//' )
75
70
url = keywords ._merge_url (session , 'endpoint' )
76
71
assert url == 'http://www.domain.com/endpoint'
77
72
78
73
79
- @pytest .mark .skipif (sys .version_info < (3 , 0 ), reason = "different urljoin handling of double slash" )
80
74
def test_merge_url_with_session_and_slash_endpoint_2trailing ():
81
75
session , keywords = build_mocked_session_keywords ('http://www.domain.com' )
82
76
url = keywords ._merge_url (session , '/endpoint//' )
Original file line number Diff line number Diff line change 1
- import sys
2
1
import unittest
3
2
4
3
from RequestsLibrary import compat
@@ -13,14 +12,12 @@ def test_session_class_extends_keywords_class():
13
12
14
13
class TestUrlLibWarnings (unittest .TestCase ):
15
14
16
- @unittest .skipIf (sys .version_info < (3 , 2 ), "python version doesn't support assertWarns" )
17
15
def test_get_default_retry_method_list_not_raise_warning (self ):
18
16
with self .assertRaises (AssertionError ):
19
17
with self .assertWarns (DeprecationWarning ):
20
18
DEFAULT_RETRY_METHOD_LIST = compat .RetryAdapter .get_default_allowed_methods ()
21
19
assert "GET" in DEFAULT_RETRY_METHOD_LIST
22
20
23
- @unittest .skipIf (sys .version_info < (3 , 2 ), "python version doesn't support assertWarns" )
24
21
def test_init_retry_adapter_not_raise_warning (self ):
25
22
with self .assertRaises (AssertionError ):
26
23
with self .assertWarns (DeprecationWarning ):
@@ -29,7 +26,6 @@ def test_init_retry_adapter_not_raise_warning(self):
29
26
status_forcelist = [500 ],
30
27
allowed_methods = ['GET' ])
31
28
32
- @unittest .skipIf (sys .version_info < (3 , 2 ), "python version doesn't support assertWarns" )
33
29
def test_create_session_retry_not_raise_warning (self ):
34
30
keywords = SessionKeywords ()
35
31
with self .assertRaises (AssertionError ):
You can’t perform that action at this time.
0 commit comments