Yelp / fuzz-lightyear

A pytest-inspired, DAST framework, capable of identifying vulnerabilities in a distributed, micro-service ecosystem through chaos engineering testing and stateful, Swagger fuzzing.
Other
205 stars 25 forks source link

fixtures should remain static during fixture construction #13

Closed domanchi closed 4 years ago

domanchi commented 5 years ago

Issue

Essentially, this test case.

diff --git a/tests/integration/supplements/factory_integration_test.py b/tests/integration/supplements/factory_integration_test.py
index 8361f33..9431d4f 100644
--- a/tests/integration/supplements/factory_integration_test.py
+++ b/tests/integration/supplements/factory_integration_test.py
@@ -16,3 +16,33 @@ def test_type_hinting(mock_client):

     assert request.fuzzed_input['string'] == '1'
     assert request.fuzzed_input['integer'] == 1
+
+
+def test_session_fixtures(mock_client):
+    count = 0
+    def nested_function():
+        nonlocal count
+        count += 1
+        return count
+
+    def child_a(nested):
+        return nested
+
+    def child_b(nested):
+        return nested
+
+    def function(a, b):
+        assert a == b
+        return 'does_not_matter'
+
+    fuzz_lightyear.register_factory('nested')(nested_function)
+    fuzz_lightyear.register_factory('a')(child_a)
+    fuzz_lightyear.register_factory('b')(child_b)
+    fuzz_lightyear.register_factory('string')(function)
+
+    request = FuzzingRequest(
+        operation_id='get_expect_primitives',
+        tag='types',
+    )
+    request.send()
+
domanchi commented 4 years ago

Changes have been made, and improvements have been ticketed (https://github.com/Yelp/fuzz-lightyear/issues/19). Closing.