@@ -18,6 +18,7 @@ package policy
1818
1919import (
2020 "context"
21+ "net/url"
2122
2223 "testing"
2324
6162 }
6263 ]
6364 }`
64- boolFalse = false
65+ documentURLEscaped = url .QueryEscape (document )
66+ boolFalse = false
6567
6668 errBoom = errors .New ("boom" )
6769
@@ -209,6 +211,39 @@ func TestObserve(t *testing.T) {
209211 },
210212 },
211213 },
214+ "SuccessfulURLEscapedPolicy" : {
215+ args : args {
216+ iam : & fake.MockPolicyClient {
217+ MockGetPolicy : func (ctx context.Context , input * awsiam.GetPolicyInput , opts []func (* awsiam.Options )) (* awsiam.GetPolicyOutput , error ) {
218+ return & awsiam.GetPolicyOutput {
219+ Policy : & awsiamtypes.Policy {},
220+ }, nil
221+ },
222+ MockGetPolicyVersion : func (ctx context.Context , input * awsiam.GetPolicyVersionInput , opts []func (* awsiam.Options )) (* awsiam.GetPolicyVersionOutput , error ) {
223+ return & awsiam.GetPolicyVersionOutput {
224+ PolicyVersion : & awsiamtypes.PolicyVersion {
225+ Document : & documentURLEscaped ,
226+ },
227+ }, nil
228+ },
229+ },
230+ cr : policy (withSpec (v1beta1.PolicyParameters {
231+ Document : document ,
232+ Name : name ,
233+ }), withExternalName (policyArn )),
234+ },
235+ want : want {
236+ cr : policy (withSpec (v1beta1.PolicyParameters {
237+ Document : document ,
238+ Name : name ,
239+ }), withExternalName (policyArn ),
240+ withConditions (xpv1 .Available ())),
241+ result : managed.ExternalObservation {
242+ ResourceExists : true ,
243+ ResourceUpToDate : true ,
244+ },
245+ },
246+ },
212247 "InValidInput" : {
213248 args : args {
214249 cr : unexpectedItem ,
0 commit comments