wingify-fme-python-sdk 1.70.0__py3-none-any.whl

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 (186) hide show
  1. tests/data/__init__.py +13 -0
  2. tests/data/dummy_test_data_reader.py +63 -0
  3. tests/data/user_storage.py +48 -0
  4. tests/e2e/__init__.py +13 -0
  5. tests/e2e/custom_bucketing_test.py +514 -0
  6. tests/e2e/force_users_test.py +368 -0
  7. tests/e2e/get_flag_test.py +195 -0
  8. tests/unit/__init__.py +13 -0
  9. tests/unit/packages/__init__.py +13 -0
  10. tests/unit/packages/decision_maker/__init__.py +13 -0
  11. tests/unit/packages/decision_maker/decision_maker_test.py +83 -0
  12. tests/unit/packages/segmentation_evaluator/__init__.py +13 -0
  13. tests/unit/packages/segmentation_evaluator/segmentation_evaluator_test.py +284 -0
  14. tests/unit/packages/segmentation_evaluator/segmentation_manager_test.py +215 -0
  15. tests/unit/packages/segmentation_evaluator/web_testing_segment_test.py +216 -0
  16. tests/unit/services/__init__.py +0 -0
  17. tests/unit/services/hooks_manager_test.py +80 -0
  18. tests/unit/services/internal_events_sampling_service_test.py +160 -0
  19. tests/unit/settings/__init__.py +13 -0
  20. tests/unit/settings/settings_schema_validation_test.py +67 -0
  21. tests/unit/utils/__init__.py +0 -0
  22. tests/unit/utils/campaign_util_test.py +248 -0
  23. tests/unit/utils/decision_util_force_users_test.py +790 -0
  24. tests/unit/utils/log_message_test.py +65 -0
  25. tests/unit/vwo_wingify_test.py +175 -0
  26. tests/unit/wingify_client_validation_test.py +72 -0
  27. vwo/__init__.py +35 -0
  28. vwo/models/__init__.py +13 -0
  29. vwo/models/batch_event_data.py +19 -0
  30. vwo/models/user/__init__.py +13 -0
  31. vwo/models/user/context_vwo_model.py +21 -0
  32. vwo/models/user/get_flag.py +19 -0
  33. vwo/models/vwo_options_model.py +21 -0
  34. vwo/packages/__init__.py +13 -0
  35. vwo/packages/logger/__init__.py +13 -0
  36. vwo/packages/logger/enums/__init__.py +13 -0
  37. vwo/packages/logger/enums/log_level_enum.py +19 -0
  38. vwo/packages/storage/__init__.py +13 -0
  39. vwo/packages/storage/connector.py +19 -0
  40. vwo/vwo.py +58 -0
  41. vwo/vwo_builder.py +21 -0
  42. vwo/vwo_client.py +22 -0
  43. wingify/__init__.py +36 -0
  44. wingify/api/__init__.py +13 -0
  45. wingify/api/get_flag_api.py +727 -0
  46. wingify/api/set_attribute_api.py +60 -0
  47. wingify/api/track_api.py +99 -0
  48. wingify/constants/Constants.py +94 -0
  49. wingify/constants/__init__.py +13 -0
  50. wingify/constants/sampled_debug_error_template_keys.py +34 -0
  51. wingify/decorators/__init__.py +13 -0
  52. wingify/decorators/storage_decorator.py +92 -0
  53. wingify/enums/__init__.py +13 -0
  54. wingify/enums/api_enum.py +26 -0
  55. wingify/enums/campaign_type_enum.py +22 -0
  56. wingify/enums/debug_category_enum.py +24 -0
  57. wingify/enums/event_enum.py +26 -0
  58. wingify/enums/headers_enum.py +21 -0
  59. wingify/enums/hooks_enum.py +24 -0
  60. wingify/enums/status_enum.py +21 -0
  61. wingify/enums/storage_enum.py +25 -0
  62. wingify/enums/url_enum.py +29 -0
  63. wingify/models/Alias.py +60 -0
  64. wingify/models/AliasSetResponse.py +43 -0
  65. wingify/models/__init__.py +13 -0
  66. wingify/models/batch_event_data.py +68 -0
  67. wingify/models/campaign/__init__.py +13 -0
  68. wingify/models/campaign/campaign_model.py +140 -0
  69. wingify/models/campaign/feature_model.py +95 -0
  70. wingify/models/campaign/holdout_model.py +94 -0
  71. wingify/models/campaign/impact_campaign_model.py +60 -0
  72. wingify/models/campaign/metric_model.py +42 -0
  73. wingify/models/campaign/rule_model.py +42 -0
  74. wingify/models/campaign/variable_model.py +44 -0
  75. wingify/models/campaign/variation_model.py +109 -0
  76. wingify/models/gateway_service_model.py +48 -0
  77. wingify/models/schemas/__init__.py +13 -0
  78. wingify/models/schemas/campaign_group_schema.py +19 -0
  79. wingify/models/schemas/campaign_metric_schema.py +26 -0
  80. wingify/models/schemas/campaign_schema.py +37 -0
  81. wingify/models/schemas/campaign_variation_schema.py +34 -0
  82. wingify/models/schemas/empty_object_schema.py +15 -0
  83. wingify/models/schemas/feature_schema.py +38 -0
  84. wingify/models/schemas/group_schema.py +37 -0
  85. wingify/models/schemas/holdout_schema.py +29 -0
  86. wingify/models/schemas/rule_schema.py +24 -0
  87. wingify/models/schemas/settings_schema.py +47 -0
  88. wingify/models/schemas/variable_schema.py +24 -0
  89. wingify/models/settings/__init__.py +13 -0
  90. wingify/models/settings/internal_event_sampling_settings_model.py +53 -0
  91. wingify/models/settings/settings_model.py +127 -0
  92. wingify/models/storage/__init__.py +13 -0
  93. wingify/models/storage/storage_model.py +84 -0
  94. wingify/models/user/__init__.py +13 -0
  95. wingify/models/user/context_model.py +113 -0
  96. wingify/models/user/context_vwo_model.py +34 -0
  97. wingify/models/user/get_flag.py +47 -0
  98. wingify/models/vwo_options_model.py +21 -0
  99. wingify/models/wingify_options_model.py +129 -0
  100. wingify/packages/__init__.py +13 -0
  101. wingify/packages/decision_maker/__init__.py +13 -0
  102. wingify/packages/decision_maker/decision_maker.py +89 -0
  103. wingify/packages/logger/__init__.py +13 -0
  104. wingify/packages/logger/core/__init__.py +13 -0
  105. wingify/packages/logger/core/log_manager.py +123 -0
  106. wingify/packages/logger/core/log_transport_manager.py +57 -0
  107. wingify/packages/logger/enums/__init__.py +13 -0
  108. wingify/packages/logger/enums/log_level_enum.py +24 -0
  109. wingify/packages/logger/enums/log_level_number_enum.py +21 -0
  110. wingify/packages/logger/log_message_builder.py +70 -0
  111. wingify/packages/logger/logger.py +38 -0
  112. wingify/packages/logger/transports/__init__.py +13 -0
  113. wingify/packages/logger/transports/console_transport.py +43 -0
  114. wingify/packages/network_layer/__init__.py +13 -0
  115. wingify/packages/network_layer/client/__init__.py +13 -0
  116. wingify/packages/network_layer/client/network_client.py +167 -0
  117. wingify/packages/network_layer/handlers/__init__.py +13 -0
  118. wingify/packages/network_layer/handlers/request_handler.py +40 -0
  119. wingify/packages/network_layer/manager/__init__.py +13 -0
  120. wingify/packages/network_layer/manager/network_manager.py +79 -0
  121. wingify/packages/network_layer/models/__init__.py +13 -0
  122. wingify/packages/network_layer/models/global_request_model.py +70 -0
  123. wingify/packages/network_layer/models/request_model.py +133 -0
  124. wingify/packages/network_layer/models/response_model.py +55 -0
  125. wingify/packages/segmentation_evaluator/__init__.py +13 -0
  126. wingify/packages/segmentation_evaluator/core/__init__.py +13 -0
  127. wingify/packages/segmentation_evaluator/core/segmentation_manager.py +140 -0
  128. wingify/packages/segmentation_evaluator/enums/__init__.py +13 -0
  129. wingify/packages/segmentation_evaluator/enums/segment_operand_regex_enum.py +31 -0
  130. wingify/packages/segmentation_evaluator/enums/segment_operand_value_enum.py +29 -0
  131. wingify/packages/segmentation_evaluator/enums/segment_operator_value_enum.py +37 -0
  132. wingify/packages/segmentation_evaluator/evaluators/__init__.py +13 -0
  133. wingify/packages/segmentation_evaluator/evaluators/segment_evaluator.py +237 -0
  134. wingify/packages/segmentation_evaluator/evaluators/segment_operand_evaluator.py +518 -0
  135. wingify/packages/segmentation_evaluator/utils/__init__.py +13 -0
  136. wingify/packages/segmentation_evaluator/utils/segment_util.py +33 -0
  137. wingify/packages/segmentation_evaluator/utils/web_testing_segment_util.py +295 -0
  138. wingify/packages/storage/__init__.py +13 -0
  139. wingify/packages/storage/connector.py +25 -0
  140. wingify/packages/storage/storage.py +39 -0
  141. wingify/resources/__init__.py +13 -0
  142. wingify/resources/debug-messages.json +21 -0
  143. wingify/resources/error-messages.json +62 -0
  144. wingify/resources/info-message.json +47 -0
  145. wingify/resources/trace-messages.json +1 -0
  146. wingify/resources/warn-messages.json +1 -0
  147. wingify/services/__init__.py +13 -0
  148. wingify/services/batch_event_queue.py +140 -0
  149. wingify/services/campaign_decision_service.py +268 -0
  150. wingify/services/hooks_manager.py +65 -0
  151. wingify/services/internal_events_sampling_service.py +62 -0
  152. wingify/services/settings_manager.py +293 -0
  153. wingify/services/storage_service.py +58 -0
  154. wingify/services/url_service.py +51 -0
  155. wingify/utils/__init__.py +13 -0
  156. wingify/utils/aliasing_util.py +108 -0
  157. wingify/utils/brand_context.py +26 -0
  158. wingify/utils/brand_util.py +37 -0
  159. wingify/utils/campaign_util.py +592 -0
  160. wingify/utils/data_type_util.py +125 -0
  161. wingify/utils/debugger_service_util.py +58 -0
  162. wingify/utils/decision_util.py +589 -0
  163. wingify/utils/event_util.py +85 -0
  164. wingify/utils/function_util.py +188 -0
  165. wingify/utils/gateway_service_util.py +179 -0
  166. wingify/utils/holdout_util.py +264 -0
  167. wingify/utils/impression_util.py +151 -0
  168. wingify/utils/internal_events_sampling_util.py +106 -0
  169. wingify/utils/log_message_util.py +95 -0
  170. wingify/utils/meg_util.py +561 -0
  171. wingify/utils/model_utils.py +136 -0
  172. wingify/utils/network_util.py +706 -0
  173. wingify/utils/rule_evaluation_util.py +102 -0
  174. wingify/utils/settings_util.py +39 -0
  175. wingify/utils/usage_stats_util.py +116 -0
  176. wingify/utils/uuid_util.py +81 -0
  177. wingify/vwo_client.py +21 -0
  178. wingify/wingify.py +159 -0
  179. wingify/wingify_builder.py +282 -0
  180. wingify/wingify_client.py +520 -0
  181. wingify_fme_python_sdk-1.70.0.dist-info/METADATA +1415 -0
  182. wingify_fme_python_sdk-1.70.0.dist-info/RECORD +186 -0
  183. wingify_fme_python_sdk-1.70.0.dist-info/WHEEL +5 -0
  184. wingify_fme_python_sdk-1.70.0.dist-info/licenses/LICENSE +202 -0
  185. wingify_fme_python_sdk-1.70.0.dist-info/licenses/NOTICE +18 -0
  186. wingify_fme_python_sdk-1.70.0.dist-info/top_level.txt +3 -0
