amazon-sp-cli 0.2.4__tar.gz → 0.2.5__tar.gz
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.
- {amazon_sp_cli-0.2.4/amazon_sp_cli.egg-info → amazon_sp_cli-0.2.5}/PKG-INFO +1 -1
- amazon_sp_cli-0.2.5/amazon_sp_cli/__init__.py +2 -0
- {amazon_sp_cli-0.2.4 → amazon_sp_cli-0.2.5}/amazon_sp_cli/models/a_plus.py +49 -16
- {amazon_sp_cli-0.2.4 → amazon_sp_cli-0.2.5/amazon_sp_cli.egg-info}/PKG-INFO +1 -1
- {amazon_sp_cli-0.2.4 → amazon_sp_cli-0.2.5}/tests/test_a_plus.py +28 -8
- amazon_sp_cli-0.2.4/amazon_sp_cli/__init__.py +0 -2
- {amazon_sp_cli-0.2.4 → amazon_sp_cli-0.2.5}/LICENSE +0 -0
- {amazon_sp_cli-0.2.4 → amazon_sp_cli-0.2.5}/MANIFEST.in +0 -0
- {amazon_sp_cli-0.2.4 → amazon_sp_cli-0.2.5}/README.md +0 -0
- {amazon_sp_cli-0.2.4 → amazon_sp_cli-0.2.5}/amazon_sp_cli/__main__.py +0 -0
- {amazon_sp_cli-0.2.4 → amazon_sp_cli-0.2.5}/amazon_sp_cli/auth.py +0 -0
- {amazon_sp_cli-0.2.4 → amazon_sp_cli-0.2.5}/amazon_sp_cli/cli.py +0 -0
- {amazon_sp_cli-0.2.4 → amazon_sp_cli-0.2.5}/amazon_sp_cli/client.py +0 -0
- {amazon_sp_cli-0.2.4 → amazon_sp_cli-0.2.5}/amazon_sp_cli/commands/__init__.py +0 -0
- {amazon_sp_cli-0.2.4 → amazon_sp_cli-0.2.5}/amazon_sp_cli/commands/a_plus.py +0 -0
- {amazon_sp_cli-0.2.4 → amazon_sp_cli-0.2.5}/amazon_sp_cli/commands/auth.py +0 -0
- {amazon_sp_cli-0.2.4 → amazon_sp_cli-0.2.5}/amazon_sp_cli/commands/pricing.py +0 -0
- {amazon_sp_cli-0.2.4 → amazon_sp_cli-0.2.5}/amazon_sp_cli/main.py +0 -0
- {amazon_sp_cli-0.2.4 → amazon_sp_cli-0.2.5}/amazon_sp_cli/models/__init__.py +0 -0
- {amazon_sp_cli-0.2.4 → amazon_sp_cli-0.2.5}/amazon_sp_cli.egg-info/SOURCES.txt +0 -0
- {amazon_sp_cli-0.2.4 → amazon_sp_cli-0.2.5}/amazon_sp_cli.egg-info/dependency_links.txt +0 -0
- {amazon_sp_cli-0.2.4 → amazon_sp_cli-0.2.5}/amazon_sp_cli.egg-info/entry_points.txt +0 -0
- {amazon_sp_cli-0.2.4 → amazon_sp_cli-0.2.5}/amazon_sp_cli.egg-info/requires.txt +0 -0
- {amazon_sp_cli-0.2.4 → amazon_sp_cli-0.2.5}/amazon_sp_cli.egg-info/top_level.txt +0 -0
- {amazon_sp_cli-0.2.4 → amazon_sp_cli-0.2.5}/pyproject.toml +0 -0
- {amazon_sp_cli-0.2.4 → amazon_sp_cli-0.2.5}/setup.cfg +0 -0
- {amazon_sp_cli-0.2.4 → amazon_sp_cli-0.2.5}/setup.py +0 -0
- {amazon_sp_cli-0.2.4 → amazon_sp_cli-0.2.5}/tests/__init__.py +0 -0
- {amazon_sp_cli-0.2.4 → amazon_sp_cli-0.2.5}/tests/test_auth.py +0 -0
- {amazon_sp_cli-0.2.4 → amazon_sp_cli-0.2.5}/tests/test_client.py +0 -0
- {amazon_sp_cli-0.2.4 → amazon_sp_cli-0.2.5}/tests/test_pricing.py +0 -0
|
@@ -153,19 +153,23 @@ class StandardTextModule:
|
|
|
153
153
|
class StandardImageTextOverlayModule:
|
|
154
154
|
"""Standard Image with Text Overlay module."""
|
|
155
155
|
|
|
156
|
-
def __init__(self, headline=None, image=None, body=None):
|
|
156
|
+
def __init__(self, headline=None, image=None, body=None, overlay_color_type="DARK"):
|
|
157
157
|
self.headline = headline
|
|
158
158
|
self.image = image
|
|
159
159
|
self.body = body
|
|
160
|
+
self.overlay_color_type = overlay_color_type
|
|
160
161
|
|
|
161
162
|
def to_dict(self) -> dict:
|
|
162
|
-
result = {}
|
|
163
|
+
result = {"overlayColorType": self.overlay_color_type}
|
|
164
|
+
block = {}
|
|
163
165
|
if self.headline:
|
|
164
|
-
|
|
166
|
+
block["headline"] = self.headline.to_dict()
|
|
165
167
|
if self.image:
|
|
166
|
-
|
|
168
|
+
block["image"] = self.image.to_dict()
|
|
167
169
|
if self.body:
|
|
168
|
-
|
|
170
|
+
block["body"] = self.body.to_dict()
|
|
171
|
+
if block:
|
|
172
|
+
result["block"] = block
|
|
169
173
|
return result
|
|
170
174
|
|
|
171
175
|
|
|
@@ -186,7 +190,7 @@ class ContentModule:
|
|
|
186
190
|
"""A+ Content module wrapper."""
|
|
187
191
|
|
|
188
192
|
MODULE_TYPES = {
|
|
189
|
-
"STANDARD_IMAGE_TEXT": "
|
|
193
|
+
"STANDARD_IMAGE_TEXT": "standardImageTextOverlay",
|
|
190
194
|
"STANDARD_SINGLE_IMAGE": "standardSingleImage",
|
|
191
195
|
"STANDARD_MULTIPLE_IMAGE_TEXT": "standardMultipleImageText",
|
|
192
196
|
"STANDARD_FOUR_IMAGE_TEXT": "standardFourImageText",
|
|
@@ -222,8 +226,8 @@ class ContentModule:
|
|
|
222
226
|
result = {"contentModuleType": self.module_type}
|
|
223
227
|
field_name = self.MODULE_TYPES.get(self.module_type)
|
|
224
228
|
|
|
225
|
-
if field_name == "
|
|
226
|
-
result["
|
|
229
|
+
if field_name == "standardImageTextOverlay" and self.standard_image_text_overlay:
|
|
230
|
+
result["standardImageTextOverlay"] = self.standard_image_text_overlay.to_dict()
|
|
227
231
|
elif field_name == "standardSingleImage" and self.standard_single_image:
|
|
228
232
|
result["standardSingleImage"] = self.standard_single_image.to_dict()
|
|
229
233
|
elif field_name == "standardMultipleImageText" and self.standard_multiple_image_text:
|
|
@@ -234,8 +238,6 @@ class ContentModule:
|
|
|
234
238
|
result["standardComparisonTable"] = self.standard_comparison_table.to_dict()
|
|
235
239
|
elif field_name == "standardText" and self.standard_text:
|
|
236
240
|
result["standardText"] = self.standard_text.to_dict()
|
|
237
|
-
elif field_name == "standardImageTextOverlay" and self.standard_image_text_overlay:
|
|
238
|
-
result["standardImageTextOverlay"] = self.standard_image_text_overlay.to_dict()
|
|
239
241
|
elif field_name == "standardCompanyLogo" and self.standard_company_logo:
|
|
240
242
|
result["standardCompanyLogo"] = self.standard_company_logo.to_dict()
|
|
241
243
|
|
|
@@ -320,19 +322,38 @@ def build_module_from_json(data: dict) -> ContentModule:
|
|
|
320
322
|
module_type = data.get("contentModuleType") or data.get("moduleType", "STANDARD_TEXT")
|
|
321
323
|
|
|
322
324
|
if module_type == "STANDARD_IMAGE_TEXT":
|
|
325
|
+
body = None
|
|
326
|
+
if data.get("body"):
|
|
327
|
+
body = ParagraphComponent(text_list=[TextComponent(data["body"])])
|
|
323
328
|
return ContentModule(
|
|
324
329
|
module_type=module_type,
|
|
325
|
-
|
|
330
|
+
standard_image_text_overlay=StandardImageTextOverlayModule(
|
|
326
331
|
headline=TextComponent(data["headline"]) if data.get("headline") else None,
|
|
327
|
-
body=
|
|
328
|
-
image=
|
|
332
|
+
body=body,
|
|
333
|
+
image=(
|
|
334
|
+
ImageComponent(
|
|
335
|
+
data["imageId"],
|
|
336
|
+
alt_text=data.get("altText"),
|
|
337
|
+
image_crop_specification=data.get("imageCropSpecification"),
|
|
338
|
+
)
|
|
339
|
+
if data.get("imageId")
|
|
340
|
+
else None
|
|
341
|
+
),
|
|
329
342
|
),
|
|
330
343
|
)
|
|
331
344
|
elif module_type == "STANDARD_SINGLE_IMAGE":
|
|
332
345
|
return ContentModule(
|
|
333
346
|
module_type=module_type,
|
|
334
347
|
standard_single_image=StandardSingleImageModule(
|
|
335
|
-
image=
|
|
348
|
+
image=(
|
|
349
|
+
ImageComponent(
|
|
350
|
+
data["imageId"],
|
|
351
|
+
alt_text=data.get("altText"),
|
|
352
|
+
image_crop_specification=data.get("imageCropSpecification"),
|
|
353
|
+
)
|
|
354
|
+
if data.get("imageId")
|
|
355
|
+
else None
|
|
356
|
+
),
|
|
336
357
|
image_caption=TextComponent(data["caption"]) if data.get("caption") else None,
|
|
337
358
|
),
|
|
338
359
|
)
|
|
@@ -372,12 +393,24 @@ def build_module_from_json(data: dict) -> ContentModule:
|
|
|
372
393
|
),
|
|
373
394
|
)
|
|
374
395
|
elif module_type == "STANDARD_IMAGE_TEXT_OVERLAY":
|
|
396
|
+
body = None
|
|
397
|
+
if data.get("body"):
|
|
398
|
+
body = ParagraphComponent(text_list=[TextComponent(data["body"])])
|
|
375
399
|
return ContentModule(
|
|
376
400
|
module_type=module_type,
|
|
377
401
|
standard_image_text_overlay=StandardImageTextOverlayModule(
|
|
378
402
|
headline=TextComponent(data["headline"]) if data.get("headline") else None,
|
|
379
|
-
body=
|
|
380
|
-
image=
|
|
403
|
+
body=body,
|
|
404
|
+
image=(
|
|
405
|
+
ImageComponent(
|
|
406
|
+
data["imageId"],
|
|
407
|
+
alt_text=data.get("altText"),
|
|
408
|
+
image_crop_specification=data.get("imageCropSpecification"),
|
|
409
|
+
)
|
|
410
|
+
if data.get("imageId")
|
|
411
|
+
else None
|
|
412
|
+
),
|
|
413
|
+
overlay_color_type=data.get("overlayColorType", "DARK"),
|
|
381
414
|
),
|
|
382
415
|
)
|
|
383
416
|
elif module_type == "STANDARD_COMPANY_LOGO":
|
|
@@ -75,7 +75,7 @@ class TestDataModels:
|
|
|
75
75
|
assert "has no content" in doc.validate()[0]
|
|
76
76
|
|
|
77
77
|
def test_module_validate_empty_content(self):
|
|
78
|
-
mod = ContentModule("
|
|
78
|
+
mod = ContentModule("STANDARD_TEXT")
|
|
79
79
|
issues = mod.validate(0)
|
|
80
80
|
assert len(issues) == 1
|
|
81
81
|
assert "has no content" in issues[0]
|
|
@@ -146,8 +146,25 @@ class TestBuildFromJson:
|
|
|
146
146
|
mod = build_module_from_json(data)
|
|
147
147
|
assert mod.module_type == "STANDARD_IMAGE_TEXT"
|
|
148
148
|
result = mod.to_dict()
|
|
149
|
-
assert result["
|
|
150
|
-
assert result["
|
|
149
|
+
assert result["standardImageTextOverlay"]["overlayColorType"] == "DARK"
|
|
150
|
+
assert result["standardImageTextOverlay"]["block"]["headline"]["value"] == "H"
|
|
151
|
+
assert result["standardImageTextOverlay"]["block"]["body"]["textList"][0]["value"] == "B"
|
|
152
|
+
assert result["standardImageTextOverlay"]["block"]["image"]["uploadDestinationId"] == "img-1"
|
|
153
|
+
|
|
154
|
+
def test_build_module_image_text_overlay(self):
|
|
155
|
+
data = {
|
|
156
|
+
"moduleType": "STANDARD_IMAGE_TEXT_OVERLAY",
|
|
157
|
+
"headline": "H",
|
|
158
|
+
"body": "B",
|
|
159
|
+
"imageId": "img-1",
|
|
160
|
+
"overlayColorType": "LIGHT",
|
|
161
|
+
}
|
|
162
|
+
mod = build_module_from_json(data)
|
|
163
|
+
assert mod.module_type == "STANDARD_IMAGE_TEXT_OVERLAY"
|
|
164
|
+
result = mod.to_dict()
|
|
165
|
+
assert result["standardImageTextOverlay"]["overlayColorType"] == "LIGHT"
|
|
166
|
+
assert result["standardImageTextOverlay"]["block"]["headline"]["value"] == "H"
|
|
167
|
+
assert result["standardImageTextOverlay"]["block"]["body"]["textList"][0]["value"] == "B"
|
|
151
168
|
|
|
152
169
|
def test_build_module_comparison_table(self):
|
|
153
170
|
data = {
|
|
@@ -225,11 +242,14 @@ class TestBuildFromJson:
|
|
|
225
242
|
assert logo_module["companyLogo"]["imageCropSpecification"]["size"]["width"]["value"] == 600
|
|
226
243
|
|
|
227
244
|
for i in range(1, 5):
|
|
228
|
-
mod = modules[i]["
|
|
229
|
-
assert "
|
|
230
|
-
assert "
|
|
231
|
-
assert "
|
|
232
|
-
assert
|
|
245
|
+
mod = modules[i]["standardImageTextOverlay"]
|
|
246
|
+
assert mod["overlayColorType"] == "DARK"
|
|
247
|
+
assert "block" in mod
|
|
248
|
+
assert "headline" in mod["block"]
|
|
249
|
+
assert "body" in mod["block"]
|
|
250
|
+
assert "textList" in mod["block"]["body"]
|
|
251
|
+
assert "image" in mod["block"]
|
|
252
|
+
assert mod["block"]["image"]["uploadDestinationId"].startswith("aplus-media/sc/")
|
|
233
253
|
|
|
234
254
|
|
|
235
255
|
class TestAPlusCLI:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|