From fe35325ab8761d9f465945ce7584823c597560f1 Mon Sep 17 00:00:00 2001
From: Abhishek Lekshmanan <abhishek@suse.com>
Date: Fri, 13 Oct 2017 16:31:38 +0200
Subject: [PATCH] test_s3: modify make_json_policy to support conditionals

Signed-off-by: Abhishek Lekshmanan <abhishek@suse.com>
---
 s3tests/functional/test_s3.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/s3tests/functional/test_s3.py b/s3tests/functional/test_s3.py
index b839b4e..da147cb 100644
--- a/s3tests/functional/test_s3.py
+++ b/s3tests/functional/test_s3.py
@@ -8754,8 +8754,11 @@ def make_json_policy(action, resource, principal={"AWS": "*"}, conditions=None):
         }]
     }
 
-    if conditions is not None:
-        policy["Statement"]["Condition"] = conditions
+    # Currently lets only support adding a common conditional to every
+    # statement in this function
+    for statement in policy["Statement"]:
+        if conditions is not None:
+            statement["Condition"] = conditions
 
     return json.dumps(policy)