cloud-radar 0.13.3a15__py3-none-any.whl → 0.14.0a0__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.
@@ -455,7 +455,18 @@ def get_att(template: "Template", values: Any) -> str:
455
455
  if resource_name not in template.template["Resources"]:
456
456
  raise KeyError(f"Fn::GetAtt - Resource {resource_name} not found in template.")
457
457
 
458
- return f"{resource_name}.{att_name}"
458
+ # Get the resource definition
459
+ resource = template.template["Resources"][resource_name]
460
+
461
+ # Check if there is a value in the resource Metadata for this attribute.
462
+ # If the attribute requested is in the metadata, return it.
463
+ # Otherwise use the string value of "{resource_name}.{att_name}"
464
+
465
+ metadata = resource.get("Metadata", {})
466
+ cloud_radar_metadata = metadata.get("Cloud-Radar", {})
467
+ attribute_values = cloud_radar_metadata.get("attribute-values", {})
468
+
469
+ return attribute_values.get(att_name, f"{resource_name}.{att_name}")
459
470
 
460
471
 
461
472
  def get_azs(_t: "Template", region: Any) -> List[str]:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cloud-radar
3
- Version: 0.13.3a15
3
+ Version: 0.14.0a0
4
4
  Summary: Run functional tests on cloudformation stacks.
5
5
  Home-page: https://github.com/DontShaveTheYak/cloud-radar
6
6
  License: Apache-2.0
@@ -242,6 +242,24 @@ dynamic_references = {
242
242
  template = Template(template_content, dynamic_references=dynamic_references)
243
243
  ```
244
244
 
245
+ There are cases where the default behaviour of our `GetAtt` implementation may not be sufficient and you need a more accurate returned value. When unit testing there are no real AWS resources created, and cloud-radar does not attempt to realistically generate attribute values - a string is always returned. This works good enough most of the time, but there are some cases where if you are attempting to apply intrinsic functions against the attribute value it needs to be more correct. When this occurs, you can add Metadata to the template to provide test values to use.
246
+
247
+ ```
248
+ Resources:
249
+ MediaPackageV2Channel:
250
+ Type: AWS::MediaPackageV2::Channel
251
+ Metadata:
252
+ Cloud-Radar:
253
+ attribute-values:
254
+ # Default behaviour of a string is not good enough here, the attribute value is expected to be a List.
255
+ IngestEndpointUrls:
256
+ - http://one.example.com
257
+ - http://two.example.com
258
+ Properties:
259
+ ChannelGroupName: dev_video_1
260
+ ChannelName: !Sub ${AWS::StackName}-MediaPackageChannel
261
+ ```
262
+
245
263
  A real unit testing example using Pytest can be seen [here](./tests/test_cf/test_examples/test_unit.py)
246
264
 
247
265
  </details>
@@ -10,9 +10,9 @@ cloud_radar/cf/unit/_parameter.py,sha256=AdPIqc2ggSW1VR0USF30zjphX3z1HHbGKQt8n-K
10
10
  cloud_radar/cf/unit/_resource.py,sha256=dWaR-5s6ea5mIu6Dhf1hY31Wd4WLHbHsbyxnu2Tz6QI,8512
11
11
  cloud_radar/cf/unit/_stack.py,sha256=_S0L9O7Lw-QAJDKubClp2b6UYtYfyzg272_7WQkUdo8,5785
12
12
  cloud_radar/cf/unit/_template.py,sha256=u1r1RkUPI0t8SGolWEjb3doavFwUQRaE0wOKCi_ijiI,32242
13
- cloud_radar/cf/unit/functions.py,sha256=XtYiEG3PZT-JjQwRls-59XKHYdw-hWH9QaOZcb9zd_Y,28719
13
+ cloud_radar/cf/unit/functions.py,sha256=iWBhc9JmyObusAAZ2iAXf7dXof36mdqoHOLR4UzuC58,29234
14
14
  cloud_radar/cf/unit/test__template.py,sha256=jVPMJTn6Q0sSZ8BjRGyutuR9-NjdHdwDTVsd2kvjQbs,1491
15
- cloud_radar-0.13.3a15.dist-info/LICENSE.txt,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
16
- cloud_radar-0.13.3a15.dist-info/METADATA,sha256=r76DfN5V78klesBK1QbLJv61JBJ0BtGiy7Hq__1FrUU,15745
17
- cloud_radar-0.13.3a15.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
18
- cloud_radar-0.13.3a15.dist-info/RECORD,,
15
+ cloud_radar-0.14.0a0.dist-info/LICENSE.txt,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
16
+ cloud_radar-0.14.0a0.dist-info/METADATA,sha256=IzYVAkdE83nPx0M3_3yxW4e7wAyhLwctVZmrkc2xxVg,16791
17
+ cloud_radar-0.14.0a0.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
18
+ cloud_radar-0.14.0a0.dist-info/RECORD,,