1919import pytest
2020from _pytest .config .argparsing import Parser
2121from delayed_assert import assert_expectations , expect
22- from requests .exceptions import RequestException
2322
2423from pytest_reportportal .config import AgentConfig
2524from pytest_reportportal .plugin import (
@@ -117,8 +116,6 @@ def test_pytest_configure_misssing_rp_endpoint(mocked_log, mocked_config):
117116 )
118117
119118
120- @mock .patch ("pytest_reportportal.plugin.requests.get" , mock .Mock ())
121- @mock .patch ("pytest_reportportal.plugin.LOGGER" , wraps = LOGGER )
122119def test_pytest_configure_misssing_rp_project (mocked_log , mocked_config ):
123120 """Test plugin configuration in case of missing rp_project.
124121
@@ -141,53 +138,6 @@ def test_pytest_configure_misssing_rp_project(mocked_log, mocked_config):
141138 )
142139
143140
144- @mock .patch ("pytest_reportportal.plugin.requests.get" , mock .Mock ())
145- @mock .patch ("pytest_reportportal.plugin.LOGGER" , wraps = LOGGER )
146- def test_pytest_configure_misssing_rp_uuid (mocked_log , mocked_config ):
147- """Test plugin configuration in case of missing rp_uuid.
148-
149- The value of the _reportportal_configured attribute of the pytest Config
150- object should be changed to False, stopping plugin configuration, if
151- rp_uuid is not set.
152-
153- :param mocked_config: Pytest fixture
154- """
155- mocked_config .option .rp_enabled = True
156- mocked_config .option .rp_api_key = None
157- mocked_config .getini .return_value = 0
158- pytest_configure (mocked_config )
159- assert mocked_config ._rp_enabled is False
160- mocked_log .debug .assert_has_calls (
161- [
162- mock .call (
163- MANDATORY_PARAMETER_MISSED_PATTERN .format (
164- mocked_config .option .rp_project , mocked_config .option .rp_endpoint
165- )
166- ),
167- mock .call ("Disabling reporting to RP." ),
168- ]
169- )
170-
171-
172- @mock .patch ("pytest_reportportal.plugin.requests.get" )
173- def test_pytest_configure_on_conn_error (mocked_get , mocked_config ):
174- """Test plugin configuration in case of HTTP error.
175-
176- The value of the _reportportal_configured attribute of the pytest Config
177- object should be changed to False, stopping plugin configuration, if HTTP
178- error occurs getting HTTP response from the ReportPortal.
179- :param mocked_get: Instance of the MagicMock
180- :param mocked_config: Pytest fixture
181- """
182- mock_response = mock .Mock ()
183- mock_response .raise_for_status .side_effect = RequestException ()
184- mocked_get .return_value = mock_response
185- mocked_config .option .rp_enabled = True
186- mocked_config .option .rp_skip_connection_test = "False"
187- pytest_configure (mocked_config )
188- assert mocked_config ._rp_enabled is False
189-
190-
191141@mock .patch ("pytest_reportportal.plugin.LAUNCH_WAIT_TIMEOUT" , 1 )
192142@mock .patch ("pytest_reportportal.plugin.time" )
193143def test_wait_launch (time_mock ):
0 commit comments