|
| 1 | +# Copyright (c) 2022 https://reportportal.io . |
| 2 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 3 | +# you may not use this file except in compliance with the License. |
| 4 | +# You may obtain a copy of the License at |
| 5 | +# |
| 6 | +# https://www.apache.org/licenses/LICENSE-2.0 |
| 7 | +# |
| 8 | +# Unless required by applicable law or agreed to in writing, software |
| 9 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 10 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 11 | +# See the License for the specific language governing permissions and |
| 12 | +# limitations under the License |
| 13 | +from reportportal_client import step |
| 14 | + |
| 15 | +NESTED_STEP_NAME = 'test nested step' |
| 16 | +PARENT_STEP_ID = '123-123-1234-123' |
| 17 | +NESTED_STEP_ID = '321-321-4321-321' |
| 18 | + |
| 19 | + |
| 20 | +def test_nested_steps_are_skipped_without_parent(rp_client): |
| 21 | + with step(NESTED_STEP_NAME, rp_client=rp_client): |
| 22 | + print("Hello nested steps") |
| 23 | + assert rp_client.session.post.call_count == 0 |
| 24 | + assert rp_client.session.put.call_count == 0 |
| 25 | + |
| 26 | + |
| 27 | +def test_nested_steps_reported_with_parent(rp_client): |
| 28 | + rp_client.step_reporter.set_parent('STEP', PARENT_STEP_ID) |
| 29 | + |
| 30 | + with step(NESTED_STEP_NAME, rp_client=rp_client): |
| 31 | + print("Hello nested steps") |
| 32 | + assert rp_client.session.post.call_count == 1 |
| 33 | + assert rp_client.session.put.call_count == 1 |
0 commit comments