testit-adapter-pytest 5.2.0__tar.gz → 5.2.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. {testit_adapter_pytest-5.2.0 → testit_adapter_pytest-5.2.2}/PKG-INFO +17 -2
  2. {testit_adapter_pytest-5.2.0 → testit_adapter_pytest-5.2.2}/README.md +15 -0
  3. {testit_adapter_pytest-5.2.0 → testit_adapter_pytest-5.2.2}/setup.py +1 -1
  4. {testit_adapter_pytest-5.2.0 → testit_adapter_pytest-5.2.2}/src/testit_adapter_pytest.egg-info/PKG-INFO +17 -2
  5. {testit_adapter_pytest-5.2.0 → testit_adapter_pytest-5.2.2}/src/testit_adapter_pytest.egg-info/SOURCES.txt +2 -1
  6. testit_adapter_pytest-5.2.2/src/testit_adapter_pytest.egg-info/requires.txt +4 -0
  7. testit_adapter_pytest-5.2.2/tests/test_xss_parametrize_escape.py +39 -0
  8. testit_adapter_pytest-5.2.0/src/testit_adapter_pytest.egg-info/requires.txt +0 -4
  9. {testit_adapter_pytest-5.2.0 → testit_adapter_pytest-5.2.2}/setup.cfg +0 -0
  10. {testit_adapter_pytest-5.2.0 → testit_adapter_pytest-5.2.2}/src/testit_adapter_pytest/__init__.py +0 -0
  11. {testit_adapter_pytest-5.2.0 → testit_adapter_pytest-5.2.2}/src/testit_adapter_pytest/fixture_context.py +0 -0
  12. {testit_adapter_pytest-5.2.0 → testit_adapter_pytest-5.2.2}/src/testit_adapter_pytest/listener.py +0 -0
  13. {testit_adapter_pytest-5.2.0 → testit_adapter_pytest-5.2.2}/src/testit_adapter_pytest/models/__init__.py +0 -0
  14. {testit_adapter_pytest-5.2.0 → testit_adapter_pytest-5.2.2}/src/testit_adapter_pytest/models/executable_test.py +0 -0
  15. {testit_adapter_pytest-5.2.0 → testit_adapter_pytest-5.2.2}/src/testit_adapter_pytest/plugin.py +0 -0
  16. {testit_adapter_pytest-5.2.0 → testit_adapter_pytest-5.2.2}/src/testit_adapter_pytest/utils.py +0 -0
  17. {testit_adapter_pytest-5.2.0 → testit_adapter_pytest-5.2.2}/src/testit_adapter_pytest.egg-info/dependency_links.txt +0 -0
  18. {testit_adapter_pytest-5.2.0 → testit_adapter_pytest-5.2.2}/src/testit_adapter_pytest.egg-info/entry_points.txt +0 -0
  19. {testit_adapter_pytest-5.2.0 → testit_adapter_pytest-5.2.2}/src/testit_adapter_pytest.egg-info/top_level.txt +0 -0
  20. {testit_adapter_pytest-5.2.0 → testit_adapter_pytest-5.2.2}/tests/test_addoption.py +0 -0
  21. {testit_adapter_pytest-5.2.0 → testit_adapter_pytest-5.2.2}/tests/test_listener.py +0 -0
  22. {testit_adapter_pytest-5.2.0 → testit_adapter_pytest-5.2.2}/tests/test_pytest_layer.py +0 -0
  23. {testit_adapter_pytest-5.2.0 → testit_adapter_pytest-5.2.2}/tests/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: testit-adapter-pytest
3
- Version: 5.2.0
3
+ Version: 5.2.2
4
4
  Summary: Pytest adapter for Test IT
5
5
  Home-page: https://github.com/testit-tms/adapters-python/
6
6
  Author: Integration team
@@ -16,7 +16,7 @@ Description-Content-Type: text/markdown
16
16
  Requires-Dist: pytest
17
17
  Requires-Dist: pytest-xdist
18
18
  Requires-Dist: attrs
19
- Requires-Dist: testit-python-commons==5.2.0
19
+ Requires-Dist: testit-python-commons==5.2.2
20
20
  Dynamic: author