@@ -0,0 +1,65 @@
1
+ # Copyright 2024-2026 Wingify Software Pvt. Ltd.
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
+ # http://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
+ """Unit tests for SDK error message templates."""
16
+
17
+ import unittest
18
+
19
+ from wingify.utils.log_message_util import error_messages
20
+
21
+
22
+ class LogMessageTest(unittest.TestCase):
23
+ """Tests for ``error-messages.json`` template strings."""
24
+
25
+ def test_event_not_found_message_includes_api_name_guidance(self):
26
+ """
27
+ Verify ``EVENT_NOT_FOUND`` guides users to use the event API name.
28
+
29
+ When ``trackEvent`` is called with a display name (e.g. ``click_element``)
30
+ instead of the API name (``clickElement``), the log should include API-name guidance.
31
+
32
+ :return: None. Asserts event name and API-name guidance appear in message.
33
+ """
34
+ message = error_messages["EVENT_NOT_FOUND"].format(eventName="click_element")
35
+ self.assertIn("click_element", message)
36
+ self.assertIn(
37
+ "please ensure event API name is being used correctly", message
38
+ )
39
+
40
+ def test_invalid_context_user_id_message(self):
41
+ """
42
+ Verify ``INVALID_CONTEXT_USER_ID`` uses the expected error wording.
43
+
44
+ :return: None. Asserts exact template string matches expected message.
45
+ """
46
+ self.assertEqual(
47
+ error_messages["INVALID_CONTEXT_USER_ID"],
48
+ "user_id under context must be a string value",
49
+ )
50
+
51
+ def test_integrations_callback_failed_message_includes_error(self):
52
+ """
53
+ Verify ``INTEGRATIONS_CALLBACK_FAILED`` includes callback context and error detail.
54
+
55
+ :return: None. Asserts formatted message contains callback label and error text.
56
+ """
57
+ message = error_messages["INTEGRATIONS_CALLBACK_FAILED"].format(
58
+ err="boom"
59
+ )
60
+ self.assertIn("integrations_callback", message)
61
+ self.assertIn("boom", message)
62
+
63
+
64
+ if __name__ == "__main__":
65
+ unittest.main()
@@ -0,0 +1,175 @@
1
+ # Copyright 2024-2026 Wingify Software Pvt. Ltd.
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
+ # http://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
+ import importlib
16
+ import unittest
17
+ import unittest.mock
18
+
19
+ from wingify.utils.brand_util import (
20
+ get_brand,
21
+ get_events_hostname,
22
+ get_log_prefix,
23
+ get_sdk_name,
24
+ get_settings_hostname,
25
+ )
26
+ from wingify.utils.brand_context import set_is_via_vwo
27
+ from wingify.utils.log_message_util import refresh_log_messages, info_messages
28
+
29
+
30
+ class RuntimeBrandTest(unittest.TestCase):
31
+ """Brand is selected at init via is_via_vwo"""
32
+
33
+ def test_vwo_runtime_brand(self):
34
+ set_is_via_vwo(True)
35
+ refresh_log_messages(True)
36
+ self.assertEqual(get_sdk_name(True), "vwo-fme-python-sdk")
37
+ self.assertEqual(get_settings_hostname(True), "dev.visualwebsiteoptimizer.com")
38
+ self.assertEqual(get_events_hostname(True), "dev.visualwebsiteoptimizer.com")
39
+ self.assertEqual(get_log_prefix(True), "VWO-SDK")
40
+ self.assertEqual(get_brand(True), "VWO")
41
+
42
+ def test_wingify_runtime_brand(self):
43
+ set_is_via_vwo(False)
44
+ refresh_log_messages(False)
45
+ self.assertEqual(get_sdk_name(False), "wingify-fme-python-sdk")
46
+ self.assertEqual(get_settings_hostname(False), "edge.wingify.net")
47
+ self.assertEqual(get_events_hostname(False), "collect.wingify.net")
48
+ self.assertEqual(get_log_prefix(False), "Wingify-SDK")
49
+ self.assertEqual(get_brand(False), "Wingify")
50
+
51
+ def test_log_messages_use_runtime_brand(self):
52
+ refresh_log_messages(True)
53
+ sample = next(iter(info_messages.values()))
54
+ self.assertIn("VWO-SDK", sample)
55
+
56
+
57
+ class VwoFacadeTest(unittest.TestCase):
58
+ """Legacy VWO types must alias the Wingify core (same class objects)."""
59
+
60
+ def test_vwo_client_is_wingify_client(self):
61
+ from vwo.vwo_client import VWOClient
62
+ from wingify.wingify_client import WingifyClient
63
+
64
+ self.assertIs(VWOClient, WingifyClient)
65
+
66
+ def test_vwo_builder_is_wingify_builder(self):
67
+ from vwo.vwo_builder import VWOBuilder
68
+ from wingify.wingify_builder import WingifyBuilder
69
+
70
+ self.assertIs(VWOBuilder, WingifyBuilder)
71
+
72
+ def test_vwo_options_model_is_wingify_options_model(self):
73
+ from vwo.models.vwo_options_model import VWOOptionsModel
74
+ from wingify.models.wingify_options_model import WingifyOptionsModel
75
+
76
+ self.assertIs(VWOOptionsModel, WingifyOptionsModel)
77
+
78
+ def test_vwo_init_sets_is_via_vwo(self):
79
+ from vwo.vwo import init as vwo_init
80
+ from wingify.wingify import init as wingify_init
81
+
82
+ self.assertIsNot(vwo_init, wingify_init)
83
+ with unittest.mock.patch("wingify.wingify.Wingify.set_instance") as mock_set:
84
+ mock_set.return_value = None
85
+ vwo_init({"sdk_key": "k", "account_id": "1"})
86
+ options = mock_set.call_args[0][0]
87
+ self.assertTrue(options["is_via_vwo"])
88
+
89
+ def test_settings_manager_respects_is_via_vwo(self):
90
+ from wingify.services.settings_manager import SettingsManager
91
+
92
+ sm = SettingsManager({"sdk_key": "k", "account_id": "1", "is_via_vwo": True})
93
+ self.assertEqual(sm.get_sdk_name(), "vwo-fme-python-sdk")
94
+ self.assertEqual(sm.settings_hostname, "dev.visualwebsiteoptimizer.com")
95
+
96
+ sm2 = SettingsManager({"sdk_key": "k", "account_id": "1", "is_via_vwo": False})
97
+ self.assertEqual(sm2.get_sdk_name(), "wingify-fme-python-sdk")
98
+ self.assertEqual(sm2.settings_hostname, "edge.wingify.net")
99
+
100
+
101
+ class WingifyOptionsModelTest(unittest.TestCase):
102
+ """Dual meta and builder key support."""
103
+
104
+ def test_vwo_meta_fallback(self):
105
+ from wingify.models.wingify_options_model import WingifyOptionsModel
106
+
107
+ model = WingifyOptionsModel({"_vwo_meta": {"_vwo_sdkName": "custom-sdk"}})
108
+ self.assertEqual(model.get_sdk_name(), "custom-sdk")
109
+ self.assertEqual(model.get_vwo_meta(), {"_vwo_sdkName": "custom-sdk"})
110
+
111
+ def test_wingify_meta_preferred(self):
112
+ from wingify.models.wingify_options_model import WingifyOptionsModel
113
+
114
+ model = WingifyOptionsModel(
115
+ {
116
+ "_wingify_meta": {"_wingify_sdkName": "wingify-custom"},
117
+ "_vwo_meta": {"_vwo_sdkName": "vwo-custom"},
118
+ }
119
+ )
120
+ self.assertEqual(model.get_sdk_name(), "wingify-custom")
121
+
122
+ def test_vwo_builder_fallback(self):
123
+ from wingify.models.wingify_options_model import WingifyOptionsModel
124
+
125
+ builder = object()
126
+ model = WingifyOptionsModel({"vwoBuilder": builder})
127
+ self.assertIs(model.get_wingify_builder(), builder)
128
+
129
+
130
+ class WingifyPackageExportsTest(unittest.TestCase):
131
+ def test_wingify_public_exports(self):
132
+ import wingify
133
+
134
+ for name in wingify.__all__:
135
+ self.assertTrue(hasattr(wingify, name), f"Missing export: {name}")
136
+
137
+
138
+ class VwoPackageExportsTest(unittest.TestCase):
139
+ def test_vwo_public_exports(self):
140
+ import vwo
141
+
142
+ for name in vwo.__all__:
143
+ self.assertTrue(hasattr(vwo, name), f"Missing export: {name}")
144
+
145
+
146
+ class JavaStyleLayoutTest(unittest.TestCase):
147
+ """Core lives under wingify/; vwo/ holds facade files only."""
148
+
149
+ def test_core_api_under_wingify(self):
150
+ from pathlib import Path
151
+
152
+ root = Path(__file__).resolve().parents[2]
153
+ self.assertTrue((root / "wingify" / "api" / "get_flag_api.py").exists())
154
+ self.assertTrue((root / "wingify" / "constants" / "Constants.py").exists())
155
+
156
+ def test_vwo_has_facades_only(self):
157
+ from pathlib import Path
158
+
159
+ root = Path(__file__).resolve().parents[2]
160
+ vwo = root / "vwo"
161
+ for relative in (
162
+ "models/__init__.py",
163
+ "models/user/__init__.py",
164
+ "packages/__init__.py",
165
+ "packages/logger/__init__.py",
166
+ "packages/logger/enums/__init__.py",
167
+ "packages/storage/__init__.py",
168
+ ):
169
+ self.assertTrue((vwo / relative).is_file(), relative)
170
+ self.assertFalse((vwo / "services").exists())
171
+ self.assertFalse((vwo / "constants").exists())
172
+
173
+
174
+ if __name__ == "__main__":
175
+ unittest.main()
@@ -0,0 +1,72 @@
1
+ # Copyright 2024-2026 Wingify Software Pvt. Ltd.
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
+ # http://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
+ """Unit tests for ``WingifyClient._validate_context`` user ID validation."""
16
+
17
+ import unittest
18
+ from unittest.mock import patch
19
+
20
+ from wingify.packages.logger.core.log_manager import LogManager
21
+ from wingify.wingify_client import WingifyClient
22
+
23
+
24
+ class WingifyClientValidationTest(unittest.TestCase):
25
+ """Tests for context ``id`` type validation before UUID generation."""
26
+
27
+ def setUp(self):
28
+ """
29
+ Create a bare ``WingifyClient`` instance without running full SDK init.
30
+
31
+ :return: None.
32
+ """
33
+ LogManager({"level": "ERROR"})
34
+ # Skip __init__ — only _validate_context is under test
35
+ self.client = object.__new__(WingifyClient)
36
+
37
+ def test_validate_context_rejects_integer_user_id(self):
38
+ """
39
+ Verify integer ``context['id']`` raises ``ValueError`` with a clear message.
40
+
41
+ Logs ``INVALID_CONTEXT_USER_ID`` before raising so developers see a clear validation error.
42
+
43
+ :return: None. Asserts exception message and that error was logged.
44
+ """
45
+ with patch.object(LogManager.get_instance(), "error") as mock_error:
46
+ with self.assertRaises(ValueError) as ctx:
47
+ self.client._validate_context({"id": 123}, "getFlag")
48
+
49
+ self.assertIn("string value", str(ctx.exception))
50
+ mock_error.assert_called_once()
51
+
52
+ def test_validate_context_accepts_string_user_id(self):
53
+ """
54
+ Verify string ``context['id']`` passes validation without error.
55
+
56
+ :return: None. Asserts no exception is raised.
57
+ """
58
+ # Should complete without raising
59
+ self.client._validate_context({"id": "user-123"}, "getFlag")
60
+
61
+ def test_validate_context_rejects_missing_id(self):
62
+ """
63
+ Verify missing ``id`` in context raises ``ValueError``.
64
+
65
+ :return: None. Asserts ``ValueError`` is raised for empty context.
66
+ """
67
+ with self.assertRaises(ValueError):
68
+ self.client._validate_context({}, "trackEvent")
69
+
70
+
71
+ if __name__ == "__main__":
72
+ unittest.main()
vwo/__init__.py ADDED
@@ -0,0 +1,35 @@
1
+ # Copyright 2024-2026 Wingify Software Pvt. Ltd.
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
+ # http://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
+ """
16
+ Legacy VWO FME SDK — public package entry point.
17
+
18
+ Install via: pip install vwo-fme-python-sdk
19
+ All behavior delegates to the Wingify core; types are legacy aliases.
20
+ """
21
+
22
+ from vwo.vwo import init, getUUID, VWOClient, VWOBuilder
23
+ from vwo.models.vwo_options_model import VWOOptionsModel
24
+ from vwo.packages.storage.connector import StorageConnector
25
+ from vwo.packages.logger.enums.log_level_enum import LogLevelEnum
26
+
27
+ __all__ = [
28
+ "init",
29
+ "getUUID",
30
+ "VWOClient",
31
+ "VWOBuilder",
32
+ "VWOOptionsModel",
33
+ "StorageConnector",
34
+ "LogLevelEnum",
35
+ ]
vwo/models/__init__.py ADDED
@@ -0,0 +1,13 @@
1
+ # Copyright 2024-2026 Wingify Software Pvt. Ltd.
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
+ # http://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.
@@ -0,0 +1,19 @@
1
+ # Copyright 2024-2026 Wingify Software Pvt. Ltd.
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
+ # http://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
+ """Legacy VWO facade — alias over wingify.models.batch_event_data."""
16
+
17
+ from wingify.models.batch_event_data import BatchEventData
18
+
19
+ __all__ = ["BatchEventData"]
@@ -0,0 +1,13 @@
1
+ # Copyright 2024-2026 Wingify Software Pvt. Ltd.
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
+ # http://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.
@@ -0,0 +1,21 @@
1
+ # Copyright 2024-2026 Wingify Software Pvt. Ltd.
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
+ # http://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
+ """Legacy VWO facade — alias over wingify.models.user.context_vwo_model."""
16
+
17
+ from wingify.models.user.context_vwo_model import ContextVWOModel
18
+
19
+ VWOContext = ContextVWOModel
20
+
21
+ __all__ = ["ContextVWOModel", "VWOContext"]
@@ -0,0 +1,19 @@
1
+ # Copyright 2024-2026 Wingify Software Pvt. Ltd.
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
+ # http://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
+ """Legacy VWO facade — alias over wingify.models.user.get_flag."""
16
+
17
+ from wingify.models.user.get_flag import GetFlag
18
+
19
+ __all__ = ["GetFlag"]
@@ -0,0 +1,21 @@
1
+ # Copyright 2024-2026 Wingify Software Pvt. Ltd.
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
+ # http://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
+ """Legacy VWO options facade — alias over WingifyOptionsModel."""
16
+
17
+ from wingify.models.wingify_options_model import WingifyOptionsModel
18
+
19
+ VWOOptionsModel = WingifyOptionsModel
20
+
21
+ __all__ = ["VWOOptionsModel"]
@@ -0,0 +1,13 @@
1
+ # Copyright 2024-2026 Wingify Software Pvt. Ltd.
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
+ # http://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.
@@ -0,0 +1,13 @@
1
+ # Copyright 2024-2026 Wingify Software Pvt. Ltd.
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
+ # http://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.
@@ -0,0 +1,13 @@
1
+ # Copyright 2024-2026 Wingify Software Pvt. Ltd.
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
+ # http://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.
@@ -0,0 +1,19 @@
1
+ # Copyright 2024-2026 Wingify Software Pvt. Ltd.
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
+ # http://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
+ """Legacy VWO facade — alias over wingify.packages.logger.enums.log_level_enum."""
16
+
17
+ from wingify.packages.logger.enums.log_level_enum import LogLevelEnum
18
+
19
+ __all__ = ["LogLevelEnum"]
@@ -0,0 +1,13 @@
1
+ # Copyright 2024-2026 Wingify Software Pvt. Ltd.
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
+ # http://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.
@@ -0,0 +1,19 @@
1
+ # Copyright 2024-2026 Wingify Software Pvt. Ltd.
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
+ # http://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
+ """Legacy VWO facade — alias over wingify.packages.storage.connector."""
16
+
17
+ from wingify.packages.storage.connector import StorageConnector
18
+
19
+ __all__ = ["StorageConnector"]
vwo/vwo.py ADDED
@@ -0,0 +1,58 @@
1
+ # Copyright 2024-2026 Wingify Software Pvt. Ltd.
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
+ # http://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
+ """Legacy VWO facade — thin wrapper over the Wingify core."""
16
+
17
+ from typing import Dict, Optional
18
+
19
+ from wingify.wingify import Wingify, getUUID
20
+ from wingify.wingify import init as _wingify_init
21
+ from wingify.wingify_builder import WingifyBuilder
22
+ from wingify.wingify_client import WingifyClient
23
+
24
+
25
+ class VWO:
26
+ """Legacy static orchestrator. Delegates to Wingify."""
27
+
28
+ vwo_builder: WingifyBuilder = None
29
+ instance: WingifyClient = None
30
+
31
+ def __init__(self, options: Dict):
32
+ VWO.set_instance(options)
33
+
34
+ @staticmethod
35
+ def set_instance(options: Dict) -> WingifyClient:
36
+ options = dict(options or {})
37
+ options["is_via_vwo"] = True
38
+ instance = Wingify.set_instance(options)
39
+ VWO.vwo_builder = Wingify.wingify_builder
40
+ VWO.instance = instance
41
+ return instance
42
+
43
+ @staticmethod
44
+ def getInstance() -> Optional[WingifyClient]:
45
+ return Wingify.getInstance()
46
+
47
+
48
+ def init(options: Dict) -> Optional[WingifyClient]:
49
+ """Initialize via legacy VWO entry — sets is_via_vwo for VWO hosts and branding."""
50
+ options = dict(options or {})
51
+ options["is_via_vwo"] = True
52
+ return _wingify_init(options)
53
+
54
+
55
+ VWOClient = WingifyClient
56
+ VWOBuilder = WingifyBuilder
57
+
58
+ __all__ = ["VWO", "init", "getUUID", "VWOClient", "VWOBuilder"]
vwo/vwo_builder.py ADDED
@@ -0,0 +1,21 @@
1
+ # Copyright 2024-2026 Wingify Software Pvt. Ltd.
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
+ # http://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
+ """Legacy VWO builder facade — alias over WingifyBuilder."""
16
+
17
+ from wingify.wingify_builder import WingifyBuilder
18
+
19
+ VWOBuilder = WingifyBuilder
20
+
21
+ __all__ = ["VWOBuilder"]
vwo/vwo_client.py ADDED
@@ -0,0 +1,22 @@
1
+ # Copyright 2024-2026 Wingify Software Pvt. Ltd.
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
+ # http://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
+ """Legacy VWO client facade — alias over WingifyClient."""
16
+
17
+ from wingify.wingify_client import WingifyClient
18
+ from wingify.utils.aliasing_util import get_alias_user_id
19
+
20
+ VWOClient = WingifyClient
21
+
22
+ __all__ = ["VWOClient", "get_alias_user_id"]