@@ -31,6 +31,14 @@ def response_error(*args, **kwargs):
31
31
return result
32
32
33
33
34
+ def invalid_response (* args , ** kwargs ):
35
+ result = Response ()
36
+ result ._content = \
37
+ '<html><head><title>405 Not Allowed</title></head></html>'
38
+ result .status_code = 405
39
+ return result
40
+
41
+
34
42
@pytest .mark .parametrize (
35
43
'requests_method, client_method, client_params, expected_result' ,
36
44
[
@@ -59,6 +67,29 @@ def test_connection_errors(rp_client, requests_method, client_method,
59
67
assert result == expected_result
60
68
61
69
70
+ @pytest .mark .parametrize (
71
+ 'requests_method, client_method, client_params' ,
72
+ [
73
+ ('put' , 'finish_launch' , [timestamp ()]),
74
+ ('put' , 'finish_test_item' , ['test_item_id' , timestamp ()]),
75
+ ('get' , 'get_item_id_by_uuid' , ['test_item_uuid' ]),
76
+ ('get' , 'get_launch_info' , []),
77
+ ('get' , 'get_launch_ui_id' , []),
78
+ ('get' , 'get_launch_ui_url' , []),
79
+ ('get' , 'get_project_settings' , []),
80
+ ('post' , 'start_launch' , ['Test Launch' , timestamp ()]),
81
+ ('post' , 'start_test_item' , ['Test Item' , timestamp (), 'STEP' ]),
82
+ ('put' , 'update_test_item' , ['test_item_id' ])
83
+ ]
84
+ )
85
+ def test_invalid_responses (rp_client , requests_method , client_method ,
86
+ client_params ):
87
+ rp_client .launch_id = 'test_launch_id'
88
+ getattr (rp_client .session , requests_method ).side_effect = invalid_response
89
+ result = getattr (rp_client , client_method )(* client_params )
90
+ assert result is None
91
+
92
+
62
93
LAUNCH_ID = 333
63
94
EXPECTED_DEFAULT_URL = 'http://endpoint/ui/#project/launches/all/' + str (
64
95
LAUNCH_ID )
0 commit comments