|
| 1 | +# Copyright 2024 EPAM Systems |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# https://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +from unittest import mock |
| 16 | + |
| 17 | +from tests import REPORT_PORTAL_SERVICE |
| 18 | +from tests.helpers import utils |
| 19 | + |
| 20 | + |
| 21 | +@mock.patch(REPORT_PORTAL_SERVICE) |
| 22 | +def test_custom_attribute_report(mock_client_init): |
| 23 | + result = utils.run_pytest_tests(tests=['examples/test_max_item_name.py'], variables=utils.DEFAULT_VARIABLES) |
| 24 | + assert int(result) == 0, 'Exit code should be 0 (no errors)' |
| 25 | + |
| 26 | + mock_client = mock_client_init.return_value |
| 27 | + start_count = mock_client.start_test_item.call_count |
| 28 | + finish_count = mock_client.finish_test_item.call_count |
| 29 | + assert start_count == finish_count == 1, 'Incorrect number of "start_test_item" or "finish_test_item" calls' |
| 30 | + |
| 31 | + call_args = mock_client.start_test_item.call_args_list |
| 32 | + step_call_args = call_args[0][1] |
| 33 | + assert len(step_call_args['name']) == 1024, 'Incorrect item name length' |
0 commit comments