File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed
internal/namespaces/iam/v1alpha1 Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change 88 "github.com/scaleway/scaleway-cli/v2/core"
99 "github.com/scaleway/scaleway-cli/v2/internal/namespaces/account/v3"
1010 iam "github.com/scaleway/scaleway-cli/v2/internal/namespaces/iam/v1alpha1"
11+ "github.com/scaleway/scaleway-cli/v2/internal/testhelpers"
1112)
1213
1314func Test_createRule (t * testing.T ) {
@@ -49,7 +50,7 @@ func Test_deleteRule(t *testing.T) {
4950 core .ExecStoreBeforeCmd ("Policy" , "scw iam policy get {{ .Policy.ID }}" ),
5051 func (ctx * core.BeforeFuncCtx ) error {
5152 // Get first Rule ID
52- policy := ctx . Meta [ "Policy" ].( * iam.PolicyGetInterceptorResponse )
53+ policy := testhelpers . MapValue [ * iam.PolicyGetInterceptorResponse ]( t , ctx . Meta , "Policy" )
5354 if len (policy .Rules ) != 2 {
5455 return errors .New ("expected two rules in policy" )
5556 }
Original file line number Diff line number Diff line change 77
88 "github.com/scaleway/scaleway-cli/v2/core"
99 iam "github.com/scaleway/scaleway-cli/v2/internal/namespaces/iam/v1alpha1"
10+ "github.com/scaleway/scaleway-cli/v2/internal/testhelpers"
1011 iamsdk "github.com/scaleway/scaleway-sdk-go/api/iam/v1alpha1"
1112)
1213
@@ -52,8 +53,10 @@ func Test_SSHKeyCreateCommand(t *testing.T) {
5253 ),
5354 AfterFunc : func (ctx * core.AfterFuncCtx ) error {
5455 api := iamsdk .NewAPI (ctx .Client )
56+ key := testhelpers .Value [* iamsdk.SSHKey ](t , ctx .CmdResult )
57+
5558 return api .DeleteSSHKey (& iamsdk.DeleteSSHKeyRequest {
56- SSHKeyID : ctx . CmdResult .( * iamsdk. SSHKey ) .ID ,
59+ SSHKeyID : key .ID ,
5760 })
5861 },
5962 }))
You can’t perform that action at this time.
0 commit comments