21
21
  Dynamic: author-email
22
22
  Dynamic: classifier
@@ -143,6 +143,7 @@ Description of decorators:
143
143
  - `testit.labels` - labels listed in the autotest card
144
144
  - `testit.tags` - tags listed in the autotest card
145
145
  - `testit.links` - links listed in the autotest card
146
+ - `testit.layer` - test pyramid layer on the autotest card (source `Run`). Recommended values: `testit.TestLayers` (`E2E`, `UI`, `API`, `Contract`, `Integration`, `Component`, `Unit`); any non-empty string is accepted. Also supported as `@pytest.mark.layer("API")`
146
147
  - `testit.step` - the designation of the step called in the body of the test or other step
147
148
  - `testit.nameSpace` - directory in the TMS system (default - file's name of test)
148
149
  - `testit.className` - subdirectory in the TMS system (default - class's name of test)
@@ -215,6 +216,20 @@ def oneTwoStep():
215
216
  @pytest.mark.skipif(True, reason='Because i can')
216
217
  def test_skip():
217
218
  assert True
219
+
220
+
221
+ # Layer via decorator
222
+ @testit.externalId('api_layer_test')
223
+ @testit.layer(testit.TestLayers.API)
224
+ def test_with_layer_decorator():
225
+ assert True
226
+
227
+
228
+ # Layer via pytest mark
229
+ @testit.externalId('ui_layer_test')
230
+ @pytest.mark.layer("UI")
231
+ def test_with_layer_mark():
232
+ assert True
218
233
  ```
219
234
 
220
235
  #### Parameterized test
@@ -114,6 +114,7 @@ Description of decorators:
114
114
  - `testit.labels` - labels listed in the autotest card
115
115
  - `testit.tags` - tags listed in the autotest card
116
116
  - `testit.links` - links listed in the autotest card
117
+ - `testit.layer` - test pyramid layer on the autotest card (source `Run`). Recommended values: `testit.TestLayers` (`E2E`, `UI`, `API`, `Contract`, `Integration`, `Component`, `Unit`); any non-empty string is accepted. Also supported as `@pytest.mark.layer("API")`
117
118
  - `testit.step` - the designation of the step called in the body of the test or other step
118
119
  - `testit.nameSpace` - directory in the TMS system (default - file's name of test)
119
120
  - `testit.className` - subdirectory in the TMS system (default - class's name of test)
@@ -186,6 +187,20 @@ def oneTwoStep():
186
187
  @pytest.mark.skipif(True, reason='Because i can')
187
188
  def test_skip():
188
189
  assert True
190
+
191
+
192
+ # Layer via decorator
193
+ @testit.externalId('api_layer_test')
194
+ @testit.layer(testit.TestLayers.API)
195
+ def test_with_layer_decorator():
196
+ assert True
197
+
198
+
199
+ # Layer via pytest mark
200
+ @testit.externalId('ui_layer_test')
201
+ @pytest.mark.layer("UI")
202
+ def test_with_layer_mark():
203
+ assert True
189
204
  ```
190
205
 
191
206
  #### Parameterized test
@@ -1,6 +1,6 @@
1
1
  from setuptools import find_packages, setup
2
2
 
3
- VERSION = "5.2.0"
3
+ VERSION = "5.2.2"
4
4
 
5
5
  setup(
6
6
  name='testit-adapter-pytest',
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: testit-adapter-pytest
3
- Version: 5.2.0
3
+ Version: 5.2.2
4
4
  Summary: Pytest adapter for Test IT
5
5
  Home-page: https://github.com/testit-tms/adapters-python/
6
6
  Author: Integration team
@@ -16,7 +16,7 @@ Description-Content-Type: text/markdown
16
16
  Requires-Dist: pytest
17
17
  Requires-Dist: pytest-xdist
18
18
  Requires-Dist: attrs
19
- Requires-Dist: testit-python-commons==5.2.0
19
+ Requires-Dist: testit-python-commons==5.2.2
20
20
  Dynamic: author
21
21
  Dynamic: author-email
22
22
  Dynamic: classifier
@@ -143,6 +143,7 @@ Description of decorators:
143
143
  - `testit.labels` - labels listed in the autotest card
144
144
  - `testit.tags` - tags listed in the autotest card
145
145
  - `testit.links` - links listed in the autotest card
146
+ - `testit.layer` - test pyramid layer on the autotest card (source `Run`). Recommended values: `testit.TestLayers` (`E2E`, `UI`, `API`, `Contract`, `Integration`, `Component`, `Unit`); any non-empty string is accepted. Also supported as `@pytest.mark.layer("API")`
146
147
  - `testit.step` - the designation of the step called in the body of the test or other step
147
148
  - `testit.nameSpace` - directory in the TMS system (default - file's name of test)
148
149
  - `testit.className` - subdirectory in the TMS system (default - class's name of test)
@@ -215,6 +216,20 @@ def oneTwoStep():
215
216
  @pytest.mark.skipif(True, reason='Because i can')
216
217
  def test_skip():
217
218
  assert True
219
+
220
+
221
+ # Layer via decorator
222
+ @testit.externalId('api_layer_test')
223
+ @testit.layer(testit.TestLayers.API)
224
+ def test_with_layer_decorator():
225
+ assert True
226
+
227
+
228
+ # Layer via pytest mark
229
+ @testit.externalId('ui_layer_test')
230
+ @pytest.mark.layer("UI")
231
+ def test_with_layer_mark():
232
+ assert True
218
233
  ```
219
234
 
220
235
  #### Parameterized test
@@ -16,4 +16,5 @@ src/testit_adapter_pytest/models/executable_test.py
16
16
  tests/test_addoption.py
17
17
  tests/test_listener.py
18
18
  tests/test_pytest_layer.py
19
- tests/test_utils.py
19
+ tests/test_utils.py
20
+ tests/test_xss_parametrize_escape.py
@@ -0,0 +1,4 @@
1
+ pytest
2
+ pytest-xdist
3
+ attrs
4
+ testit-python-commons==5.2.2
@@ -0,0 +1,39 @@
1
+ """Ensure pytest parametrize XSS values are escaped in TestResult / API payload."""
2
+
3
+ from testit_adapter_pytest.models.executable_test import ExecutableTest
4
+ from testit_adapter_pytest.utils import convert_executable_test_to_test_result_model
5
+ from testit_python_commons.client.converter import Converter
6
+ from adapters_api import ApiClient
7
+
8
+
9
+ def test_parametrize_script_payload_escaped_in_parameters_and_external_key():
10
+ payload = '<script>alert("1")</script>'
11
+ executable = ExecutableTest(
12
+ external_id="xss_ext",
13
+ name=f"with xss {payload}",
14
+ duration=1,
15
+ parameters={"description": payload},
16
+ properties={},
17
+ namespace="tests",
18
+ classname=None,
19
+ title=None,
20
+ description=None,
21
+ links=[],
22
+ labels=[],
23
+ tags=[],
24
+ work_item_ids=[],
25
+ node_id=f"tests/test_xss_parametrize.py::test_05_with_chg_xss[{payload}]",
26
+ outcome="Passed",
27
+ status_type="Succeeded",
28
+ )
29
+
30
+ test_result = convert_executable_test_to_test_result_model(executable)
31
+ assert test_result.get_parameters()["description"] == '&lt;script&gt;alert("1")&lt;/script&gt;'
32
+ assert "<script>" not in test_result.get_autotest_name()
33
+ assert "&lt;script&gt;" in test_result.get_external_key()
34
+
35
+ model = Converter.test_result_to_testrun_result_post_model(
36
+ test_result, "cfg", ["PASSED"])
37
+ body = ApiClient.sanitize_for_serialization(model)
38
+ assert body["parameters"]["description"] == '&lt;script&gt;alert("1")&lt;/script&gt;'
39
+ assert "<script>" not in body["parameters"]["description"]
@@ -1,4 +0,0 @@
1
- pytest
2
- pytest-xdist
3
- attrs
4
- testit-python-commons==5.2.0