regscale-cli 6.20.5.0__py3-none-any.whl → 6.20.7.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.
Potentially problematic release.
This version of regscale-cli might be problematic. Click here for more details.
- regscale/__init__.py +1 -1
- regscale/_version.py +39 -0
- regscale/core/app/internal/__init__.py +13 -0
- regscale/core/app/internal/set_permissions.py +173 -0
- regscale/core/app/utils/file_utils.py +11 -1
- regscale/core/app/utils/regscale_utils.py +1 -133
- regscale/core/utils/date.py +62 -29
- regscale/integrations/commercial/qualys/__init__.py +7 -7
- regscale/integrations/commercial/wizv2/click.py +9 -5
- regscale/integrations/commercial/wizv2/constants.py +15 -0
- regscale/integrations/commercial/wizv2/parsers.py +23 -0
- regscale/integrations/commercial/wizv2/scanner.py +84 -29
- regscale/integrations/commercial/wizv2/utils.py +91 -4
- regscale/integrations/commercial/wizv2/variables.py +2 -1
- regscale/integrations/commercial/wizv2/wiz_auth.py +3 -3
- regscale/integrations/public/fedramp/fedramp_docx.py +2 -3
- regscale/integrations/scanner_integration.py +7 -2
- regscale/models/app_models/import_validater.py +5 -1
- regscale/models/app_models/mapping.py +3 -1
- regscale/models/integration_models/cisa_kev_data.json +140 -5
- regscale/models/integration_models/flat_file_importer/__init__.py +2 -3
- regscale/models/integration_models/qualys.py +24 -4
- regscale/models/integration_models/synqly_models/capabilities.json +1 -1
- regscale/models/regscale_models/__init__.py +2 -0
- regscale/models/regscale_models/asset.py +1 -1
- regscale/models/regscale_models/modules.py +88 -1
- regscale/models/regscale_models/regscale_model.py +7 -1
- regscale/models/regscale_models/vulnerability.py +3 -3
- regscale/models/regscale_models/vulnerability_mapping.py +2 -2
- regscale/regscale.py +2 -0
- {regscale_cli-6.20.5.0.dist-info → regscale_cli-6.20.7.0.dist-info}/METADATA +1 -1
- {regscale_cli-6.20.5.0.dist-info → regscale_cli-6.20.7.0.dist-info}/RECORD +37 -34
- tests/regscale/test_init.py +94 -0
- {regscale_cli-6.20.5.0.dist-info → regscale_cli-6.20.7.0.dist-info}/LICENSE +0 -0
- {regscale_cli-6.20.5.0.dist-info → regscale_cli-6.20.7.0.dist-info}/WHEEL +0 -0
- {regscale_cli-6.20.5.0.dist-info → regscale_cli-6.20.7.0.dist-info}/entry_points.txt +0 -0
- {regscale_cli-6.20.5.0.dist-info → regscale_cli-6.20.7.0.dist-info}/top_level.txt +0 -0
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"""RegScale models."""
|
|
2
2
|
|
|
3
|
+
from .assessment_plan import *
|
|
3
4
|
from .assessment import *
|
|
4
5
|
from .asset import *
|
|
5
6
|
from .asset_mapping import *
|
|
6
7
|
from .business_impact_assessment import *
|
|
7
8
|
from .catalog import *
|
|
9
|
+
from .case import *
|
|
8
10
|
from .cci import *
|
|
9
11
|
from .change import *
|
|
10
12
|
from .checklist import *
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
# standard python imports
|
|
6
6
|
from dataclasses import asdict, dataclass
|
|
7
|
-
from typing import Any
|
|
7
|
+
from typing import Any, Optional
|
|
8
8
|
|
|
9
9
|
from rich.console import Console
|
|
10
10
|
from rich.table import Table
|
|
@@ -189,3 +189,90 @@ class Modules:
|
|
|
189
189
|
|
|
190
190
|
# return the string
|
|
191
191
|
return output
|
|
192
|
+
|
|
193
|
+
@staticmethod
|
|
194
|
+
def module_to_class(module: str) -> Optional[Any]:
|
|
195
|
+
"""
|
|
196
|
+
Function to convert RegScale module to RegScale class
|
|
197
|
+
|
|
198
|
+
:param str module: RegScale module
|
|
199
|
+
:return: RegScale class if found in the mapping, else None
|
|
200
|
+
:rtype: Optional[Any]
|
|
201
|
+
"""
|
|
202
|
+
from regscale.models import (
|
|
203
|
+
AssessmentPlan,
|
|
204
|
+
Assessment,
|
|
205
|
+
Asset,
|
|
206
|
+
Case,
|
|
207
|
+
Catalog,
|
|
208
|
+
Change,
|
|
209
|
+
Component,
|
|
210
|
+
Evidence,
|
|
211
|
+
Incident,
|
|
212
|
+
Issue,
|
|
213
|
+
Policy,
|
|
214
|
+
Project,
|
|
215
|
+
Questionnaires,
|
|
216
|
+
Requirement,
|
|
217
|
+
Risk,
|
|
218
|
+
SecurityPlan,
|
|
219
|
+
SupplyChain,
|
|
220
|
+
Task,
|
|
221
|
+
Threat,
|
|
222
|
+
)
|
|
223
|
+
|
|
224
|
+
regscale_models = {
|
|
225
|
+
"assessmentplans": AssessmentPlan,
|
|
226
|
+
"assessments": Assessment,
|
|
227
|
+
"assets": Asset,
|
|
228
|
+
"cases": Case,
|
|
229
|
+
"catalogues": Catalog,
|
|
230
|
+
"changes": Change,
|
|
231
|
+
"components": Component,
|
|
232
|
+
"evidence": Evidence,
|
|
233
|
+
"incidents": Incident,
|
|
234
|
+
"issues": Issue,
|
|
235
|
+
"policies": Policy,
|
|
236
|
+
"projects": Project,
|
|
237
|
+
"questionnaires": Questionnaires,
|
|
238
|
+
"requirements": Requirement,
|
|
239
|
+
"risks": Risk,
|
|
240
|
+
"securityplans": SecurityPlan,
|
|
241
|
+
"supplychain": SupplyChain,
|
|
242
|
+
"tasks": Task,
|
|
243
|
+
"threats": Threat,
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
return regscale_models.get(module) or None
|
|
247
|
+
|
|
248
|
+
@staticmethod
|
|
249
|
+
def get_module_to_id(module: str) -> Optional[int]:
|
|
250
|
+
"""
|
|
251
|
+
Returns the id of a RegScale module
|
|
252
|
+
|
|
253
|
+
:return: id of RegScale module, if found in the mapping, else None
|
|
254
|
+
:rtype: Optional[int]
|
|
255
|
+
"""
|
|
256
|
+
module_to_id = {
|
|
257
|
+
"assessmentplans": 33,
|
|
258
|
+
"assessments": 2,
|
|
259
|
+
"assets": 3,
|
|
260
|
+
"cases": 28,
|
|
261
|
+
"catalogues": 4,
|
|
262
|
+
"changes": 31,
|
|
263
|
+
"components": 27,
|
|
264
|
+
"evidence": 32,
|
|
265
|
+
"incidents": 8,
|
|
266
|
+
"issues": 10,
|
|
267
|
+
"policies": 11,
|
|
268
|
+
"projects": 12,
|
|
269
|
+
"questionnaires": 26,
|
|
270
|
+
"requirements": 13,
|
|
271
|
+
"risks": 14,
|
|
272
|
+
"securityplans": 16,
|
|
273
|
+
"supplychain": 25,
|
|
274
|
+
"tasks": 18,
|
|
275
|
+
"threats": 19,
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
return module_to_id.get(module)
|
|
@@ -1150,13 +1150,18 @@ class RegScaleModel(BaseModel, ABC):
|
|
|
1150
1150
|
:return: The saved object
|
|
1151
1151
|
:rtype: T
|
|
1152
1152
|
"""
|
|
1153
|
-
if
|
|
1153
|
+
# Check if the model has change tracking and if there are changes
|
|
1154
|
+
has_change_tracking = hasattr(self, "has_changed") and callable(getattr(self, "has_changed", None))
|
|
1155
|
+
should_save = not has_change_tracking or self.has_changed()
|
|
1156
|
+
|
|
1157
|
+
if should_save:
|
|
1154
1158
|
if bulk:
|
|
1155
1159
|
logger.debug(f"Adding {self.__class__.__name__} {self.id} to pending updates")
|
|
1156
1160
|
self._get_pending_updates().add(self._get_cache_key(self))
|
|
1157
1161
|
self.cache_object(self) # Update the cache with the current state
|
|
1158
1162
|
return self
|
|
1159
1163
|
else:
|
|
1164
|
+
logger.debug(f"Saving {self.__class__.__name__} {self.id}")
|
|
1160
1165
|
return self._perform_save()
|
|
1161
1166
|
else:
|
|
1162
1167
|
logger.debug(f"No changes detected for {self.__class__.__name__} {self.id}")
|
|
@@ -1284,6 +1289,7 @@ class RegScaleModel(BaseModel, ABC):
|
|
|
1284
1289
|
endpoint = self.get_endpoint("update").format(id=self.id)
|
|
1285
1290
|
response = self._get_api_handler().put(endpoint=endpoint, data=self.dict(), headers=self._get_headers())
|
|
1286
1291
|
if hasattr(response, "ok") and response.ok:
|
|
1292
|
+
logger.debug(f"Successfully saved {self.__class__.__name__} {self.id}")
|
|
1287
1293
|
obj = self.__class__(**response.json())
|
|
1288
1294
|
self.cache_object(obj)
|
|
1289
1295
|
return obj
|
|
@@ -14,9 +14,9 @@ from regscale.core.app.api import Api
|
|
|
14
14
|
from regscale.core.app.application import Application
|
|
15
15
|
from regscale.core.app.utils.app_utils import get_current_datetime
|
|
16
16
|
from regscale.models import regscale_models
|
|
17
|
+
from regscale.models.regscale_models.issue import IssueStatus
|
|
17
18
|
from regscale.models.regscale_models.regscale_model import RegScaleModel
|
|
18
19
|
|
|
19
|
-
|
|
20
20
|
logger = logging.getLogger("regscale")
|
|
21
21
|
|
|
22
22
|
|
|
@@ -68,7 +68,7 @@ class Vulnerability(RegScaleModel):
|
|
|
68
68
|
firstSeen: Optional[str] = None
|
|
69
69
|
daysOpen: Optional[int] = None
|
|
70
70
|
dns: Optional[str] = None
|
|
71
|
-
ipAddress: Optional[str] =
|
|
71
|
+
ipAddress: Optional[str] = None
|
|
72
72
|
mitigated: Optional[bool] = None
|
|
73
73
|
operatingSystem: Optional[str] = None
|
|
74
74
|
port: Optional[Union[str, int]] = None
|
|
@@ -86,7 +86,7 @@ class Vulnerability(RegScaleModel):
|
|
|
86
86
|
tenantsId: int = Field(default=0)
|
|
87
87
|
isPublic: bool = Field(default=False)
|
|
88
88
|
dateClosed: Optional[str] = None
|
|
89
|
-
status: Optional[
|
|
89
|
+
status: Optional[Union[str, IssueStatus]] = Field(default_factory=IssueStatus.Open)
|
|
90
90
|
buildVersion: Optional[str] = None
|
|
91
91
|
cvsSv3BaseVector: Optional[str] = None
|
|
92
92
|
cvsSv2BaseVector: Optional[str] = None
|
|
@@ -23,7 +23,7 @@ class VulnerabilityMapping(RegScaleModel):
|
|
|
23
23
|
vulnerabilityId: int
|
|
24
24
|
assetId: int
|
|
25
25
|
scanId: Optional[int] = None
|
|
26
|
-
|
|
26
|
+
securityPlanId: Optional[int] = None
|
|
27
27
|
status: Optional[str] = Field(max_length=450)
|
|
28
28
|
firstSeen: str
|
|
29
29
|
lastSeen: str
|
|
@@ -33,7 +33,7 @@ class VulnerabilityMapping(RegScaleModel):
|
|
|
33
33
|
lastUpdatedById: str = Field(default_factory=RegScaleModel.get_user_id)
|
|
34
34
|
dateCreated: str
|
|
35
35
|
dateLastUpdated: Optional[str] = None
|
|
36
|
-
tenantsId: int = Field(default=
|
|
36
|
+
tenantsId: int = Field(default=1)
|
|
37
37
|
|
|
38
38
|
@staticmethod
|
|
39
39
|
def _get_additional_endpoints() -> ConfigDict:
|
regscale/regscale.py
CHANGED
|
@@ -127,6 +127,7 @@ file_upload = import_command_with_timing("regscale.core.app.internal.file_upload
|
|
|
127
127
|
migrations = import_command_with_timing(INTERNAL, "migrations")
|
|
128
128
|
model = import_command_with_timing(INTERNAL, "model")
|
|
129
129
|
issues = import_command_with_timing(INTERNAL, "issues")
|
|
130
|
+
set_permissions = import_command_with_timing(INTERNAL, "set_permissions")
|
|
130
131
|
|
|
131
132
|
############################################################
|
|
132
133
|
# Public Integrations
|
|
@@ -757,6 +758,7 @@ cli.add_command(evidence) # add Evidence Feature
|
|
|
757
758
|
cli.add_command(migrations) # add data migration support
|
|
758
759
|
cli.add_command(issues) # add POAM(Issues) Editor Feature
|
|
759
760
|
cli.add_command(model) # add POAM(Issues) Editor Feature
|
|
761
|
+
cli.add_command(set_permissions) # add builk editor for record permissions
|
|
760
762
|
|
|
761
763
|
############################################################
|
|
762
764
|
# Add Commercial Integrations
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
regscale/__init__.py,sha256=
|
|
2
|
-
regscale/
|
|
1
|
+
regscale/__init__.py,sha256=ZygAIkX6Nbjag1czWdQa-yP-GM1mBE_9ss21Xh__JFc,34
|
|
2
|
+
regscale/_version.py,sha256=YLSYeYSAYt1REUpmwrAD1VCEq2qczcUNPdm7IExPYMo,1198
|
|
3
|
+
regscale/regscale.py,sha256=xcxnTwEwWgfO3Fnp0LVo32SZCJzAswq3WDZgm21nHnI,30914
|
|
3
4
|
regscale/airflow/__init__.py,sha256=yMwN0Bz4JbM0nl5qY_hPegxo_O2ilhTOL9PY5Njhn-s,270
|
|
4
5
|
regscale/airflow/click_dags.py,sha256=H3SUR5jkvInNMv1gu-VG-Ja_H-kH145CpQYNalWNAbE,4520
|
|
5
6
|
regscale/airflow/click_mixins.py,sha256=BTwKWsEu6KVtlrzFbXpD_RuEpMzc-CSnCCySUzqzCgQ,3571
|
|
@@ -37,7 +38,7 @@ regscale/core/app/__init__.py,sha256=nGcCN1vWBAnZzoccIlt0jwWQdegCOrBWOB7LPhQkQSs
|
|
|
37
38
|
regscale/core/app/api.py,sha256=_hwh1HWIIrPfL4jHDKlEmW5pQEr2Iq3idn4bYGtfPQo,23148
|
|
38
39
|
regscale/core/app/application.py,sha256=TalC51f30Ox6o7LBsh2RcCdU_YqFuCbGw1zhK2vSS7s,25982
|
|
39
40
|
regscale/core/app/logz.py,sha256=8AdBKmquv45JGi5fCMc38JqQg6-FpUONGmqfd5EGwrI,2583
|
|
40
|
-
regscale/core/app/internal/__init__.py,sha256=
|
|
41
|
+
regscale/core/app/internal/__init__.py,sha256=rod4nmE7rrYDdbuYF4mCWz49TK_2r-v4tWy1UHW63r0,4808
|
|
41
42
|
regscale/core/app/internal/admin_actions.py,sha256=hOdma7QGwFblmxEj9UTjiWWmZGUS5_ZFtxL2qZdhf-Q,7443
|
|
42
43
|
regscale/core/app/internal/assessments_editor.py,sha256=UozEaQR1v3eXbkFgOY11CkjMLEAF27ej5vlMQ4O9XVA,31477
|
|
43
44
|
regscale/core/app/internal/catalog.py,sha256=svBAgFZaGrkNHh2gZEo1ex2vdjllAIc4940soGykHOc,11088
|
|
@@ -51,15 +52,16 @@ regscale/core/app/internal/login.py,sha256=GsFaBwmSc32liWoRnMFy78m8SuB9pfUV0c1ly
|
|
|
51
52
|
regscale/core/app/internal/migrations.py,sha256=wHIzb1uglLVOXawnb-K3Yt70Z5QyfQYb8ZZOMDrNRU4,7983
|
|
52
53
|
regscale/core/app/internal/model_editor.py,sha256=0sxfg92TJYyECU9KwgHooXeY3ZdaF2i5gGWe1gButFY,61696
|
|
53
54
|
regscale/core/app/internal/poam_editor.py,sha256=3PtpSMpV7bqKFuTHD2ACYcTyB3EEtTRKuYv-XArjd0A,22929
|
|
55
|
+
regscale/core/app/internal/set_permissions.py,sha256=MbUxe-zaAz5hK3BZ4IeY7Xbr8-FZOuJwkCbs_yVBC-k,5666
|
|
54
56
|
regscale/core/app/internal/workflow.py,sha256=SpgYk1QyzdilVLOK1fFzaKhdLspumaugf5VezgboxhQ,4007
|
|
55
57
|
regscale/core/app/utils/XMLIR.py,sha256=M_RrCsbjznihatkucCKw6dPgHTPQczXyqIdUXWhuCLI,8328
|
|
56
58
|
regscale/core/app/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
57
59
|
regscale/core/app/utils/api_handler.py,sha256=T1meKw6Yi3ZAgRbQ1xuKDVh9Q9B8mbMqqN_LrSwIlAM,11765
|
|
58
60
|
regscale/core/app/utils/app_utils.py,sha256=zLEHHHWR4likFQYY_bZsWLTAoRajyyaWrESkotVrFlM,36240
|
|
59
|
-
regscale/core/app/utils/file_utils.py,sha256=
|
|
61
|
+
regscale/core/app/utils/file_utils.py,sha256=x7cqYPxJ-PgSb2lX_K6zhdqyGQjOCmr04lnqdBQV3hI,9269
|
|
60
62
|
regscale/core/app/utils/parser_utils.py,sha256=aBEgcFwbJMD-ARf3wzf-tyWwR6NHvzEcdYcPMm8hGqo,2533
|
|
61
63
|
regscale/core/app/utils/pickle_file_handler.py,sha256=iMdv4N8z00TB5LyPdxIcLKNRpDQVWQ8ZQWAqCKpqmF0,1695
|
|
62
|
-
regscale/core/app/utils/regscale_utils.py,sha256=
|
|
64
|
+
regscale/core/app/utils/regscale_utils.py,sha256=KuXTAfEO10DQTnhQadIBIQ02iuLD0D0xKUzf5Yv8yP4,7400
|
|
63
65
|
regscale/core/app/utils/report_utils.py,sha256=rKn3nmiSPq8LTKM16UiKBSizTsZKh-7JwdOlfX6YSpQ,4210
|
|
64
66
|
regscale/core/app/utils/variables.py,sha256=h29Qrr6jg-Feo74IeqHz28wYLhgtzZ2pCDMf6g0WJFU,8989
|
|
65
67
|
regscale/core/app/utils/catalog_utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -92,7 +94,7 @@ regscale/core/static/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hS
|
|
|
92
94
|
regscale/core/static/regex.py,sha256=KLg-do2oPuUD6bQG9usqqSy5sxqlSEAEuUUbGVkZ6eU,384
|
|
93
95
|
regscale/core/utils/__init__.py,sha256=Eyvc210t-KRqvTcV5DNWRjKO99CdWy_dC57wfggFWcw,3876
|
|
94
96
|
regscale/core/utils/click_utils.py,sha256=y6vAbaPoT0Abb8siS1tvJxJQTm4sbWQTeq5nTDIgBtI,375
|
|
95
|
-
regscale/core/utils/date.py,sha256=
|
|
97
|
+
regscale/core/utils/date.py,sha256=_45gTGY0NrnnC49ajuYLGU8QLcTUKYm09C_z93O1oKs,10005
|
|
96
98
|
regscale/core/utils/graphql.py,sha256=oXGBcAuDa0uasMnD4CokIzzKKa-IgExdKXLwtaK2_tA,8386
|
|
97
99
|
regscale/core/utils/urls.py,sha256=ZcU9OJqDmVQXgu6BrLESIp2KMkkUuzTZZ_wHsZMzfA4,687
|
|
98
100
|
regscale/dev/__init__.py,sha256=wVP59B1iurp36ul8pD_CjmunJLHOdKWWodz1r5loNvw,190
|
|
@@ -111,7 +113,7 @@ regscale/integrations/api_paginator.py,sha256=73rjaNM9mGv8evHAeoObXEjZPg-bJuGPo6
|
|
|
111
113
|
regscale/integrations/api_paginator_example.py,sha256=lEuYI-xEGcjnXuIzbCobCP0YRuukLF0s8S3d382SAH4,12119
|
|
112
114
|
regscale/integrations/integration_override.py,sha256=PH7t_bf-RCe_it3FJ61tlKX5UghqHuSEQNJWDfCamAg,5480
|
|
113
115
|
regscale/integrations/jsonl_scanner_integration.py,sha256=l8nq_T3rE1XX-6HxrNHm3xzxCNWbIjxQvGMdtZWs7KQ,57003
|
|
114
|
-
regscale/integrations/scanner_integration.py,sha256=
|
|
116
|
+
regscale/integrations/scanner_integration.py,sha256=lijwTk_VD_mhNN04lMgf_Wh3IKhv_INWESFgtjt_f8Q,135805
|
|
115
117
|
regscale/integrations/variables.py,sha256=AyaG286U-ek2uQ4qeYBAG3eh_QnlBlth1PKZI5Je5sc,2212
|
|
116
118
|
regscale/integrations/commercial/__init__.py,sha256=sVbzBnLbKRhnAmRsIw8kRvfbyJojPfVqzH3OlgoxvqM,13927
|
|
117
119
|
regscale/integrations/commercial/ad.py,sha256=YXSmK8vRf6yi2GnREGa5GrE6GelhFrLj44SY8AO1pK0,15509
|
|
@@ -181,7 +183,7 @@ regscale/integrations/commercial/nessus/scanner.py,sha256=xz-OBd98ZbKKWnuxsP7oTq
|
|
|
181
183
|
regscale/integrations/commercial/opentext/__init__.py,sha256=zqCPb_4rYRZZPXfeKn4AoZyyYyQ6MU4C0lCs2ysOBhc,251
|
|
182
184
|
regscale/integrations/commercial/opentext/commands.py,sha256=TTClFg16EzlXQOjdQQ6AdWuVuh7H2zO0V9rXd73-ni0,2572
|
|
183
185
|
regscale/integrations/commercial/opentext/scanner.py,sha256=QAb9FPiYeQCEnqL3dnFBFe64LydwLaR8HWpYmabgcbE,22581
|
|
184
|
-
regscale/integrations/commercial/qualys/__init__.py,sha256=
|
|
186
|
+
regscale/integrations/commercial/qualys/__init__.py,sha256=ATKL6TvzgZNtJezlDu6K-_LZ5tEVpF8a2SsiIVTlVuI,88209
|
|
185
187
|
regscale/integrations/commercial/qualys/containers.py,sha256=9jiBBgjoDRuOB2y5_rmOIgJ0nysrwZVgMTrBZW4fRzk,11958
|
|
186
188
|
regscale/integrations/commercial/qualys/qualys_error_handler.py,sha256=2nlxeNLQMOpkiTij39VTsZg-2AFQsM6-rwlBW2pVpKY,18594
|
|
187
189
|
regscale/integrations/commercial/qualys/scanner.py,sha256=cvz7j2X160l5RP74Vtq6-FagIDhT6zQfQPoQOTOR07c,56284
|
|
@@ -226,16 +228,16 @@ regscale/integrations/commercial/trivy/commands.py,sha256=YGQFtpQGkmcLT3X2OVp7lt
|
|
|
226
228
|
regscale/integrations/commercial/trivy/scanner.py,sha256=iiwTvjqRlLRgQvCs_FP0j83B7ApOta0MSXyO0-iHfSk,11309
|
|
227
229
|
regscale/integrations/commercial/wizv2/WizDataMixin.py,sha256=s7F_rVrP9IZa_x_vh3MswR7W_UBHRfd4kHGVsNX4ips,3606
|
|
228
230
|
regscale/integrations/commercial/wizv2/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
229
|
-
regscale/integrations/commercial/wizv2/click.py,sha256=
|
|
230
|
-
regscale/integrations/commercial/wizv2/constants.py,sha256=
|
|
231
|
+
regscale/integrations/commercial/wizv2/click.py,sha256=DPis8cMST7zVXMzajYUGqI5WNg6nh08afiQhExm54_c,12276
|
|
232
|
+
regscale/integrations/commercial/wizv2/constants.py,sha256=YamxNum-GHZgkTiCsKD_rii7B9chlFOeVR56FBKvZ80,23418
|
|
231
233
|
regscale/integrations/commercial/wizv2/issue.py,sha256=qj5_g-SoOz6f5QDgs34GdQEyxFwJLKAWl1EVx7vjrAw,13407
|
|
232
234
|
regscale/integrations/commercial/wizv2/models.py,sha256=hZ6557LJfcp1_NRbMM0V_G1erz1jEFmsuKPn86kXE54,5667
|
|
233
|
-
regscale/integrations/commercial/wizv2/parsers.py,sha256=
|
|
235
|
+
regscale/integrations/commercial/wizv2/parsers.py,sha256=BD0i-80NhfQAHYPk0EAbUClXfzxLT3aHzb2Gs2ObVAk,11811
|
|
234
236
|
regscale/integrations/commercial/wizv2/sbom.py,sha256=QcGaYiBGtZ3mBcbo-KGl-I2u6QHKAIinTk26LPy0Kng,4466
|
|
235
|
-
regscale/integrations/commercial/wizv2/scanner.py,sha256=
|
|
236
|
-
regscale/integrations/commercial/wizv2/utils.py,sha256=
|
|
237
|
-
regscale/integrations/commercial/wizv2/variables.py,sha256=
|
|
238
|
-
regscale/integrations/commercial/wizv2/wiz_auth.py,sha256=
|
|
237
|
+
regscale/integrations/commercial/wizv2/scanner.py,sha256=N-YVSbQJvTrg-tmxnxY_w7gJ7qS4VyBTuOiMMy3TXCo,23876
|
|
238
|
+
regscale/integrations/commercial/wizv2/utils.py,sha256=ELJZ9sgi2h9lEHFF7mlOQQ5f8MugM-sH72BZSRjF_nk,37550
|
|
239
|
+
regscale/integrations/commercial/wizv2/variables.py,sha256=TxyhBGgKUC1bpg-2gCNiU2txqDGiQosbguAFLecP69E,2591
|
|
240
|
+
regscale/integrations/commercial/wizv2/wiz_auth.py,sha256=qGcUhpC9eRkJIngmv3i9yHdp0q9rv6AvA5gHkypYzCE,5549
|
|
239
241
|
regscale/integrations/integration/__init__.py,sha256=WJgPLnEahD94QLE8NR8QCzlf8xk2ix76_WPDlf98ezU,70
|
|
240
242
|
regscale/integrations/integration/integration.py,sha256=pr_fbqBieYbqp3PdBjuqKuZCYFf0kF4GkFdlViTKG54,586
|
|
241
243
|
regscale/integrations/integration/inventory.py,sha256=gHL1a6VSV3zf4DTmksEy8qXNrqhIun8TwLxhRpuEMqY,341
|
|
@@ -255,7 +257,7 @@ regscale/integrations/public/fedramp/components.py,sha256=z6PMObm-kjRR42bT04Efnj
|
|
|
255
257
|
regscale/integrations/public/fedramp/docx_parser.py,sha256=EA9g1iTlB6-GtOzV9JwGW8x_SruhbaIMOzstCBvjiq8,10526
|
|
256
258
|
regscale/integrations/public/fedramp/fedramp_cis_crm.py,sha256=IVASI6W0uEOg_SyxJSqyHev1KzSwEnF1RTWYT3qfViw,64576
|
|
257
259
|
regscale/integrations/public/fedramp/fedramp_common.py,sha256=Mdy3_WdCEcTwSXEEKXiODmr2YJTWcTg6jfyWZJWfruQ,115406
|
|
258
|
-
regscale/integrations/public/fedramp/fedramp_docx.py,sha256=
|
|
260
|
+
regscale/integrations/public/fedramp/fedramp_docx.py,sha256=eKkRwfcIi4aHJp4ajKDUGJECItwrZwYfCiKzmfB2W1Q,13703
|
|
259
261
|
regscale/integrations/public/fedramp/fedramp_five.py,sha256=F4KIOdnYaRjJrJHJYsN9Bmf6i5s0nus-t_GaAh8A3ow,92645
|
|
260
262
|
regscale/integrations/public/fedramp/fedramp_traversal.py,sha256=BkgwsFluZO5g0Rc0WujYgbc1_YLofamJzFP7Z5UYfao,4528
|
|
261
263
|
regscale/integrations/public/fedramp/import_fedramp_r4_ssp.py,sha256=Opld0vEZ4b71cIDogu6ykTUL86tXZVTSnwQzjz8w_4U,9925
|
|
@@ -300,8 +302,8 @@ regscale/models/app_models/__init__.py,sha256=XmrkxwFJx49ofl5ICZniGmmJe8jO4RkKnH
|
|
|
300
302
|
regscale/models/app_models/catalog_compare.py,sha256=gLD8ti933nW70FcGlx6gp0Lbdo8cFnKky7JkRFAKfOU,7557
|
|
301
303
|
regscale/models/app_models/click.py,sha256=2kZuBOpHFjpFKtI7rT_ht26G9bjHL_EUUoYlLC-O3B4,9961
|
|
302
304
|
regscale/models/app_models/datetime_encoder.py,sha256=AvKkXWhrd87jTfNnY5Q2gw5IdXkCQDnE_44Lay2ZUAA,518
|
|
303
|
-
regscale/models/app_models/import_validater.py,sha256=
|
|
304
|
-
regscale/models/app_models/mapping.py,sha256=
|
|
305
|
+
regscale/models/app_models/import_validater.py,sha256=p9ZFqryVxDT1w8RJ5EOKuBQbNFVl2AcuY-LOr4ZNsMM,13932
|
|
306
|
+
regscale/models/app_models/mapping.py,sha256=tga2kCsEZT-YvnJIgiHy_qRcFp25Xzk0YkbkkZgwSEA,11265
|
|
305
307
|
regscale/models/app_models/pipeline.py,sha256=qzrkQvvW6d8rqbBjMR8wkT2obez0tnKyY_TxtxLh6VE,909
|
|
306
308
|
regscale/models/integration_models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
307
309
|
regscale/models/integration_models/aqua.py,sha256=qJeNik3gFzF7xHz39vz1nWYYktu2BTmiRSAU64MOwUY,9945
|
|
@@ -309,7 +311,7 @@ regscale/models/integration_models/azure_alerts.py,sha256=2etrpvcxa7jVQrc98bJlVG
|
|
|
309
311
|
regscale/models/integration_models/base64.py,sha256=sxV6O5qY1_TstJENX5jBPsSdQwmA83-NNhgJFunXiZE,570
|
|
310
312
|
regscale/models/integration_models/burp.py,sha256=FBEBkH3U0Q8vq71FFoWnvgLRF5Hkr9GYmQFmNNHFrVk,16932
|
|
311
313
|
regscale/models/integration_models/burp_models.py,sha256=UytDTAcCaxyu-knFkm_mEUH6UmWK3OTXKSC9Sc6OjVs,3669
|
|
312
|
-
regscale/models/integration_models/cisa_kev_data.json,sha256=
|
|
314
|
+
regscale/models/integration_models/cisa_kev_data.json,sha256=9Q5Yhv6s8tWWtWBm6IUN9zV2IYuk-vvpGND6DETVTAs,1239665
|
|
313
315
|
regscale/models/integration_models/defender_data.py,sha256=jsAcjKxiGmumGerj7xSWkFd6r__YpuKDnYX5o7xHDiE,2844
|
|
314
316
|
regscale/models/integration_models/defenderimport.py,sha256=OFwEH0Xu-HFLIZJZ8hP60Ov3lS8RR7KHEsw4wI8QnoE,5766
|
|
315
317
|
regscale/models/integration_models/drf.py,sha256=Aq7AdLa_CH97NrnR-CxaFI22JjVN9uCxVN7Z-BBUaNU,18896
|
|
@@ -319,7 +321,7 @@ regscale/models/integration_models/implementation_results.py,sha256=nJOAFPMS73Su
|
|
|
319
321
|
regscale/models/integration_models/jira_task_sync.py,sha256=FVfIms0fzc9WLprda7rn1wmFFz7tXCuEFHnzln9qkdE,918
|
|
320
322
|
regscale/models/integration_models/nexpose.py,sha256=mfaVZP9GVbCwdqEYGrGZ0pwSdDXCPKjOK4yR7d7I4oU,5654
|
|
321
323
|
regscale/models/integration_models/prisma.py,sha256=83LeS96rUgaZvPzl6ei_FWjTFBojsyqzMWoSJ1CnsJ0,8280
|
|
322
|
-
regscale/models/integration_models/qualys.py,sha256=
|
|
324
|
+
regscale/models/integration_models/qualys.py,sha256=YrMKA4i03EQ63LyFdbIsFfPMCRJC9ZWj__gv8Nb3xfo,27913
|
|
323
325
|
regscale/models/integration_models/qualys_scanner.py,sha256=6rAeCR9qI10MM_LWtZtOhWaT6mERWtII2IxxyvQhfKw,6453
|
|
324
326
|
regscale/models/integration_models/send_reminders.py,sha256=Zon6fyV0nODp8l5KuABe97Rz8l37o4biRb5iML7GHiE,26137
|
|
325
327
|
regscale/models/integration_models/snyk.py,sha256=Wk04Dbz67s2uniWkfllRHhlEBrRYiZq5CRwkOpDyHls,11524
|
|
@@ -335,11 +337,11 @@ regscale/models/integration_models/axonius_models/connectors/assets.py,sha256=6m
|
|
|
335
337
|
regscale/models/integration_models/ecr_models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
336
338
|
regscale/models/integration_models/ecr_models/data.py,sha256=l28DCidXar1JygYBQZL9MYenQA9N-Cx3Skf51IOjZcw,1017
|
|
337
339
|
regscale/models/integration_models/ecr_models/ecr.py,sha256=-s_5mj4BVKImrvfMaOJLT4qc5EqTCbv8qM4uJiH_nKc,9502
|
|
338
|
-
regscale/models/integration_models/flat_file_importer/__init__.py,sha256=
|
|
340
|
+
regscale/models/integration_models/flat_file_importer/__init__.py,sha256=7UpnHHBN9B6WDjjWvoRpk6r-c4IfpP_BlERFFBbic9Q,39657
|
|
339
341
|
regscale/models/integration_models/sbom/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
340
342
|
regscale/models/integration_models/sbom/cyclone_dx.py,sha256=0pFR0BWBrF5c8_cC_8mj2MXvNOMHOdHbBYXvTVfFAh8,4058
|
|
341
343
|
regscale/models/integration_models/synqly_models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
342
|
-
regscale/models/integration_models/synqly_models/capabilities.json,sha256=
|
|
344
|
+
regscale/models/integration_models/synqly_models/capabilities.json,sha256=TlYj_1dDBdICephntMKZR7HdLzpSqK_eMI8btz7q2-A,354906
|
|
343
345
|
regscale/models/integration_models/synqly_models/connector_types.py,sha256=8nxptkTexpskySnmL0obNAff_iu_fx6tJ7i1-4hJvao,461
|
|
344
346
|
regscale/models/integration_models/synqly_models/ocsf_mapper.py,sha256=e2kTOhWSNRnzbgMchMx-7c21pCgSv2DqWnxvajKEKJM,16960
|
|
345
347
|
regscale/models/integration_models/synqly_models/param.py,sha256=Xt5Zm6lC_VkLj7LF2qXo72TJZHysqttsp5ai0NCf1po,2643
|
|
@@ -353,11 +355,11 @@ regscale/models/integration_models/synqly_models/connectors/vulnerabilities.py,s
|
|
|
353
355
|
regscale/models/integration_models/tenable_models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
354
356
|
regscale/models/integration_models/tenable_models/integration.py,sha256=lplL8zmjTFuhLreW-4y7G1fiCOBgzNAaATq800jgTQc,10271
|
|
355
357
|
regscale/models/integration_models/tenable_models/models.py,sha256=dmG7btkN4YkDWwnfW5Ldc3tWEAGjPiaRgJjrqMOkPEU,15846
|
|
356
|
-
regscale/models/regscale_models/__init__.py,sha256=
|
|
358
|
+
regscale/models/regscale_models/__init__.py,sha256=ejw7TPJPwS3BwF01-JzL6-R5DLO1zR7DVW9HHcMNCJ8,2192
|
|
357
359
|
regscale/models/regscale_models/assessment.py,sha256=ekzNlcsfDGBu97PMCi7hBRGbzVgxk7Ij0RfrdGh1Rfw,20440
|
|
358
360
|
regscale/models/regscale_models/assessment_plan.py,sha256=qo2YA5ckSbUKDHnC_2BUc2I9kMTje9Gq-qTCXqvEKCY,1716
|
|
359
361
|
regscale/models/regscale_models/assessment_result.py,sha256=K48yjYKwgY1-d_Y3aQUDcCvaqcTIVYdbKV5Wgicf4Ts,1283
|
|
360
|
-
regscale/models/regscale_models/asset.py,sha256
|
|
362
|
+
regscale/models/regscale_models/asset.py,sha256=MDYIFlPfngjjr6obP0wLlQPFzNw8CIFeYVAKFnpdqR4,19828
|
|
361
363
|
regscale/models/regscale_models/asset_mapping.py,sha256=HFlkAoPZHy2xPYq28cXuzLpFoP36SI08HTL8mH_Q-uE,6851
|
|
362
364
|
regscale/models/regscale_models/business_impact_assessment.py,sha256=tkuvw1ssdrVJJcsHT43nFjFhAFTSSFRNfWRIg5W-d2k,2214
|
|
363
365
|
regscale/models/regscale_models/case.py,sha256=hLVTwZXzusnXR9avqh7xSVLJwPJ1rPI_Nla_VAkpZcg,1192
|
|
@@ -402,7 +404,7 @@ regscale/models/regscale_models/link.py,sha256=lAY4Ig3Menm1EqfcAbVJ7jsCsRO5tWtJI
|
|
|
402
404
|
regscale/models/regscale_models/master_assessment.py,sha256=t03-8vQJ7hnPNgEU0GSC1XGKOgAqHKuIupbt5IjJvtI,7322
|
|
403
405
|
regscale/models/regscale_models/meta_data.py,sha256=Fg8rrWSTx3K00QkF4glH9UdY9OFWJ4_UqxleLSSbx8I,2482
|
|
404
406
|
regscale/models/regscale_models/module.py,sha256=a7lalHmVTQ04ZILnJxuFWdHYDtyusBMTtonD4ICL-Wc,7272
|
|
405
|
-
regscale/models/regscale_models/modules.py,sha256=
|
|
407
|
+
regscale/models/regscale_models/modules.py,sha256=yeva_tct88o2NFt93_zmqUcXZ3LucVbAv5FvQPru3cQ,8551
|
|
406
408
|
regscale/models/regscale_models/objective.py,sha256=aJIpmkZ-NscqV2y8SGB4HYzm615b6mklyHnW9bL2ljk,249
|
|
407
409
|
regscale/models/regscale_models/organization.py,sha256=E3Y5bwtgaIRL4rbKxU3DyfFVYUzP3d-1umG_CIUG3gE,714
|
|
408
410
|
regscale/models/regscale_models/parameter.py,sha256=WS5onxkvz119brxugoBidK7K_3CeNVzchLTvW8aEdJs,3859
|
|
@@ -419,7 +421,7 @@ regscale/models/regscale_models/questionnaire.py,sha256=QMSXfNpSoaS8tkeo80C7OWLj
|
|
|
419
421
|
regscale/models/regscale_models/questionnaire_instance.py,sha256=1LgGTwFACmWx2xOOqUKhAUOms4_3L6NZySzuteg0_sI,8241
|
|
420
422
|
regscale/models/regscale_models/rbac.py,sha256=oHzKqwL4bkH2XT4WaslbNlMnWayrSKP9zYbG72e2ijk,4522
|
|
421
423
|
regscale/models/regscale_models/reference.py,sha256=P_7jT6H-NZIa7TyH3j98N-ZHlB6FsjpZVRZCCpms-D4,3253
|
|
422
|
-
regscale/models/regscale_models/regscale_model.py,sha256
|
|
424
|
+
regscale/models/regscale_models/regscale_model.py,sha256=-TLI7FX63s0qHHERES33c7ho9_qHKb3X7-3dihFBd9E,69210
|
|
423
425
|
regscale/models/regscale_models/requirement.py,sha256=-8PnMbuWAZHol5X1w-fzm-moD784Et0oevSVbz6xLhU,767
|
|
424
426
|
regscale/models/regscale_models/risk.py,sha256=lZFDYPpTt0aEYCrYz5FBKk1Y4y2CKXYU1A8eEKT3zzg,8661
|
|
425
427
|
regscale/models/regscale_models/risk_issue_mapping.py,sha256=j6uR0x6xymJ0BsIwgnadeUQDshHNhU3VnpyItZp4dc4,2393
|
|
@@ -441,8 +443,8 @@ regscale/models/regscale_models/task.py,sha256=le3N2GIUCEJrFnNh0DLU7RAcle4ULr8OP
|
|
|
441
443
|
regscale/models/regscale_models/threat.py,sha256=4TNZcRnTgmlDwBsYu5Pbh9GRd8ZWAtqqr0Xph3uPNAA,7255
|
|
442
444
|
regscale/models/regscale_models/user.py,sha256=wiU2qKwp3aYtmaHEmTtv8BbMEgFb913dHgc2VnmsAkg,7186
|
|
443
445
|
regscale/models/regscale_models/user_group.py,sha256=vzlXHvPNsgJd38H0R3osi46Oj19QO5oPx0qXntQBKWI,1891
|
|
444
|
-
regscale/models/regscale_models/vulnerability.py,sha256=
|
|
445
|
-
regscale/models/regscale_models/vulnerability_mapping.py,sha256=
|
|
446
|
+
regscale/models/regscale_models/vulnerability.py,sha256=klN8MYatevFGVaulex6WeLw-uvxT07ty-cXU9CxS_-Q,11042
|
|
447
|
+
regscale/models/regscale_models/vulnerability_mapping.py,sha256=k14azHU7VwryHfXaJdvAMWXs3AqHDr7rnj602bscWQM,6260
|
|
446
448
|
regscale/models/regscale_models/workflow.py,sha256=uMNVVAn5qR8wxjMP5PHbcvMmvPRe1gn1oclVUpbv52s,1873
|
|
447
449
|
regscale/models/regscale_models/workflow_action.py,sha256=zMHrvUkTQJlkCj6Xx6wadozBwsVPpObj5GD81LI2VZc,925
|
|
448
450
|
regscale/models/regscale_models/workflow_instance.py,sha256=15QPr25bVdB3ERPXmQfy2REflVsOZAq6-wZF0GV0MPo,10895
|
|
@@ -487,6 +489,7 @@ tests/mocks/xml.py,sha256=WYeZRZfyYmOi4TTvF7I53l3gKF4x1DE1dqy08szPkfQ,261
|
|
|
487
489
|
tests/regscale/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
488
490
|
tests/regscale/test_about.py,sha256=32YZC8XJW5QkIYIfwEVGIdIxQNUIbyzn3OzVcX_5X24,635
|
|
489
491
|
tests/regscale/test_authorization.py,sha256=fls5ODCYiu0DdkwXFepO_GM-BP6tRaPmMCZWX6VD2e8,1899
|
|
492
|
+
tests/regscale/test_init.py,sha256=W4deASP6ebAfheqaU5OaiGAfMP6vHGXkJBI4iO98cMQ,3998
|
|
490
493
|
tests/regscale/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
491
494
|
tests/regscale/core/test_api.py,sha256=25AsIT-jg8SrlkPeynUwwm4PvTOrHcRO2Ba_omnNLUY,7512
|
|
492
495
|
tests/regscale/core/test_app.py,sha256=8HvRRD37pI_x4VjXyjs1g7JWXr-jFIbK_lYst4tLXjI,18922
|
|
@@ -514,9 +517,9 @@ tests/regscale/models/test_regscale_model.py,sha256=ZsrEZkC4EtdIsoQuayn1xv2gEGcV
|
|
|
514
517
|
tests/regscale/models/test_report.py,sha256=eiSvS_zS0aVeL0HBvtmHVvEzcfF9ZFVn2twj5g8KttY,970
|
|
515
518
|
tests/regscale/models/test_tenable_integrations.py,sha256=PNJC2Zu6lv1xj7y6e1yOsz5FktSU3PRKb5x3n5YG3w0,4072
|
|
516
519
|
tests/regscale/models/test_user_model.py,sha256=e9olv28qBApgnvK6hFHOgXjUC-pkaV8aGDirEIWASL4,4427
|
|
517
|
-
regscale_cli-6.20.
|
|
518
|
-
regscale_cli-6.20.
|
|
519
|
-
regscale_cli-6.20.
|
|
520
|
-
regscale_cli-6.20.
|
|
521
|
-
regscale_cli-6.20.
|
|
522
|
-
regscale_cli-6.20.
|
|
520
|
+
regscale_cli-6.20.7.0.dist-info/LICENSE,sha256=ytNhYQ9Rmhj_m-EX2pPq9Ld6tH5wrqqDYg-fCf46WDU,1076
|
|
521
|
+
regscale_cli-6.20.7.0.dist-info/METADATA,sha256=IZ2AyF4MaXO3ibPB0Lo44e6NmP5eiN0kd88da56UxSA,34899
|
|
522
|
+
regscale_cli-6.20.7.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
523
|
+
regscale_cli-6.20.7.0.dist-info/entry_points.txt,sha256=cLOaIP1eRv1yZ2u7BvpE3aB4x3kDrDwkpeisKOu33z8,269
|
|
524
|
+
regscale_cli-6.20.7.0.dist-info/top_level.txt,sha256=Uv8VUCAdxRm70bgrD4YNEJUmDhBThad_1aaEFGwRByc,15
|
|
525
|
+
regscale_cli-6.20.7.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
import types
|
|
3
|
+
import unittest
|
|
4
|
+
from unittest.mock import patch, mock_open, MagicMock
|
|
5
|
+
|
|
6
|
+
airflow_exceptions = types.ModuleType("airflow.exceptions")
|
|
7
|
+
airflow_exceptions.AirflowException = Exception
|
|
8
|
+
sys.modules["airflow.exceptions"] = airflow_exceptions
|
|
9
|
+
|
|
10
|
+
airflow_settings = types.ModuleType("airflow.settings")
|
|
11
|
+
airflow_settings.initialize = lambda: None
|
|
12
|
+
airflow_settings.LAZY_LOAD_PROVIDERS = True
|
|
13
|
+
sys.modules["airflow.settings"] = airflow_settings
|
|
14
|
+
|
|
15
|
+
sys.modules["airflow.configuration"] = types.ModuleType("airflow.configuration")
|
|
16
|
+
|
|
17
|
+
airflow_operators = types.ModuleType("airflow.operators")
|
|
18
|
+
airflow_operators_python = types.ModuleType("airflow.operators.python")
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class DummyPythonOperator:
|
|
22
|
+
def __init__(self, *args, **kwargs):
|
|
23
|
+
pass
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
airflow_operators_python.PythonOperator = DummyPythonOperator
|
|
27
|
+
sys.modules["airflow.operators"] = airflow_operators
|
|
28
|
+
sys.modules["airflow.operators.python"] = airflow_operators_python
|
|
29
|
+
|
|
30
|
+
from regscale.airflow.tasks.init import get_shared_keys, set_shared_config_values # noqa: E402
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class TestInitPy(unittest.TestCase):
|
|
34
|
+
@patch("regscale.airflow.tasks.init.execute_click_command")
|
|
35
|
+
@patch("yaml.safe_load", return_value={"foo": "bar"})
|
|
36
|
+
@patch("pathlib.Path.open", new_callable=mock_open, read_data="foo: bar\n")
|
|
37
|
+
def test_get_shared_keys(self, mock_file, mock_yaml, mock_exec):
|
|
38
|
+
"""
|
|
39
|
+
If the YAML and dag_run.conf share a key, we should get that key back and execute the click command once.
|
|
40
|
+
"""
|
|
41
|
+
dag_context = {"dag_run": MagicMock(conf={"foo": "baz"})}
|
|
42
|
+
shared_keys = get_shared_keys("dummy.yaml", **dag_context)
|
|
43
|
+
self.assertEqual(shared_keys, ["foo"])
|
|
44
|
+
mock_exec.assert_called_once()
|
|
45
|
+
|
|
46
|
+
@patch("regscale.airflow.tasks.init.execute_click_command")
|
|
47
|
+
def test_set_shared_config_values(self, mock_exec):
|
|
48
|
+
"""
|
|
49
|
+
When shared keys are found in xcom, set_shared_config_values should call execute_click_command for each.
|
|
50
|
+
"""
|
|
51
|
+
dag_context = {
|
|
52
|
+
"dag_run": MagicMock(conf={"foo": "bar", "op_kwargs": {"shared_keys_task": "task1"}}),
|
|
53
|
+
"ti": MagicMock(xcom_pull=MagicMock(return_value=["foo"])),
|
|
54
|
+
}
|
|
55
|
+
set_shared_config_values(shared_keys_task=None, **dag_context)
|
|
56
|
+
mock_exec.assert_called_once()
|
|
57
|
+
|
|
58
|
+
def test_set_shared_config_values_raises(self):
|
|
59
|
+
"""
|
|
60
|
+
If op_kwargs is missing from dag_run.conf, set_shared_config_values should raise an AirflowException.
|
|
61
|
+
"""
|
|
62
|
+
from airflow.exceptions import AirflowException
|
|
63
|
+
|
|
64
|
+
dag_context = {"dag_run": MagicMock(conf={})}
|
|
65
|
+
with self.assertRaises(AirflowException):
|
|
66
|
+
set_shared_config_values(shared_keys_task=None, **dag_context)
|
|
67
|
+
|
|
68
|
+
@patch("regscale.airflow.tasks.init.execute_click_command")
|
|
69
|
+
def test_set_shared_config_values_warns(self, mock_exec):
|
|
70
|
+
"""
|
|
71
|
+
If xcom_pull returns None, set_shared_config_values should log a warning and not call execute_click_command.
|
|
72
|
+
"""
|
|
73
|
+
dag_context = {
|
|
74
|
+
"dag_run": MagicMock(conf={"foo": "bar", "op_kwargs": {"shared_keys_task": "task1"}}),
|
|
75
|
+
"ti": MagicMock(xcom_pull=MagicMock(return_value=None)),
|
|
76
|
+
}
|
|
77
|
+
with self.assertLogs(level="WARNING") as log:
|
|
78
|
+
set_shared_config_values(shared_keys_task=None, **dag_context)
|
|
79
|
+
self.assertTrue(any("No shared keys found" in msg for msg in log.output))
|
|
80
|
+
mock_exec.assert_not_called()
|
|
81
|
+
|
|
82
|
+
@patch("yaml.safe_load", return_value={"foo": "bar"})
|
|
83
|
+
@patch("pathlib.Path.open", new_callable=mock_open, read_data="foo: bar\n")
|
|
84
|
+
def test_get_shared_keys_logs_error(self, mock_file, mock_yaml):
|
|
85
|
+
"""
|
|
86
|
+
If dag_run is missing from the context, get_shared_keys should log an error and raise KeyError.
|
|
87
|
+
"""
|
|
88
|
+
with self.assertLogs(level="ERROR") as log, self.assertRaises(KeyError):
|
|
89
|
+
get_shared_keys("dummy.yaml")
|
|
90
|
+
self.assertTrue(any("context contains" in msg for msg in log.output))
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
if __name__ == "__main__":
|
|
94
|
+
unittest.main()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|