aepp 0.4.2__py3-none-any.whl → 0.4.3__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.
- aepp/__init__.py +42 -8
- aepp/__version__.py +1 -1
- aepp/flowservice.py +1 -1
- aepp/queryservice.py +23 -13
- aepp/schema.py +28 -1
- aepp/synchronizer.py +8 -2
- {aepp-0.4.2.dist-info → aepp-0.4.3.dist-info}/METADATA +5 -8
- {aepp-0.4.2.dist-info → aepp-0.4.3.dist-info}/RECORD +12 -20
- {aepp-0.4.2.dist-info → aepp-0.4.3.dist-info}/WHEEL +1 -1
- aepp-0.4.3.dist-info/entry_points.txt +2 -0
- aepp-0.4.3.dist-info/top_level.txt +1 -0
- aepp-0.4.2.dist-info/top_level.txt +0 -2
- tests/__init__.py +0 -10
- tests/catalog_test.py +0 -80
- tests/dataaccess_test.py +0 -36
- tests/datasets_test.py +0 -30
- tests/destinationinstanceservice_test.py +0 -36
- tests/exportDatasetToDatalandingZone_test.py +0 -161
- tests/flowservice_test.py +0 -150
- tests/schema_test.py +0 -61
- tests/som_test.py +0 -287
- {aepp-0.4.2.dist-info → aepp-0.4.3.dist-info}/licenses/LICENSE +0 -0
aepp/__init__.py
CHANGED
|
@@ -14,6 +14,7 @@ from aepp import connector
|
|
|
14
14
|
from .configs import *
|
|
15
15
|
from .__version__ import __version__
|
|
16
16
|
from typing import Union
|
|
17
|
+
import re
|
|
17
18
|
|
|
18
19
|
## other libraries
|
|
19
20
|
from copy import deepcopy
|
|
@@ -83,8 +84,33 @@ def getPlatformEvents(
|
|
|
83
84
|
return data
|
|
84
85
|
|
|
85
86
|
|
|
87
|
+
def __make_filename_safe__(filename, replacement="_"):
|
|
88
|
+
# 1. Remove characters that are illegal in Windows or Linux
|
|
89
|
+
# Windows: < > : " / \ | ? * # Linux: / (and NULL)
|
|
90
|
+
filename = re.sub(r'[<>:"/\\|?*]', replacement, filename)
|
|
91
|
+
# 2. Remove control characters (ASCII 0-31)
|
|
92
|
+
filename = re.sub(r'[\x00-\x1f]', replacement, filename)
|
|
93
|
+
# 3. Trim whitespace and trailing dots (Windows doesn't like trailing dots)
|
|
94
|
+
filename = filename.strip().strip('.')
|
|
95
|
+
# 4. Handle Windows Reserved Names (CON, PRN, AUX, NUL, COM1, LPT1, etc.)
|
|
96
|
+
reserved_names = {
|
|
97
|
+
"CON", "PRN", "AUX", "NUL", "COM1", "COM2", "COM3", "COM4", "COM5",
|
|
98
|
+
"COM6", "COM7", "COM8", "COM9", "LPT1", "LPT2", "LPT3", "LPT4", "LPT5",
|
|
99
|
+
"LPT6", "LPT7", "LPT8", "LPT9"
|
|
100
|
+
}
|
|
101
|
+
# Check the base name without extension
|
|
102
|
+
base_name = os.path.splitext(filename)[0].upper()
|
|
103
|
+
if base_name in reserved_names:
|
|
104
|
+
filename = f"{replacement}{filename}"
|
|
105
|
+
# 5. Length limit (standard for most file systems is 255 chars)
|
|
106
|
+
if len(filename) > 255:
|
|
107
|
+
filename = filename[:255]
|
|
108
|
+
# 6. Default to a placeholder if the string is empty after cleaning
|
|
109
|
+
return filename if filename else "unnamed_file"
|
|
110
|
+
|
|
111
|
+
|
|
86
112
|
def saveFile(
|
|
87
|
-
module: str = None,
|
|
113
|
+
module: str | None = None,
|
|
88
114
|
file: object = None,
|
|
89
115
|
filename: str = None,
|
|
90
116
|
type_file: str = "json",
|
|
@@ -93,31 +119,39 @@ def saveFile(
|
|
|
93
119
|
"""
|
|
94
120
|
Save the file in the approriate folder depending on the module sending the information.
|
|
95
121
|
Arguments:
|
|
96
|
-
module:
|
|
122
|
+
module: OPTIONAL: Module requesting the save file.
|
|
97
123
|
file: REQUIRED: an object containing the file to save.
|
|
98
124
|
filename: REQUIRED: the filename to be used.
|
|
99
125
|
type_file: REQUIRED: the type of file to be saveed(default: json)
|
|
100
126
|
encoding : OPTIONAL : encoding used to write the file.
|
|
101
127
|
"""
|
|
102
|
-
if module is None:
|
|
103
|
-
raise ValueError("Require the module to create a folder")
|
|
104
128
|
if file is None or filename is None:
|
|
105
129
|
raise ValueError("Require a object for file and a name for the file")
|
|
106
130
|
here = Path(Path.cwd())
|
|
107
|
-
|
|
108
|
-
|
|
131
|
+
if module is not None:
|
|
132
|
+
folder = module.capitalize()
|
|
133
|
+
new_location = Path.joinpath(here, folder)
|
|
134
|
+
else:
|
|
135
|
+
new_location = here
|
|
109
136
|
if new_location.exists() == False:
|
|
110
137
|
new_location.mkdir()
|
|
138
|
+
filename = __make_filename_safe__(filename)
|
|
111
139
|
if type_file == "json":
|
|
112
140
|
filename = f"{filename}.json"
|
|
113
141
|
complete_path = Path.joinpath(new_location, filename)
|
|
114
142
|
with open(complete_path, "w", encoding=encoding) as f:
|
|
115
143
|
f.write(json.dumps(file, indent=4))
|
|
116
|
-
|
|
144
|
+
elif type_file == "txt":
|
|
117
145
|
filename = f"{filename}.txt"
|
|
118
146
|
complete_path = Path.joinpath(new_location, filename)
|
|
119
147
|
with open(complete_path, "w", encoding=encoding) as f:
|
|
120
148
|
f.write(file)
|
|
149
|
+
else:
|
|
150
|
+
filename = f"{filename}.{type_file}"
|
|
151
|
+
complete_path = Path.joinpath(new_location, filename)
|
|
152
|
+
with open(complete_path, "wb") as f:
|
|
153
|
+
f.write(file)
|
|
154
|
+
return complete_path
|
|
121
155
|
|
|
122
156
|
def __titleSafe__(text: str) -> str:
|
|
123
157
|
"""
|
|
@@ -289,7 +323,7 @@ def extractSandboxArtefact(
|
|
|
289
323
|
sandbox: REQUIRED: the instance of a ConnectObject that contains the sandbox information and connection.
|
|
290
324
|
localFolder: OPTIONAL: the local folder where to extract the sandbox. If not provided, it will use the current working directory and name the folder the name of the sandbox.
|
|
291
325
|
artefact: REQUIRED: the id or the name of the artefact to export.
|
|
292
|
-
artefactType: REQUIRED: the type of artefact to export. Possible values are: 'class','schema','fieldgroup','datatype','descriptor','dataset','identity','mergepolicy'
|
|
326
|
+
artefactType: REQUIRED: the type of artefact to export. Possible values are: 'class','schema','fieldgroup','datatype','descriptor','dataset','identity','mergepolicy',audience'
|
|
293
327
|
region: OPTIONAL: the region of the sandbox (default: nld2). This is used to fetch the correct API endpoints for the identities.
|
|
294
328
|
Possible values: "va7","aus5", "can2", "ind2"
|
|
295
329
|
"""
|
aepp/__version__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.4.
|
|
1
|
+
__version__ = "0.4.3"
|
aepp/flowservice.py
CHANGED
|
@@ -784,7 +784,7 @@ class FlowService:
|
|
|
784
784
|
authenticationRequired:bool=False
|
|
785
785
|
)-> dict:
|
|
786
786
|
"""
|
|
787
|
-
Create a
|
|
787
|
+
Create a source flow streaming with or without transformation
|
|
788
788
|
name : REQUIRED : The name of the Data Flow (Optional if you are just passing a datasetId).
|
|
789
789
|
description : OPTIONAL : description of the Flow
|
|
790
790
|
source_connection_id : REQUIRED : The ID of the source connection tied to Data Lake (Optional if you are just passing a datasetId).
|
aepp/queryservice.py
CHANGED
|
@@ -227,6 +227,8 @@ class QueryService:
|
|
|
227
227
|
if orderby == "+":
|
|
228
228
|
orderby = "%2B"
|
|
229
229
|
arguments["orderby"] = orderby
|
|
230
|
+
else:
|
|
231
|
+
arguments["orderby"] = "-created"
|
|
230
232
|
if start is not None:
|
|
231
233
|
arguments["start"] = start
|
|
232
234
|
if limit is not None:
|
|
@@ -706,27 +708,35 @@ class QueryService:
|
|
|
706
708
|
res = self.connector.deleteData(self.endpoint + path)
|
|
707
709
|
return res
|
|
708
710
|
|
|
709
|
-
def createQueryTemplate(self, queryData: dict = None) -> dict:
|
|
711
|
+
def createQueryTemplate(self, queryData: dict = None,name: str = None,sql: str = None,queryParameters: dict = None) -> dict:
|
|
710
712
|
"""
|
|
711
713
|
Create a query template based on the dictionary passed.
|
|
712
714
|
Arguments:
|
|
713
|
-
queryData : REQUIED : An object that contains "sql"
|
|
714
|
-
|
|
715
|
+
queryData : REQUIED : An object that contains "sql" and "name" keys.
|
|
716
|
+
name : OPTIONAL : Name of the template
|
|
717
|
+
sql : OPTIONAL : SQL query as a string.
|
|
718
|
+
queryParameters : OPTIONAL : in case you are using template, providing the paramter in a dictionary.
|
|
719
|
+
more info : https://developer.adobe.com/experience-platform-apis/references/query-service/#tag/Query-Templates
|
|
715
720
|
"""
|
|
716
721
|
path = "/query-templates"
|
|
717
722
|
if self.loggingEnabled:
|
|
718
723
|
self.logger.debug(f"Starting createTemplate")
|
|
719
|
-
if
|
|
720
|
-
if (
|
|
721
|
-
"sql" not in queryData.keys()
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
)
|
|
724
|
+
if queryData is not None:
|
|
725
|
+
if isinstance(queryData, dict):
|
|
726
|
+
if ("sql" not in queryData.keys() or "name" not in queryData.keys()):
|
|
727
|
+
raise KeyError(
|
|
728
|
+
"Minimum key value are not respected.\nPlease see here for more info :\nhttps://www.adobe.io/apis/experienceplatform/home/api-reference.html#/Query-Templates/create_query_template "
|
|
729
|
+
)
|
|
730
|
+
else:
|
|
731
|
+
raise Exception("expected a dictionary for queryData")
|
|
728
732
|
else:
|
|
729
|
-
|
|
733
|
+
if name is None or sql is None:
|
|
734
|
+
raise Exception(
|
|
735
|
+
"Either queryData dictionary or name and sql parameters are required."
|
|
736
|
+
)
|
|
737
|
+
queryData = {"name": name, "sql": sql}
|
|
738
|
+
if queryParameters is not None:
|
|
739
|
+
queryData["queryParameters"] = queryParameters
|
|
730
740
|
res = self.connector.postData(
|
|
731
741
|
self.endpoint + path, headers=self.header, data=queryData
|
|
732
742
|
)
|
aepp/schema.py
CHANGED
|
@@ -261,6 +261,7 @@ class Schema:
|
|
|
261
261
|
classFilter: str = None,
|
|
262
262
|
excludeAdhoc: bool = True,
|
|
263
263
|
output: str = 'raw',
|
|
264
|
+
prop: str = None,
|
|
264
265
|
**kwargs
|
|
265
266
|
) -> list:
|
|
266
267
|
"""
|
|
@@ -285,6 +286,8 @@ class Schema:
|
|
|
285
286
|
params["property"] = f"meta:extends=={classFilter}"
|
|
286
287
|
elif excludeAdhoc:
|
|
287
288
|
params["property"] = "meta:extends!=https://ns.adobe.com/xdm/data/adhoc"
|
|
289
|
+
if prop is not None:
|
|
290
|
+
params["property"] = prop
|
|
288
291
|
verbose = kwargs.get("debug", False)
|
|
289
292
|
privateHeader = deepcopy(self.header)
|
|
290
293
|
format = kwargs.get("format", "xed-id")
|
|
@@ -1783,7 +1786,7 @@ class Schema:
|
|
|
1783
1786
|
]
|
|
1784
1787
|
res = self.connector.patchData(self.endpoint + path,data=operation)
|
|
1785
1788
|
return res
|
|
1786
|
-
|
|
1789
|
+
|
|
1787
1790
|
def enableSchemaForRealTime(self,schemaId:str=None)->dict:
|
|
1788
1791
|
"""
|
|
1789
1792
|
Enable a schema for real time based on its ID.
|
|
@@ -1808,6 +1811,30 @@ class Schema:
|
|
|
1808
1811
|
res = self.connector.patchData(self.endpoint + path,data=operation)
|
|
1809
1812
|
return res
|
|
1810
1813
|
|
|
1814
|
+
def enableSchemaForUPS(self,schemaId:str=None)->dict:
|
|
1815
|
+
"""
|
|
1816
|
+
Enable a schema for UPS based on its ID.
|
|
1817
|
+
Arguments:
|
|
1818
|
+
schemaId : REQUIRED : The schema ID required to be updated
|
|
1819
|
+
"""
|
|
1820
|
+
if schemaId is None:
|
|
1821
|
+
raise Exception("Require a schema ID")
|
|
1822
|
+
if schemaId.startswith("https://"):
|
|
1823
|
+
from urllib import parse
|
|
1824
|
+
schemaId = parse.quote_plus(schemaId)
|
|
1825
|
+
if self.loggingEnabled:
|
|
1826
|
+
self.logger.debug(f"Starting enableSchemaForUPS")
|
|
1827
|
+
path = f"/{self.container}/schemas/{schemaId}/"
|
|
1828
|
+
operation = [
|
|
1829
|
+
{
|
|
1830
|
+
"op": "add",
|
|
1831
|
+
"path": "/meta:immutableTags",
|
|
1832
|
+
"value": ["union"]
|
|
1833
|
+
}
|
|
1834
|
+
]
|
|
1835
|
+
res = self.connector.patchData(self.endpoint + path,data=operation)
|
|
1836
|
+
return res
|
|
1837
|
+
|
|
1811
1838
|
def FieldGroupManager(self,fieldGroup:Union[dict,str,None],title:str=None,fg_class:list=["experienceevent","profile"]) -> 'FieldGroupManager':
|
|
1812
1839
|
"""
|
|
1813
1840
|
Generates a field group Manager instance using the information provided by the schema instance.
|
aepp/synchronizer.py
CHANGED
|
@@ -1025,6 +1025,12 @@ class Synchronizer:
|
|
|
1025
1025
|
raise Exception("the audience could not be created in the target sandbox")
|
|
1026
1026
|
else: ## audience already exists in target
|
|
1027
1027
|
if verbose:
|
|
1028
|
-
print(f"audience '{audience_name}' already exists in target {target},
|
|
1029
|
-
|
|
1028
|
+
print(f"audience '{audience_name}' already exists in target {target}, updating it")
|
|
1029
|
+
t_audience = [el for el in t_audiences if el['name'] == audience_name][0]
|
|
1030
|
+
t_audience['description'] = baseAudience.get('description','')
|
|
1031
|
+
t_audience['expression'] = baseAudience.get('expression',[])
|
|
1032
|
+
t_audience['ansibleDataModel'] = baseAudience.get('ansibleDataModel',{})
|
|
1033
|
+
t_audience['evaluationInfo'] = baseAudience.get('evaluationInfo',{'batch': {'enabled': True}, 'continuous': {'enabled': False},'synchronous': {'enabled': False}})
|
|
1034
|
+
res = targetAudiences.putAudience(t_audience['id'],t_audience)
|
|
1035
|
+
self.dict_targetComponents[target]['audience'][audience_name] = res
|
|
1030
1036
|
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: aepp
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.3
|
|
4
4
|
Summary: Package to manage AEP API endpoint and some helper functions
|
|
5
5
|
Home-page: https://github.com/adobe/aepp
|
|
6
6
|
Author: Julien Piccini
|
|
7
|
-
Author-email: piccini.julien@gmail.com
|
|
7
|
+
Author-email: Julien Piccini <piccini.julien@gmail.com>
|
|
8
|
+
License: Apache-2.0
|
|
9
|
+
Project-URL: Homepage, https://github.com/adobe/aepp
|
|
8
10
|
Classifier: Programming Language :: Python :: 3
|
|
9
11
|
Classifier: Operating System :: OS Independent
|
|
10
12
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
@@ -21,16 +23,11 @@ Requires-Dist: pathlib2
|
|
|
21
23
|
Requires-Dist: tenacity
|
|
22
24
|
Requires-Dist: deprecation
|
|
23
25
|
Requires-Dist: datamodel-code-generator
|
|
26
|
+
Requires-Dist: rich
|
|
24
27
|
Dynamic: author
|
|
25
|
-
Dynamic: author-email
|
|
26
|
-
Dynamic: classifier
|
|
27
|
-
Dynamic: description
|
|
28
|
-
Dynamic: description-content-type
|
|
29
28
|
Dynamic: home-page
|
|
30
29
|
Dynamic: license-file
|
|
31
|
-
Dynamic: requires-dist
|
|
32
30
|
Dynamic: requires-python
|
|
33
|
-
Dynamic: summary
|
|
34
31
|
|
|
35
32
|
# Adobe Experience Platform API made for humans
|
|
36
33
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
aepp/__init__.py,sha256=
|
|
2
|
-
aepp/__version__.py,sha256
|
|
1
|
+
aepp/__init__.py,sha256=tKlipgknDl84iALUNgR9mktILF3gSk1GgMUw_Gg-HXE,27912
|
|
2
|
+
aepp/__version__.py,sha256=-0DFAS3GW84dLmJEuzbtUA7qvIf_cBb4LhqSg0oFfeI,21
|
|
3
3
|
aepp/accesscontrol.py,sha256=PB3FcrO4bvDjdNxjHx7p_20hp4ahBXewoOSxuTGMXC8,17423
|
|
4
4
|
aepp/catalog.py,sha256=hK9m3SAP0fhgkYqu14Tcfq14qBhw54tLCOF0mH31b1M,68237
|
|
5
5
|
aepp/classmanager.py,sha256=CTYGkg5ygB8HtRia6DfT9WLBqXJOVg7pSM9jBB25Bqw,64707
|
|
@@ -17,34 +17,26 @@ aepp/destinationinstanceservice.py,sha256=zEZbKi519cOOdxWMZ3mv9ccP6yjNAlNwqrQMlz
|
|
|
17
17
|
aepp/edge.py,sha256=F2QZApmITObXB8hRWXftHBZ82KNqVZ7iSNuovT8qnk4,16041
|
|
18
18
|
aepp/exportDatasetToDataLandingZone.py,sha256=C6jg3XttFC-0mswa3ypZb6qx3MCQ8_A_3kyKspurXJA,18629
|
|
19
19
|
aepp/fieldgroupmanager.py,sha256=OQkSuGiSxU5ToSPqKmB_3Pmfg6aZjQMGL6LFnODqEiY,101560
|
|
20
|
-
aepp/flowservice.py,sha256=
|
|
20
|
+
aepp/flowservice.py,sha256=nj9dq3zBRT5I8Xb2EwI4VOToJX575Su5lNFvQ6o4HKI,107617
|
|
21
21
|
aepp/hygiene.py,sha256=VEspnyu9eUlcK3wLeJYclaFaOWl5G5I5MRwmVA-RnUg,15385
|
|
22
22
|
aepp/identity.py,sha256=E9MCIgntScMssduqKZqehT6FqSfTjWHcq7E7wESj3Zc,20833
|
|
23
23
|
aepp/ingestion.py,sha256=OamE7NDei2Ev5vXIDkMlzvdyBaN41nkIGmpAnUlQoZI,22372
|
|
24
24
|
aepp/observability.py,sha256=bKe74nlXYB5E5syh7Lj4VqIgwUI3OjMxK383P05EdLU,9951
|
|
25
25
|
aepp/policy.py,sha256=JbpvfCKJl2kE2McK2mn_ZI5HKd_6pTnrfMoUdyJesWQ,24924
|
|
26
26
|
aepp/privacyservice.py,sha256=V6BkJeZG1LDBCyEQm9Gx0i68iRHG6uxSJiVnXzkHapI,8790
|
|
27
|
-
aepp/queryservice.py,sha256=
|
|
27
|
+
aepp/queryservice.py,sha256=wB9GiaMwJszNjqkYjkfEDUhdT2IoI22jA3Kt_6ki4Hk,62373
|
|
28
28
|
aepp/sandboxes.py,sha256=UwlSFkO2OOmH--6ISz8rxwDu2LcLH1MPqoH7yOEAZHc,29363
|
|
29
|
-
aepp/schema.py,sha256=
|
|
29
|
+
aepp/schema.py,sha256=aLYDM5lCANNddk-NZPNxCxazg9HpELalKlFxQz55dRs,123111
|
|
30
30
|
aepp/schemamanager.py,sha256=hwItd4vXsPFeV25gX1Fbeiu07-BCg4z_VRQREMgJZ58,50738
|
|
31
31
|
aepp/segmentation.py,sha256=oSgR2yx4nawYN5XAeHV_wefvmXEf0nb-bCguaDmp8F8,43555
|
|
32
32
|
aepp/sensei.py,sha256=oYNy5BSWAEqsDkEexcQso6NfA6ntGGMnCOyHri0pJs8,7761
|
|
33
33
|
aepp/som.py,sha256=XNm_Lu2wt2kpSSpldLptuER2eludFXeO9fI6i3iNCzo,34175
|
|
34
|
-
aepp/synchronizer.py,sha256=
|
|
34
|
+
aepp/synchronizer.py,sha256=nkZ3dn335JmwzzO3PqYkMhU7ZfiOHGKObfL1yZrnHLY,77932
|
|
35
35
|
aepp/tags.py,sha256=t2qBallTcWR4IOXcDBmrPpqjbSay1z3E2bcRijzVm1s,17641
|
|
36
36
|
aepp/utils.py,sha256=tG-YVXylm38-bynqfp5N_Mzyo7mhlZj-dLo7wLoO4tM,1200
|
|
37
|
-
aepp-0.4.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
tests/exportDatasetToDatalandingZone_test.py,sha256=193AgQR8yhnQmRWV9pgYz1X2Hz-YEp3ESuNEh3hrTAM,7603
|
|
44
|
-
tests/flowservice_test.py,sha256=Y1mpYWbKYL_x-ZlIY-EuOuNvlzVV1ERlKseDO7gN3Ss,4208
|
|
45
|
-
tests/schema_test.py,sha256=6UsgdsizKmii1hzREpBEKWvZouXdJMvU68UKSxlt1uk,2774
|
|
46
|
-
tests/som_test.py,sha256=a4ut0pEg1HJVMTESaPITmj7YkF54eWCMzKxTMIS-VvM,12101
|
|
47
|
-
aepp-0.4.2.dist-info/METADATA,sha256=nCyugz0f9W1kg7B-VVHAlYrKQt7Pifwq4Jh7CJ0SmRc,5470
|
|
48
|
-
aepp-0.4.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
49
|
-
aepp-0.4.2.dist-info/top_level.txt,sha256=Gn88pv1ywuEAgOvhmmXXhN4dosEfCrBNDskje3nqS34,11
|
|
50
|
-
aepp-0.4.2.dist-info/RECORD,,
|
|
37
|
+
aepp-0.4.3.dist-info/licenses/LICENSE,sha256=HjYTlfne3BbS5gNHzNqJ5COCiTQLUdf87QkzRyFbE4Y,10337
|
|
38
|
+
aepp-0.4.3.dist-info/METADATA,sha256=xvZ4EKktA2D5XdlRSK3HGvqYijONkYB0pydXusr0YvA,5440
|
|
39
|
+
aepp-0.4.3.dist-info/WHEEL,sha256=qELbo2s1Yzl39ZmrAibXA2jjPLUYfnVhUNTlyF1rq0Y,92
|
|
40
|
+
aepp-0.4.3.dist-info/entry_points.txt,sha256=e7HAumUTymoUiCuVRzFlcchennUBLcjxvuiimySF98Y,48
|
|
41
|
+
aepp-0.4.3.dist-info/top_level.txt,sha256=dtZJI8SzhWVgZRl68PHKZX_fD6amvDiFR-lqD9FSJvE,5
|
|
42
|
+
aepp-0.4.3.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
aepp
|
tests/__init__.py
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
# Copyright 2023 Adobe. All rights reserved.
|
|
2
|
-
# This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
3
|
-
# you may not use this file except in compliance with the License. You may obtain a copy
|
|
4
|
-
# of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
5
|
-
#
|
|
6
|
-
# Unless required by applicable law or agreed to in writing, software distributed under
|
|
7
|
-
# the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
8
|
-
# OF ANY KIND, either express or implied. See the License for the specific language
|
|
9
|
-
# governing permissions and limitations under the License.
|
|
10
|
-
|
tests/catalog_test.py
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
# Copyright 2023 Adobe. All rights reserved.
|
|
2
|
-
# This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
3
|
-
# you may not use this file except in compliance with the License. You may obtain a copy
|
|
4
|
-
# of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
5
|
-
#
|
|
6
|
-
# Unless required by applicable law or agreed to in writing, software distributed under
|
|
7
|
-
# the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
8
|
-
# OF ANY KIND, either express or implied. See the License for the specific language
|
|
9
|
-
# governing permissions and limitations under the License.
|
|
10
|
-
|
|
11
|
-
from aepp.schema import Schema
|
|
12
|
-
import unittest
|
|
13
|
-
from unittest.mock import patch, MagicMock
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
class CatalogTest(unittest.TestCase):
|
|
17
|
-
|
|
18
|
-
def test_catalog_get_catalog__resource(self):
|
|
19
|
-
assert True
|
|
20
|
-
|
|
21
|
-
def test_catalog_decode_stream_batch(self):
|
|
22
|
-
assert True
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
def test_catalog_json_stream_messages(self):
|
|
26
|
-
assert True
|
|
27
|
-
|
|
28
|
-
def test_catalog_get_batches(self):
|
|
29
|
-
assert True
|
|
30
|
-
|
|
31
|
-
def test_catalog_get_failed_batches_df(self):
|
|
32
|
-
assert True
|
|
33
|
-
|
|
34
|
-
def test_catalog_get_batch(self):
|
|
35
|
-
assert True
|
|
36
|
-
|
|
37
|
-
def test_catalog_create_batch(self):
|
|
38
|
-
assert True
|
|
39
|
-
|
|
40
|
-
def test_catalog_get_resources(self):
|
|
41
|
-
assert True
|
|
42
|
-
|
|
43
|
-
def test_catalog_get_data_sets(self):
|
|
44
|
-
assert True
|
|
45
|
-
|
|
46
|
-
def test_catalog_create_datasets(self):
|
|
47
|
-
assert True
|
|
48
|
-
|
|
49
|
-
def test_catalog_get_data_set(self):
|
|
50
|
-
assert True
|
|
51
|
-
|
|
52
|
-
def test_catalog_delete_data_set(self):
|
|
53
|
-
assert True
|
|
54
|
-
|
|
55
|
-
def test_catalog_get_data_set_views(self):
|
|
56
|
-
assert True
|
|
57
|
-
|
|
58
|
-
def test_catalog_get_data_set_view(self):
|
|
59
|
-
assert True
|
|
60
|
-
|
|
61
|
-
def test_catalog_get_dataset_view_files(self):
|
|
62
|
-
assert True
|
|
63
|
-
|
|
64
|
-
def test_catalog_enable_dataset_profile(self):
|
|
65
|
-
assert True
|
|
66
|
-
|
|
67
|
-
def test_catalog_enable_dataset_identity(self):
|
|
68
|
-
assert True
|
|
69
|
-
|
|
70
|
-
def test_catalog_disable_dataset_profile(self):
|
|
71
|
-
assert True
|
|
72
|
-
|
|
73
|
-
def test_catalog_disable_dataset_identity(self):
|
|
74
|
-
assert True
|
|
75
|
-
|
|
76
|
-
def test_catalog_create_union_profile_dataset(self):
|
|
77
|
-
assert True
|
|
78
|
-
|
|
79
|
-
def test_catalog_get_mapper_errors(self):
|
|
80
|
-
assert True
|
tests/dataaccess_test.py
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
# Copyright 2023 Adobe. All rights reserved.
|
|
2
|
-
# This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
3
|
-
# you may not use this file except in compliance with the License. You may obtain a copy
|
|
4
|
-
# of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
5
|
-
#
|
|
6
|
-
# Unless required by applicable law or agreed to in writing, software distributed under
|
|
7
|
-
# the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
8
|
-
# OF ANY KIND, either express or implied. See the License for the specific language
|
|
9
|
-
# governing permissions and limitations under the License.
|
|
10
|
-
|
|
11
|
-
from aepp.schema import Schema
|
|
12
|
-
import unittest
|
|
13
|
-
from unittest.mock import patch, MagicMock
|
|
14
|
-
|
|
15
|
-
class DataAccessTest(unittest.TestCase):
|
|
16
|
-
|
|
17
|
-
def test_dataaccess_get_batch_files(self):
|
|
18
|
-
assert True
|
|
19
|
-
|
|
20
|
-
def test_dataaccess_get_batch_failed(self):
|
|
21
|
-
assert True
|
|
22
|
-
|
|
23
|
-
def test_dataaccess_get_batch_meta(self):
|
|
24
|
-
assert True
|
|
25
|
-
|
|
26
|
-
def test_dataaccess_getHeadFile(self):
|
|
27
|
-
assert True
|
|
28
|
-
|
|
29
|
-
def test_dataaccess_get_files(self):
|
|
30
|
-
assert True
|
|
31
|
-
|
|
32
|
-
def test_dataaccess_get_preview(self):
|
|
33
|
-
assert True
|
|
34
|
-
|
|
35
|
-
def test_dataaccess_get_resource(self):
|
|
36
|
-
assert True
|
tests/datasets_test.py
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
# Copyright 2023 Adobe. All rights reserved.
|
|
2
|
-
# This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
3
|
-
# you may not use this file except in compliance with the License. You may obtain a copy
|
|
4
|
-
# of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
5
|
-
#
|
|
6
|
-
# Unless required by applicable law or agreed to in writing, software distributed under
|
|
7
|
-
# the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
8
|
-
# OF ANY KIND, either express or implied. See the License for the specific language
|
|
9
|
-
# governing permissions and limitations under the License.
|
|
10
|
-
|
|
11
|
-
from aepp.schema import Schema
|
|
12
|
-
import unittest
|
|
13
|
-
from unittest.mock import patch, MagicMock
|
|
14
|
-
|
|
15
|
-
class DatasetsTest(unittest.TestCase):
|
|
16
|
-
|
|
17
|
-
def test_datasets_get_label_schema(self):
|
|
18
|
-
assert True
|
|
19
|
-
|
|
20
|
-
def test_datasets_head_label(self):
|
|
21
|
-
assert True
|
|
22
|
-
|
|
23
|
-
def test_datasets_delete_labels(self):
|
|
24
|
-
assert True
|
|
25
|
-
|
|
26
|
-
def test_datasets_create_labels(self):
|
|
27
|
-
assert True
|
|
28
|
-
|
|
29
|
-
def test_datasets_update_labels(self):
|
|
30
|
-
assert True
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
# Copyright 2023 Adobe. All rights reserved.
|
|
2
|
-
# This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
3
|
-
# you may not use this file except in compliance with the License. You may obtain a copy
|
|
4
|
-
# of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
5
|
-
#
|
|
6
|
-
# Unless required by applicable law or agreed to in writing, software distributed under
|
|
7
|
-
# the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
8
|
-
# OF ANY KIND, either express or implied. See the License for the specific language
|
|
9
|
-
# governing permissions and limitations under the License.
|
|
10
|
-
|
|
11
|
-
from aepp.destinationinstanceservice import DestinationInstanceService
|
|
12
|
-
import unittest
|
|
13
|
-
from unittest.mock import patch, MagicMock, ANY
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
class DestinationInstanceServiceTest(unittest.TestCase):
|
|
17
|
-
ADHOC_INPUT = {"flow1": ["dataset1"], "flow2": ["dataset2", "dataset3"]}
|
|
18
|
-
ADHOC_EXPECTED_PAYLOAD = {'activationInfo': {'destinations': [{'flowId': 'flow1', 'datasets': [{'id': 'dataset1'}]}, {'flowId': 'flow2', 'datasets': [{'id': 'dataset2'}, {'id': 'dataset3'}]}]}}
|
|
19
|
-
|
|
20
|
-
@patch("aepp.connector.AdobeRequest")
|
|
21
|
-
def test_create_adhoc_dataset_export(self, mock_connector):
|
|
22
|
-
instance_conn = mock_connector.return_value
|
|
23
|
-
instance_conn.postData.return_value = {'foo'}
|
|
24
|
-
destination_instance_service_obj = DestinationInstanceService()
|
|
25
|
-
result = destination_instance_service_obj.createAdHocDatasetExport(self.ADHOC_INPUT)
|
|
26
|
-
assert(result is not None)
|
|
27
|
-
instance_conn.postData.assert_called_once()
|
|
28
|
-
instance_conn.postData.assert_called_with(ANY, data=self.ADHOC_EXPECTED_PAYLOAD)
|
|
29
|
-
|
|
30
|
-
@patch("aepp.connector.AdobeRequest")
|
|
31
|
-
def test_create_adhoc_dataset_export_invalid_input(self, mock_connector):
|
|
32
|
-
destination_instance_service_obj = DestinationInstanceService()
|
|
33
|
-
with self.assertRaises(Exception) as cm:
|
|
34
|
-
destination_instance_service_obj.createAdHocDatasetExport(None)
|
|
35
|
-
self.assertEqual('Require a dict for defining the flowId to datasetIds mapping', str(cm.exception))
|
|
36
|
-
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
# Copyright 2023 Adobe. All rights reserved.
|
|
2
|
-
# This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
3
|
-
# you may not use this file except in compliance with the License. You may obtain a copy
|
|
4
|
-
# of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
5
|
-
#
|
|
6
|
-
# Unless required by applicable law or agreed to in writing, software distributed under
|
|
7
|
-
# the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
8
|
-
# OF ANY KIND, either express or implied. See the License for the specific language
|
|
9
|
-
# governing permissions and limitations under the License.
|
|
10
|
-
|
|
11
|
-
from aepp.exportDatasetToDataLandingZone import ExportDatasetToDataLandingZone
|
|
12
|
-
import unittest
|
|
13
|
-
from unittest.mock import patch, MagicMock, ANY
|
|
14
|
-
from tenacity import RetryError
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
class ExportDatasetToDataLandingZoneTest(unittest.TestCase):
|
|
18
|
-
flow_response = {
|
|
19
|
-
"id": "df193495-9837-407f-9d50-e51efc067cb5",
|
|
20
|
-
"sourceConnectionIds": [
|
|
21
|
-
"78754315-852c-4c4e-8f1a-d12b83264f3f"
|
|
22
|
-
],
|
|
23
|
-
"state": "disabled",
|
|
24
|
-
"etag": "test_etag"}
|
|
25
|
-
|
|
26
|
-
connection_spec = {
|
|
27
|
-
"name": "test",
|
|
28
|
-
"id": "test_connection_id"
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
source_connection = {
|
|
33
|
-
"id": "test_source_connection_id",
|
|
34
|
-
"params": {
|
|
35
|
-
"datasets": [{
|
|
36
|
-
"dataSetId": "test"
|
|
37
|
-
}]}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
base_connection = {
|
|
41
|
-
"id": "test_base_connection_id"
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
target_connection = {
|
|
45
|
-
"id": "test_target_connection_id"
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
flow_run = {
|
|
49
|
-
"items": [
|
|
50
|
-
{
|
|
51
|
-
"id": "test_id",
|
|
52
|
-
"metrics": {
|
|
53
|
-
"durationSummary": {
|
|
54
|
-
"startedAtUTC": 1691184699,
|
|
55
|
-
"completedAtUTC": 1691184819
|
|
56
|
-
},
|
|
57
|
-
"fileSummary": {
|
|
58
|
-
"outputFileCount": 24
|
|
59
|
-
},
|
|
60
|
-
"sizeSummary": {
|
|
61
|
-
"outputBytes": 77494320
|
|
62
|
-
},
|
|
63
|
-
"recordSummary": {
|
|
64
|
-
"outputRecordCount": 1065802
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
]
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
adhoc_success_response = {
|
|
72
|
-
"destinations":[
|
|
73
|
-
{
|
|
74
|
-
"datasets":[
|
|
75
|
-
{
|
|
76
|
-
"id":"641ce00b8f31811b98dd3b56",
|
|
77
|
-
"statusURL":"https: //platform-stage.adobe.io/data/foundation/flowservice/runs/aa39ad3d-24ba-4579-9cdc-55536c408721",
|
|
78
|
-
"flowId":"3eaa2c0b-e24b-46bd-8eee-bbaf9d6cf2cb"
|
|
79
|
-
}
|
|
80
|
-
]
|
|
81
|
-
}
|
|
82
|
-
]
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
adhoc_non_retry_error = {
|
|
87
|
-
"error_code": "401013",
|
|
88
|
-
"message": "Oauth token is not valid"
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
adhoc_retry_error = {
|
|
92
|
-
"message": "Following order ID(s) are not ready for dataset export"
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
config = {
|
|
96
|
-
"org_id": "3ADF23C463D98F640A494032@AdobeOrg",
|
|
97
|
-
"client_id": "35e6e4d205274c4ca1418805ac41153b",
|
|
98
|
-
"tech_id": "test005@techacct.adobe.com",
|
|
99
|
-
"pathToKey": "/Users/Downloads/config/private.key",
|
|
100
|
-
"auth_code": "",
|
|
101
|
-
"secret": "test",
|
|
102
|
-
"date_limit": 0,
|
|
103
|
-
"sandbox": "prod",
|
|
104
|
-
"environment": "stage",
|
|
105
|
-
"token": "token",
|
|
106
|
-
"oauthTokenEndpoint": "",
|
|
107
|
-
"imsEndpoint": "https://ims-na1-stg1.adobelogin.com",
|
|
108
|
-
"private_key": ""
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
@patch('aepp.utils.Utils.check_if_exists', MagicMock(return_value = "test_dataflow_id"))
|
|
112
|
-
@patch('aepp.flowservice.FlowService.getFlow', MagicMock(return_value = flow_response))
|
|
113
|
-
@patch('aepp.flowservice.FlowService.getSourceConnection', MagicMock(return_value = source_connection))
|
|
114
|
-
@patch('aepp.flowservice.FlowService.getRun', MagicMock(return_value = flow_run))
|
|
115
|
-
@patch('aepp.destinationinstanceservice.DestinationInstanceService.createAdHocDatasetExport', MagicMock(return_value = adhoc_success_response))
|
|
116
|
-
@patch("aepp.connector.AdobeRequest", MagicMock())
|
|
117
|
-
def test_create_dataflow_if_exist(self):
|
|
118
|
-
export_obj = ExportDatasetToDataLandingZone(config= self.config, header= MagicMock())
|
|
119
|
-
export_obj.createDataFlowRunIfNotExists(dataset_id="test", compression_type="gzip", data_format="parquet", export_path="test", on_schedule=False, config_path="test", entity_name="test", initial_delay=0)
|
|
120
|
-
|
|
121
|
-
@patch('aepp.utils.Utils.check_if_exists', MagicMock(return_value = "test_dataflow_id"))
|
|
122
|
-
@patch('aepp.flowservice.FlowService.getFlow', MagicMock(return_value = flow_response))
|
|
123
|
-
@patch('aepp.flowservice.FlowService.getSourceConnection', MagicMock(return_value = source_connection))
|
|
124
|
-
@patch("aepp.connector.AdobeRequest", MagicMock())
|
|
125
|
-
def test_create_dataflow_on_schedule(self):
|
|
126
|
-
export_obj = ExportDatasetToDataLandingZone(config= self.config, header= MagicMock())
|
|
127
|
-
export_obj.createDataFlowRunIfNotExists(dataset_id="test", compression_type="gzip", data_format="parquet", export_path="test", on_schedule=True, config_path="test",entity_name="test", initial_delay=0)
|
|
128
|
-
|
|
129
|
-
@patch('aepp.flowservice.FlowService.createConnection', MagicMock(return_value = base_connection))
|
|
130
|
-
@patch('aepp.flowservice.FlowService.getConnectionSpecIdFromName', MagicMock(return_value = connection_spec))
|
|
131
|
-
@patch('aepp.flowservice.FlowService.createSourceConnection', MagicMock(return_value = source_connection))
|
|
132
|
-
@patch('aepp.flowservice.FlowService.createTargetConnection', MagicMock(return_value = target_connection))
|
|
133
|
-
@patch('aepp.flowservice.FlowService.createFlow', MagicMock(return_value = flow_response))
|
|
134
|
-
@patch('aepp.utils.Utils.save_field_in_config', MagicMock())
|
|
135
|
-
@patch("aepp.connector.AdobeRequest", MagicMock())
|
|
136
|
-
def test_create_dataflow_if_not_exist(self):
|
|
137
|
-
export_obj = ExportDatasetToDataLandingZone(config= self.config, header= MagicMock())
|
|
138
|
-
return_dataflow_id = export_obj.createDataFlow(dataset_id="test", compression_type="gzip", data_format="parquet", export_path="test", on_schedule=False, config_path="test", entity_name="test")
|
|
139
|
-
assert (return_dataflow_id == self.flow_response["id"])
|
|
140
|
-
|
|
141
|
-
@patch('aepp.destinationinstanceservice.DestinationInstanceService.createAdHocDatasetExport', MagicMock(return_value = adhoc_success_response))
|
|
142
|
-
@patch("aepp.connector.AdobeRequest", MagicMock())
|
|
143
|
-
def test_retry_on_success_response(self):
|
|
144
|
-
export_obj = ExportDatasetToDataLandingZone(config= self.config, header= MagicMock())
|
|
145
|
-
assert(export_obj.retryOnNotReadyException("test", "test", 1, 1) == self.adhoc_success_response)
|
|
146
|
-
|
|
147
|
-
@patch('aepp.destinationinstanceservice.DestinationInstanceService.createAdHocDatasetExport', MagicMock(return_value = adhoc_non_retry_error))
|
|
148
|
-
@patch("aepp.connector.AdobeRequest", MagicMock())
|
|
149
|
-
def test_no_retry_error(self):
|
|
150
|
-
export_obj = ExportDatasetToDataLandingZone(config= self.config, header= MagicMock())
|
|
151
|
-
assert (export_obj.retryOnNotReadyException("test", "test", 1, 1) == self.adhoc_non_retry_error)
|
|
152
|
-
|
|
153
|
-
@patch('aepp.destinationinstanceservice.DestinationInstanceService.createAdHocDatasetExport', MagicMock(return_value = adhoc_retry_error))
|
|
154
|
-
@patch("aepp.connector.AdobeRequest", MagicMock())
|
|
155
|
-
def test_retry_error(self):
|
|
156
|
-
export_obj = ExportDatasetToDataLandingZone(config= self.config, header= MagicMock())
|
|
157
|
-
try:
|
|
158
|
-
export_obj.retryOnNotReadyException("test", "test", 1, 1)
|
|
159
|
-
self.fail("expect a retry error")
|
|
160
|
-
except RetryError:
|
|
161
|
-
pass
|
tests/flowservice_test.py
DELETED
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
# Copyright 2023 Adobe. All rights reserved.
|
|
2
|
-
# This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
3
|
-
# you may not use this file except in compliance with the License. You may obtain a copy
|
|
4
|
-
# of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
5
|
-
#
|
|
6
|
-
# Unless required by applicable law or agreed to in writing, software distributed under
|
|
7
|
-
# the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
8
|
-
# OF ANY KIND, either express or implied. See the License for the specific language
|
|
9
|
-
# governing permissions and limitations under the License.
|
|
10
|
-
|
|
11
|
-
from aepp.schema import Schema
|
|
12
|
-
import unittest
|
|
13
|
-
from unittest.mock import patch, MagicMock
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
class FlowserviceTest(unittest.TestCase):
|
|
17
|
-
|
|
18
|
-
def test_flowservice_get_resource(self):
|
|
19
|
-
assert True
|
|
20
|
-
|
|
21
|
-
def test_flowservice_get_connections(self):
|
|
22
|
-
assert True
|
|
23
|
-
|
|
24
|
-
def test_flowservice_create_connection(self):
|
|
25
|
-
assert True
|
|
26
|
-
|
|
27
|
-
def test_flowservice_create_streaming_connection(self):
|
|
28
|
-
assert True
|
|
29
|
-
|
|
30
|
-
def test_flowservice_get_connection(self):
|
|
31
|
-
assert True
|
|
32
|
-
|
|
33
|
-
def test_flowservice_connection(self):
|
|
34
|
-
assert True
|
|
35
|
-
|
|
36
|
-
def test_flowservice_delete_connection(self):
|
|
37
|
-
assert True
|
|
38
|
-
|
|
39
|
-
def test_flowservice_get_connection_specs(self):
|
|
40
|
-
assert True
|
|
41
|
-
|
|
42
|
-
def test_flowservice_get_connection_specs_map(self):
|
|
43
|
-
assert True
|
|
44
|
-
|
|
45
|
-
def test_flowservice_get_connection_spec(self):
|
|
46
|
-
assert True
|
|
47
|
-
|
|
48
|
-
def test_flowservice_get_connection_specid_from_name(self):
|
|
49
|
-
assert True
|
|
50
|
-
|
|
51
|
-
def test_flowservice_get_flows(self):
|
|
52
|
-
assert True
|
|
53
|
-
|
|
54
|
-
def test_flowservice_get_flow(self):
|
|
55
|
-
assert True
|
|
56
|
-
|
|
57
|
-
def test_flowservice_delete_flow(self):
|
|
58
|
-
assert True
|
|
59
|
-
|
|
60
|
-
def test_flowservice_create_flow(self):
|
|
61
|
-
assert True
|
|
62
|
-
|
|
63
|
-
def test_flowservice_create_flow_data_lake_to_data_landing_zone(self):
|
|
64
|
-
assert True
|
|
65
|
-
|
|
66
|
-
def test_flowservice_create_data_landing_zone_to_datalake(self):
|
|
67
|
-
assert True
|
|
68
|
-
|
|
69
|
-
def test_flowservice_updateFlow(self):
|
|
70
|
-
assert True
|
|
71
|
-
|
|
72
|
-
def test_flowservice_get_flow_specs(self):
|
|
73
|
-
assert True
|
|
74
|
-
|
|
75
|
-
def test_flowservice_get_flow_spec_id_from_names(self):
|
|
76
|
-
assert True
|
|
77
|
-
|
|
78
|
-
def test_flowservice_get_flow_spec(self):
|
|
79
|
-
assert True
|
|
80
|
-
|
|
81
|
-
def test_flowservice_get_runs(self):
|
|
82
|
-
assert True
|
|
83
|
-
|
|
84
|
-
def test_flowservice_create_run(self):
|
|
85
|
-
assert True
|
|
86
|
-
|
|
87
|
-
def test_flowservice_get_run(self):
|
|
88
|
-
assert True
|
|
89
|
-
|
|
90
|
-
def test_flowservice_get_source_connections(self):
|
|
91
|
-
assert True
|
|
92
|
-
|
|
93
|
-
def test_flowservice_get_source_connection(self):
|
|
94
|
-
assert True
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
def test_flowsevrice_delete_source_connection(self):
|
|
98
|
-
assert True
|
|
99
|
-
|
|
100
|
-
def test_flowservice_create_source_connection(self):
|
|
101
|
-
assert True
|
|
102
|
-
|
|
103
|
-
def test_flowservice_create_source_connection_streaming(self):
|
|
104
|
-
assert True
|
|
105
|
-
|
|
106
|
-
def test_flowservice_create_source_connectionDataLandingZone(self):
|
|
107
|
-
assert True
|
|
108
|
-
|
|
109
|
-
def test_flowservice_create_source_connection_datalake(self):
|
|
110
|
-
assert True
|
|
111
|
-
|
|
112
|
-
def test_flowservice_update_source_connection(self):
|
|
113
|
-
assert True
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
def test_flowservice_get_target_connections(self):
|
|
117
|
-
assert True
|
|
118
|
-
|
|
119
|
-
def test_flowservice_get_target_connection(self):
|
|
120
|
-
assert True
|
|
121
|
-
|
|
122
|
-
def test_flowservice_delete_target_connection(self):
|
|
123
|
-
assert True
|
|
124
|
-
|
|
125
|
-
def test_flowservice_create_target_connection(self):
|
|
126
|
-
assert True
|
|
127
|
-
|
|
128
|
-
def test_flowservice_create_target_connection_data_landin_zone(self):
|
|
129
|
-
assert True
|
|
130
|
-
|
|
131
|
-
def test_flowservice_create_target_connection_datalake(self):
|
|
132
|
-
assert True
|
|
133
|
-
|
|
134
|
-
def test_flowservice_update_target_connection(self):
|
|
135
|
-
assert True
|
|
136
|
-
|
|
137
|
-
def test_flowservice_update_policy(self):
|
|
138
|
-
assert True
|
|
139
|
-
|
|
140
|
-
def test_flowservice_get_landing_zone_container(self):
|
|
141
|
-
assert True
|
|
142
|
-
|
|
143
|
-
def test_flowservice_get_landing_zone_credential(self):
|
|
144
|
-
assert True
|
|
145
|
-
|
|
146
|
-
def test_flowservice_explore_landing_zone(self):
|
|
147
|
-
assert True
|
|
148
|
-
|
|
149
|
-
def test_flowservice_get_landing_zone_content(self):
|
|
150
|
-
assert True
|
tests/schema_test.py
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
# Copyright 2023 Adobe. All rights reserved.
|
|
2
|
-
# This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
3
|
-
# you may not use this file except in compliance with the License. You may obtain a copy
|
|
4
|
-
# of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
5
|
-
#
|
|
6
|
-
# Unless required by applicable law or agreed to in writing, software distributed under
|
|
7
|
-
# the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
8
|
-
# OF ANY KIND, either express or implied. See the License for the specific language
|
|
9
|
-
# governing permissions and limitations under the License.
|
|
10
|
-
|
|
11
|
-
from aepp.schema import Schema
|
|
12
|
-
import unittest
|
|
13
|
-
from unittest.mock import patch, MagicMock
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
class SchemaTest(unittest.TestCase):
|
|
17
|
-
|
|
18
|
-
@patch("aepp.connector.AdobeRequest")
|
|
19
|
-
def test_schema_get_resource(self, mock_connector):
|
|
20
|
-
instance_conn = mock_connector.return_value
|
|
21
|
-
instance_conn.getData.return_value = "foo"
|
|
22
|
-
schema_obj = Schema()
|
|
23
|
-
result = schema_obj.getResource(MagicMock(), MagicMock(), MagicMock(), MagicMock())
|
|
24
|
-
assert(result is not None)
|
|
25
|
-
instance_conn.getData.assert_called_once()
|
|
26
|
-
|
|
27
|
-
@patch("aepp.connector.AdobeRequest")
|
|
28
|
-
def test_schema_update_sandbox(self, mock_connector):
|
|
29
|
-
schema_obj = Schema()
|
|
30
|
-
test_sandbox = "prod"
|
|
31
|
-
schema_obj.updateSandbox(test_sandbox)
|
|
32
|
-
assert(schema_obj.sandbox == test_sandbox)
|
|
33
|
-
|
|
34
|
-
@patch("aepp.connector.AdobeRequest")
|
|
35
|
-
def test_schema_get_stats(self, mock_connector):
|
|
36
|
-
instance_conn = mock_connector.return_value
|
|
37
|
-
instance_conn.getData.return_value = MagicMock()
|
|
38
|
-
schema_obj = Schema()
|
|
39
|
-
stats_result = schema_obj.getStats()
|
|
40
|
-
assert (stats_result is not None)
|
|
41
|
-
assert(stats_result == instance_conn.getData.return_value)
|
|
42
|
-
instance_conn.getData.assert_called_once()
|
|
43
|
-
|
|
44
|
-
@patch("aepp.connector.AdobeRequest")
|
|
45
|
-
def test_schema_get_tenant_id(self, mock_connector):
|
|
46
|
-
instance_conn = mock_connector.return_value
|
|
47
|
-
instance_conn.getStats.return_value = MagicMock()
|
|
48
|
-
schema_obj = Schema()
|
|
49
|
-
tenant_id_result = schema_obj.getTenantId()
|
|
50
|
-
assert (tenant_id_result is not None)
|
|
51
|
-
instance_conn.getData.assert_called_once()
|
|
52
|
-
|
|
53
|
-
@patch("aepp.connector.AdobeRequest")
|
|
54
|
-
def test_schema_get_behavior(self, mock_connector):
|
|
55
|
-
instance_conn = mock_connector.return_value
|
|
56
|
-
instance_conn.getData.return_value = {"results":[1234,5678]}
|
|
57
|
-
schema_obj = Schema()
|
|
58
|
-
stats_result = schema_obj.getBehaviors()
|
|
59
|
-
assert (stats_result is not None)
|
|
60
|
-
assert (stats_result == instance_conn.getData.return_value.get("results"))
|
|
61
|
-
instance_conn.getData.assert_called_once()
|
tests/som_test.py
DELETED
|
@@ -1,287 +0,0 @@
|
|
|
1
|
-
# Copyright 2023 Adobe. All rights reserved.
|
|
2
|
-
# This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
3
|
-
# you may not use this file except in compliance with the License. You may obtain a copy
|
|
4
|
-
# of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
5
|
-
#
|
|
6
|
-
# Unless required by applicable law or agreed to in writing, software distributed under
|
|
7
|
-
# the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
8
|
-
# OF ANY KIND, either express or implied. See the License for the specific language
|
|
9
|
-
# governing permissions and limitations under the License.
|
|
10
|
-
|
|
11
|
-
from aepp.som import Som
|
|
12
|
-
import unittest
|
|
13
|
-
from unittest.mock import patch, MagicMock
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
class SomTest(unittest.TestCase):
|
|
17
|
-
|
|
18
|
-
def test_som_instantiation_empty(self):
|
|
19
|
-
mysom = Som()
|
|
20
|
-
assert bool(mysom.get()) == False
|
|
21
|
-
|
|
22
|
-
def test_som_instantiation_notEmpty(self):
|
|
23
|
-
mysom = Som({'data':'key'})
|
|
24
|
-
assert bool(mysom.get()) == True
|
|
25
|
-
|
|
26
|
-
def test_som_assignments_simple(self):
|
|
27
|
-
mysom = Som()
|
|
28
|
-
mysom.assign('string','1')
|
|
29
|
-
assert type(mysom.get('string')) == str
|
|
30
|
-
assert mysom.get('string') == '1'
|
|
31
|
-
mysom.assign('integer',1)
|
|
32
|
-
assert mysom.get('integer') == 1
|
|
33
|
-
mysom.assign('mylist',[0])
|
|
34
|
-
assert type(mysom.get('mylist')) == list
|
|
35
|
-
mysom.assign('a.b','test')
|
|
36
|
-
assert mysom.get('a.b') == 'test'
|
|
37
|
-
mysom.assign('myset',set([1,2]))
|
|
38
|
-
assert type(mysom.get('myset')) == set
|
|
39
|
-
mysom.assign('mytuple',(1,2))
|
|
40
|
-
assert type(mysom.get('mytuple')) == tuple
|
|
41
|
-
mysom.assign('my.fallback',None,'fallback')
|
|
42
|
-
assert mysom.get('my.fallback') == 'fallback'
|
|
43
|
-
assert mysom.get('my.fallbacks',False) == False ## testing Falsy fallback
|
|
44
|
-
|
|
45
|
-
def test_som_assignments_list(self):
|
|
46
|
-
mysom = Som()
|
|
47
|
-
mysom.assign('mylist',[0])
|
|
48
|
-
mysom.assign('mylist',1)
|
|
49
|
-
assert type(mysom.get('mylist')) == list
|
|
50
|
-
assert len(mysom.get('mylist')) == 2
|
|
51
|
-
mysom.assign('mylist2',2,params={"type":list})
|
|
52
|
-
assert type(mysom.get('mylist2')) == list
|
|
53
|
-
mysom.assign('data.mylist.[0]',1)
|
|
54
|
-
assert type(mysom.get('data.mylist')) == list
|
|
55
|
-
assert len(mysom.get('data.mylist')) == 1
|
|
56
|
-
assert mysom.get('data.mylist.1') == True
|
|
57
|
-
mysom.assign('data.mylist.[1]',1)
|
|
58
|
-
assert len(mysom.get('data.mylist')) == 2
|
|
59
|
-
mysom.assign('data.mylist.[1]',3)
|
|
60
|
-
assert len(mysom.get('data.mylist')) == 2
|
|
61
|
-
assert mysom.get('data.mylist.1') == 3
|
|
62
|
-
mysom.assign('data.mylist',[1,2])
|
|
63
|
-
assert len(mysom.get('data.mylist')) == 3
|
|
64
|
-
assert type(mysom.get('data.mylist.2')) == list
|
|
65
|
-
mysom.assign('data.mylist',(1,2))
|
|
66
|
-
assert len(mysom.get('data.mylist')) == 4
|
|
67
|
-
assert type(mysom.get('data.mylist.3')) == tuple
|
|
68
|
-
mysom.assign('data.mylist',set([1,2]))
|
|
69
|
-
assert len(mysom.get('data.mylist')) == 5
|
|
70
|
-
assert type(mysom.get('data.mylist.4')) == set
|
|
71
|
-
|
|
72
|
-
def test_som_assignments_set(self):
|
|
73
|
-
mysom = Som()
|
|
74
|
-
mysom.assign('myset',set([0]))
|
|
75
|
-
mysom.assign('myset',1)
|
|
76
|
-
assert type(mysom.get('myset')) == set
|
|
77
|
-
assert len(mysom.get('myset')) == 2
|
|
78
|
-
mysom.assign('myset2',2,params={"type":set})
|
|
79
|
-
assert type(mysom.get('myset2')) == set
|
|
80
|
-
assert mysom.get('myset2.2') == True
|
|
81
|
-
mysom.assign('myset',[2,3])
|
|
82
|
-
assert type(mysom.get('myset')) == set
|
|
83
|
-
assert mysom.get('myset.2') == True
|
|
84
|
-
mysom.assign('myset',(3,4))
|
|
85
|
-
assert type(mysom.get('myset')) == set
|
|
86
|
-
assert mysom.get('myset.4') == True
|
|
87
|
-
mysom.assign('myset',set([4,5]))
|
|
88
|
-
assert type(mysom.get('myset')) == set
|
|
89
|
-
assert mysom.get('myset.5') == True
|
|
90
|
-
|
|
91
|
-
def test_som_assignments_tuple(self):
|
|
92
|
-
mysom = Som()
|
|
93
|
-
mysom.assign('mytuple',tuple([0]))
|
|
94
|
-
mysom.assign('mytuple',1)
|
|
95
|
-
assert type(mysom.get('mytuple')) == tuple
|
|
96
|
-
assert len(mysom.get('mytuple')) == 1
|
|
97
|
-
mysom.assign('mytuple2',2,params={"type":tuple})
|
|
98
|
-
assert type(mysom.get('mytuple2')) == tuple
|
|
99
|
-
assert mysom.get('mytuple2.2') == True
|
|
100
|
-
|
|
101
|
-
def test_som_complex_assignment_get(self):
|
|
102
|
-
mysom = Som()
|
|
103
|
-
mysom.assign('my.deep.value','foo')
|
|
104
|
-
assert mysom.get('my.deep.value') == 'foo'
|
|
105
|
-
assert mysom.get('my.deep.values','nothing') == 'nothing'
|
|
106
|
-
assert mysom.get('my.deep.vvalues') is None
|
|
107
|
-
mysom.assign('my.deep.list',1,params={"type":list})
|
|
108
|
-
assert type(mysom.get('my.deep.list')) == list
|
|
109
|
-
assert len(mysom.get('my.deep.list')) == 1
|
|
110
|
-
mysom.assign('my.deep.list',2)
|
|
111
|
-
assert len(mysom.get('my.deep.list')) == 2
|
|
112
|
-
mysom.assign('my.deep.list',3,params={"override":True})
|
|
113
|
-
assert type(mysom.get('my.deep.list')) == int
|
|
114
|
-
mysom.assign('my.deep.list',1,params={"type":list})
|
|
115
|
-
assert type(mysom.get('my.deep.list')) == list
|
|
116
|
-
mysom.assign('my.deep.list',2,params={"type":set})
|
|
117
|
-
assert type(mysom.get('my.deep.list')) == set
|
|
118
|
-
assert len(mysom.get('my.deep.list')) == 2
|
|
119
|
-
mysom.assign('my.deep.list',3,params={"type":tuple})
|
|
120
|
-
assert type(mysom.get('my.deep.list')) == tuple
|
|
121
|
-
assert len(mysom.get('my.deep.list')) == 3
|
|
122
|
-
mysom.assign('my.deep.list',4)
|
|
123
|
-
assert type(mysom.get('my.deep.list')) == tuple
|
|
124
|
-
assert mysom.get('my.deep.list.0') == 4
|
|
125
|
-
|
|
126
|
-
def test_som_merge(self):
|
|
127
|
-
mysom = Som({"data":{'path1':'value1','list1':['value1'],'set1':set(['value1']),'tuple1':tuple(['value1'])}})
|
|
128
|
-
assert mysom.get('data.path1') == 'value1'
|
|
129
|
-
data2 = {
|
|
130
|
-
'path1':'value2',
|
|
131
|
-
'path2':'value2',
|
|
132
|
-
'list1':['value2'],
|
|
133
|
-
'list2':['value2'],
|
|
134
|
-
'set1':set(['value2']),
|
|
135
|
-
'set2':set(['value2']),
|
|
136
|
-
'tuple1':tuple(['value2']),
|
|
137
|
-
'tuple2':tuple(['value2'])
|
|
138
|
-
}
|
|
139
|
-
mysom.merge('data',data2)
|
|
140
|
-
assert mysom.get('data.path1') == 'value2'
|
|
141
|
-
assert mysom.get('data.path2') == 'value2'
|
|
142
|
-
assert type(mysom.get('data.list1')) == list
|
|
143
|
-
assert len(mysom.get('data.list1')) == 2
|
|
144
|
-
assert len(mysom.get('data.list2')) == 1
|
|
145
|
-
assert type(mysom.get('data.set1')) == set
|
|
146
|
-
assert len(mysom.get('data.set1')) == 2
|
|
147
|
-
assert len(mysom.get('data.set2')) == 1
|
|
148
|
-
assert type(mysom.get('data.tuple1')) == tuple
|
|
149
|
-
assert len(mysom.get('data.tuple1')) == 2
|
|
150
|
-
assert len(mysom.get('data.tuple2')) == 1
|
|
151
|
-
mysom.merge('data.list1',[1])
|
|
152
|
-
mysom.merge('data.tuple1',tuple([1]))
|
|
153
|
-
mysom.merge('data.set1',set([1]))
|
|
154
|
-
assert len(mysom.get('data.list1')) == 3
|
|
155
|
-
assert len(mysom.get('data.tuple1')) == 3
|
|
156
|
-
assert len(mysom.get('data.set1')) == 3
|
|
157
|
-
|
|
158
|
-
def test_som_merge_to_list(self):
|
|
159
|
-
mysom = Som({"data":{'path1':'value1','set1':set(['value1']),'tuple1':tuple(['value1'])}})
|
|
160
|
-
assert mysom.get('data.path1') == 'value1'
|
|
161
|
-
data2 = {
|
|
162
|
-
'path1':['value2'],
|
|
163
|
-
'set1':['value2'],
|
|
164
|
-
'tuple1':['value2'],
|
|
165
|
-
}
|
|
166
|
-
mysom.merge('data',data2)
|
|
167
|
-
assert type(mysom.get('data.path1')) == list
|
|
168
|
-
assert len(mysom.get('data.path1')) == 2
|
|
169
|
-
assert type(mysom.get('data.set1')) == list
|
|
170
|
-
assert len(mysom.get('data.set1')) == 2
|
|
171
|
-
assert type(mysom.get('data.tuple1')) == list
|
|
172
|
-
assert len(mysom.get('data.tuple1')) == 2
|
|
173
|
-
|
|
174
|
-
def test_som_merge_to_set(self):
|
|
175
|
-
mysom = Som({"data":{'path1':'value1','list1':['value1'],'tuple1':tuple(['value1'])}})
|
|
176
|
-
assert mysom.get('data.path1') == 'value1'
|
|
177
|
-
data2 = {
|
|
178
|
-
'path1':set(['value2']),
|
|
179
|
-
'list1':set(['value2']),
|
|
180
|
-
'tuple1':set(['value2']),
|
|
181
|
-
}
|
|
182
|
-
mysom.merge('data',data2)
|
|
183
|
-
assert type(mysom.get('data.path1')) == set
|
|
184
|
-
assert len(mysom.get('data.path1')) == 2
|
|
185
|
-
assert type(mysom.get('data.list1')) == set
|
|
186
|
-
assert len(mysom.get('data.list1')) == 2
|
|
187
|
-
assert type(mysom.get('data.tuple1')) == set
|
|
188
|
-
assert len(mysom.get('data.tuple1')) == 2
|
|
189
|
-
|
|
190
|
-
def test_som_merge_to_tuple(self):
|
|
191
|
-
mysom = Som({"data":{'path1':'value1','list1':['value1'],'set1':set(['value1'])}})
|
|
192
|
-
assert mysom.get('data.path1') == 'value1'
|
|
193
|
-
data2 = {
|
|
194
|
-
'path1':tuple(['value2']),
|
|
195
|
-
'list1':tuple(['value2']),
|
|
196
|
-
'set1':tuple(['value2']),
|
|
197
|
-
}
|
|
198
|
-
mysom.merge('data',data2)
|
|
199
|
-
assert type(mysom.get('data.path1')) == tuple
|
|
200
|
-
assert len(mysom.get('data.path1')) == 2
|
|
201
|
-
assert type(mysom.get('data.list1')) == tuple
|
|
202
|
-
assert len(mysom.get('data.list1')) == 2
|
|
203
|
-
assert type(mysom.get('data.set1')) == tuple
|
|
204
|
-
assert len(mysom.get('data.set1')) == 2
|
|
205
|
-
|
|
206
|
-
def test_som_remove(self):
|
|
207
|
-
mysom = Som({"data":{'path1':'value1','list1':['value1','value2','value3'],'set1':set(['value1','value2','value3']),'tuple1':tuple(['value1','value2','value3'])}})
|
|
208
|
-
assert mysom.get('data.path1') == 'value1'
|
|
209
|
-
mysom.remove('data.path1')
|
|
210
|
-
assert mysom.get('data.path1') is None
|
|
211
|
-
mysom.remove('data.list1.value2')
|
|
212
|
-
assert len(mysom.get('data.list1')) == 2
|
|
213
|
-
mysom.remove('data.list1.[0]')
|
|
214
|
-
assert len(mysom.get('data.list1')) == 1
|
|
215
|
-
mysom.remove('data.list1')
|
|
216
|
-
assert mysom.get('data.list1') is None
|
|
217
|
-
mysom.remove('data.set1.value1')
|
|
218
|
-
assert len(mysom.get('data.set1')) == 2
|
|
219
|
-
mysom.remove('data.set1')
|
|
220
|
-
assert mysom.get('data.set1') is None
|
|
221
|
-
mysom.remove('data.tuple1')
|
|
222
|
-
assert mysom.get('data.tuple1') is None
|
|
223
|
-
|
|
224
|
-
def test_clear(self):
|
|
225
|
-
mysom = Som({"data":{'path1':'value1','list1':['value1','value2','value3'],'set1':set(['value1','value2','value3']),'tuple1':tuple(['value1','value2','value3'])}})
|
|
226
|
-
assert mysom.get('data.path1') == 'value1'
|
|
227
|
-
mysom.clear()
|
|
228
|
-
assert mysom.get('data.path1') is None
|
|
229
|
-
assert mysom.get('data.list1') is None
|
|
230
|
-
assert mysom.get('data.set1') is None
|
|
231
|
-
assert mysom.get('data.tuple1') is None
|
|
232
|
-
|
|
233
|
-
def test_dataframe(self):
|
|
234
|
-
data = {"data":
|
|
235
|
-
{
|
|
236
|
-
"myfield":"value",
|
|
237
|
-
"myList" : [1,2,3],
|
|
238
|
-
"arrayObject1":[
|
|
239
|
-
{
|
|
240
|
-
"field_name":"array_item1",
|
|
241
|
-
"arrayObject2":[
|
|
242
|
-
{
|
|
243
|
-
"field_name":"array_item_1_1"
|
|
244
|
-
},
|
|
245
|
-
{
|
|
246
|
-
"field_name":"array_item_1_2"
|
|
247
|
-
}
|
|
248
|
-
]
|
|
249
|
-
},
|
|
250
|
-
{
|
|
251
|
-
"field_name":"array_item2"
|
|
252
|
-
}
|
|
253
|
-
]
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
mySom = Som(data)
|
|
257
|
-
df_flatten = mySom.to_dataframe()
|
|
258
|
-
df_expands = mySom.to_dataframe(expand_arrays=True)
|
|
259
|
-
assert len(df_flatten) == 1
|
|
260
|
-
assert len(df_expands) == 3
|
|
261
|
-
list_cols_flatten = ['data.myfield',
|
|
262
|
-
'data.myList',
|
|
263
|
-
'data.arrayObject1.[0].field_name',
|
|
264
|
-
'data.arrayObject1.[0].arrayObject2.[0].field_name',
|
|
265
|
-
'data.arrayObject1.[0].arrayObject2.[1].field_name',
|
|
266
|
-
'data.arrayObject1.[1].field_name']
|
|
267
|
-
assert all(list_cols_flatten == df_flatten.columns)
|
|
268
|
-
list_cols_expands = ['data.myfield',
|
|
269
|
-
'data.myList',
|
|
270
|
-
'data.arrayObject1',
|
|
271
|
-
'data.arrayObject1.field_name',
|
|
272
|
-
'data.arrayObject1.arrayObject2',
|
|
273
|
-
'data.arrayObject1.arrayObject2.field_name']
|
|
274
|
-
assert all(list_cols_expands == df_expands.columns)
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
File without changes
|