stoobly-agent 0.27.0__py3-none-any.whl → 0.27.1__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.
- stoobly_agent/__init__.py +1 -1
- stoobly_agent/app/api/configs_controller.py +3 -3
- stoobly_agent/app/models/factories/resource/local_db/request_adapter.py +26 -18
- {stoobly_agent-0.27.0.dist-info → stoobly_agent-0.27.1.dist-info}/METADATA +1 -1
- {stoobly_agent-0.27.0.dist-info → stoobly_agent-0.27.1.dist-info}/RECORD +9 -9
- {stoobly_agent-0.27.0.dist-info → stoobly_agent-0.27.1.dist-info}/LICENSE +0 -0
- {stoobly_agent-0.27.0.dist-info → stoobly_agent-0.27.1.dist-info}/WHEEL +0 -0
- {stoobly_agent-0.27.0.dist-info → stoobly_agent-0.27.1.dist-info}/entry_points.txt +0 -0
- {stoobly_agent-0.27.0.dist-info → stoobly_agent-0.27.1.dist-info}/top_level.txt +0 -0
stoobly_agent/__init__.py
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
COMMAND = 'stoobly-agent'
|
2
|
-
VERSION = '0.27.
|
2
|
+
VERSION = '0.27.1'
|
@@ -73,7 +73,7 @@ class ConfigsController:
|
|
73
73
|
scenario_uuid = ScenarioKey(scenario_key).id if scenario_key else None
|
74
74
|
|
75
75
|
if scenario_uuid:
|
76
|
-
model = self.__scenario_model(settings)
|
76
|
+
model = self.__scenario_model(context, settings)
|
77
77
|
scenario, status = model.show(scenario_uuid)
|
78
78
|
|
79
79
|
if status == 404:
|
@@ -117,7 +117,7 @@ class ConfigsController:
|
|
117
117
|
status = 200
|
118
118
|
)
|
119
119
|
|
120
|
-
def __scenario_model(self, context: SimpleHTTPRequestHandler):
|
121
|
-
scenario_model = ScenarioModel(Settings.instance())
|
120
|
+
def __scenario_model(self, context: SimpleHTTPRequestHandler, settings: Settings = None):
|
121
|
+
scenario_model = ScenarioModel(settings or Settings.instance())
|
122
122
|
scenario_model.as_remote() if context.headers.get('access-token') else scenario_model.as_local()
|
123
123
|
return scenario_model
|
@@ -35,11 +35,14 @@ class LocalDBRequestAdapter(LocalDBAdapter):
|
|
35
35
|
self.__scenario_orm: Scenario = scenario_orm
|
36
36
|
|
37
37
|
def create(self, **params: RequestCreateParams) -> Tuple[RequestShowResponse, int]:
|
38
|
+
self.__adapt_scenario_id(params)
|
39
|
+
|
38
40
|
flow: MitmproxyHTTPFlow = params['flow']
|
39
41
|
joined_request: JoinedRequest = params['joined_request']
|
42
|
+
scenario_id = params.get('scenario_id')
|
40
43
|
|
41
44
|
with ORM.instance().db.transaction():
|
42
|
-
request_columns = build_request_columns(flow, joined_request, scenario_id=
|
45
|
+
request_columns = build_request_columns(flow, joined_request, scenario_id=scenario_id)
|
43
46
|
request_record = self.__request_orm.create(**request_columns)
|
44
47
|
|
45
48
|
response_columns = {
|
@@ -90,15 +93,9 @@ class LocalDBRequestAdapter(LocalDBAdapter):
|
|
90
93
|
|
91
94
|
return ORMToRequestsResponseTransformer(response_record).transform()
|
92
95
|
|
93
|
-
def __scenario_id(self, scenario_id):
|
94
|
-
if not self.validate_uuid(scenario_id):
|
95
|
-
return scenario_id
|
96
|
-
else:
|
97
|
-
scenario = Scenario.find_by(uuid=scenario_id)
|
98
|
-
if scenario:
|
99
|
-
return scenario.id
|
100
|
-
|
101
96
|
def index(self, **query_params: RequestsIndexQueryParams) -> Tuple[RequestsIndexResponse, int]:
|
97
|
+
self.__adapt_scenario_id(query_params)
|
98
|
+
|
102
99
|
scenario_id = query_params.get('scenario_id')
|
103
100
|
page = int(query_params.get('page') or 0)
|
104
101
|
query = query_params.get('q')
|
@@ -115,7 +112,7 @@ class LocalDBRequestAdapter(LocalDBAdapter):
|
|
115
112
|
if unassigned:
|
116
113
|
requests = requests.where('scenario_id', None)
|
117
114
|
elif scenario_id:
|
118
|
-
requests = requests.where('scenario_id',
|
115
|
+
requests = requests.where('scenario_id', scenario_id)
|
119
116
|
sort_order = query_params.get('sort_order') or 'asc'
|
120
117
|
|
121
118
|
if starred:
|
@@ -268,15 +265,30 @@ class LocalDBRequestAdapter(LocalDBAdapter):
|
|
268
265
|
|
269
266
|
return candidates.get()
|
270
267
|
|
268
|
+
def __filter_request_response_columns(self, request_columns: RequestCreateParams):
|
269
|
+
if request_columns.get('project_id'):
|
270
|
+
del request_columns['project_id']
|
271
|
+
|
271
272
|
def __request(self, request_id: str):
|
272
273
|
if self.validate_uuid(request_id):
|
273
274
|
return self.__request_orm.find_by(uuid=request_id)
|
274
275
|
else:
|
275
276
|
return self.__request_orm.find(request_id)
|
276
277
|
|
277
|
-
def
|
278
|
-
|
279
|
-
|
278
|
+
def __request_not_found(self):
|
279
|
+
return self.not_found('Request not found')
|
280
|
+
|
281
|
+
def __adapt_scenario_id(self, params: dict):
|
282
|
+
if not params.get('scenario_id'):
|
283
|
+
return
|
284
|
+
|
285
|
+
scenario_id = params['scenario_id']
|
286
|
+
if not self.validate_uuid(scenario_id):
|
287
|
+
return
|
288
|
+
|
289
|
+
scenario = self.__scenario_orm.find_by(uuid=scenario_id)
|
290
|
+
if scenario:
|
291
|
+
params['scenario_id'] = scenario.id
|
280
292
|
|
281
293
|
def __search(self, base_model: Request, query: str) -> Request:
|
282
294
|
uri = urlparse(query)
|
@@ -285,8 +297,4 @@ class LocalDBRequestAdapter(LocalDBAdapter):
|
|
285
297
|
return base_model.where('host', uri.hostname).where('path', uri.path)
|
286
298
|
else:
|
287
299
|
pattern = f"%{query}%"
|
288
|
-
return base_model.where('path', 'like', pattern).or_where('host', 'like', pattern)
|
289
|
-
|
290
|
-
def __request_not_found(self):
|
291
|
-
return self.not_found('Request not found')
|
292
|
-
|
300
|
+
return base_model.where('path', 'like', pattern).or_where('host', 'like', pattern)
|
@@ -1,11 +1,11 @@
|
|
1
|
-
stoobly_agent/__init__.py,sha256=
|
1
|
+
stoobly_agent/__init__.py,sha256=kFiJrLBzxHGSITxTKDsvWb2qkxWKJeCc7nMfIA9HqQA,45
|
2
2
|
stoobly_agent/cli.py,sha256=xymuwIHwTv27d4y-LA3m5ydTyUGoZURLa5cQ0BreSF4,7228
|
3
3
|
stoobly_agent/mock.py,sha256=P9cr9yW8PF1XolPfNSftcJVn1xEqcD-SEyIROsFxY20,2549
|
4
4
|
stoobly_agent/app/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
5
|
stoobly_agent/app/api/__init__.py,sha256=FFSlVoTgjPfUNlYPr_7u6-P5Y4WOKyaUfAHtUcB-Xio,810
|
6
6
|
stoobly_agent/app/api/application_http_request_handler.py,sha256=jf4fkqjOiCeI2IM5Ro7ie0v_C6y0-7-5TIE_IKMPOfg,5513
|
7
7
|
stoobly_agent/app/api/bodies_controller.py,sha256=8rndzP1Ema3TkmGwezqNCTzhAIVuMvZjtwSYW4-VPgM,2296
|
8
|
-
stoobly_agent/app/api/configs_controller.py,sha256=
|
8
|
+
stoobly_agent/app/api/configs_controller.py,sha256=FgX5v_8T1GKtt4zwDWWDxNn4s7vPA0pcEqjnvVLHKRw,4332
|
9
9
|
stoobly_agent/app/api/headers_controller.py,sha256=TNuYxs5oIsnPFM38kAuL6bzCJ6bwGOuKsfEokr1vdXI,2798
|
10
10
|
stoobly_agent/app/api/proxy_controller.py,sha256=sdJE2bIQfZmOd8_W-sOMwU2rCS2cxpTVLfgXy8SU1Ck,3761
|
11
11
|
stoobly_agent/app/api/query_params_controller.py,sha256=jJwz3KRpuhMNj9oReHUh0TeS0R_Lz6JVMSg8efPndgA,3665
|
@@ -118,7 +118,7 @@ stoobly_agent/app/models/factories/resource/local_db/local_db_adapter.py,sha256=
|
|
118
118
|
stoobly_agent/app/models/factories/resource/local_db/orm_request_builder.py,sha256=4UjFY26ln2Drlg71R4AKY5vUZYbQ28HYQolJv3SBDqE,1581
|
119
119
|
stoobly_agent/app/models/factories/resource/local_db/query_param_adapter.py,sha256=fWtAGcaINMIM5pP0g19o8WUYa7xEMUguFesiqKJyn5A,3966
|
120
120
|
stoobly_agent/app/models/factories/resource/local_db/replayed_response_adapter.py,sha256=vUN9ARmRVrxKHpyzWB5w-XX-quOBMFpWOKkyBxTn6mM,3634
|
121
|
-
stoobly_agent/app/models/factories/resource/local_db/request_adapter.py,sha256=
|
121
|
+
stoobly_agent/app/models/factories/resource/local_db/request_adapter.py,sha256=25Yw7AK8R-iiQy5FfqvGaOoZWHQOEvaTnM8KzjEsN-k,10721
|
122
122
|
stoobly_agent/app/models/factories/resource/local_db/response_adapter.py,sha256=g2plyjBm5NUu1W6SVZavM2PgUYW_DuynFt_MREFhPVI,3228
|
123
123
|
stoobly_agent/app/models/factories/resource/local_db/response_header_adapter.py,sha256=lSehvihNQgX6moFY0XLDyLkTeEweCRAwQ16QSdPsvEg,3070
|
124
124
|
stoobly_agent/app/models/factories/resource/local_db/scenario_adapter.py,sha256=2BjONMOdhHwfEScXUwta86RuMQHZR2shWImiEMAHUO0,3964
|
@@ -476,9 +476,9 @@ stoobly_agent/test/app/test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMp
|
|
476
476
|
stoobly_agent/test/mock_data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
477
477
|
stoobly_agent/test/mock_data/endpoint_show_response.py,sha256=JFEkceHI6nH38zitCbFMozE1lODahxmvj70N5eM_sec,5901
|
478
478
|
stoobly_agent/test/mock_data/request_show_response.py,sha256=K_a0fP0QT58T8sX9PaM6hqtX1A1depZsqg_GsNPf--k,707
|
479
|
-
stoobly_agent-0.27.
|
480
|
-
stoobly_agent-0.27.
|
481
|
-
stoobly_agent-0.27.
|
482
|
-
stoobly_agent-0.27.
|
483
|
-
stoobly_agent-0.27.
|
484
|
-
stoobly_agent-0.27.
|
479
|
+
stoobly_agent-0.27.1.dist-info/LICENSE,sha256=8WuxPI7sA6w_Yhwqn6v6Ch2Kvu6fo0cwMNIgxSE7oq8,548
|
480
|
+
stoobly_agent-0.27.1.dist-info/METADATA,sha256=vNC9HPgiyiKsGtqjLVIxpFQXyPZF5hR1eFz_XRIQVGQ,833
|
481
|
+
stoobly_agent-0.27.1.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
|
482
|
+
stoobly_agent-0.27.1.dist-info/entry_points.txt,sha256=4fpF9D1sN3q8Z6d0MmNAKUy0dz-ZxoH9mqfYMhErRCg,57
|
483
|
+
stoobly_agent-0.27.1.dist-info/top_level.txt,sha256=fTxn372sBnUMXVSJxpaVAMBWB3HU3_Mq-WXJCM6mMj8,14
|
484
|
+
stoobly_agent-0.27.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|