Repository navigation
Conversation
| } | ||
|
|
||
| func TestBuildRequest(t *testing.T) { | ||
| keyring.MockInit() |
There was a problem hiding this comment.
Same as below, use the mock client implementation from the SDK instead
There was a problem hiding this comment.
With the keyring mock I don't know, it seems that is the way to go actually...
There is no interface and no mock for the auth, if I want to test auth.GetAuthEmail() branch
Are there any examples for alternative mocking of this path?
So far, I mimic the existing tests
0f0f70c to
a2c52a4
Compare
rubenhoenle
left a comment
There was a problem hiding this comment.
Please test your changes on your own before the next round, none of the examples was working for me.
| Example: examples.Build( | ||
| examples.NewExample( | ||
| `Get the details of the configured STACKIT folder`, | ||
| "$ stackit folder describe"), |
There was a problem hiding this comment.
| "$ stackit folder describe"), | |
| "$ stackit alpha folder describe"), |
| Args: args.SingleOptionalArg(containerIdArg, utils.ValidateUUID), | ||
| Example: examples.Build( | ||
| examples.NewExample( | ||
| `Get the details of the configured STACKIT folder`, |
| } | ||
|
|
||
| if containerId == "" { | ||
| containerId = globalFlags.ProjectId |
There was a problem hiding this comment.
Resourcemanager Project != Resourcemanager Folder 😉
| "$ stackit folder describe"), | ||
| examples.NewExample( | ||
| `Get the details of a STACKIT folder by explicitly providing the container ID`, | ||
| "$ stackit folder describe xxx"), |
There was a problem hiding this comment.
| "$ stackit folder describe xxx"), | |
| "$ stackit alpha folder describe xxx"), |
| "$ stackit folder describe xxx"), | ||
| examples.NewExample( | ||
| `Get the details of the configured STACKIT folder, including details of the parent resources`, | ||
| "$ stackit folder describe --include-parents"), |
There was a problem hiding this comment.
| "$ stackit folder describe --include-parents"), | |
| "$ stackit alpha folder describe --include-parents"), |
| "$ stackit folder list --project-id-like xxx,yyy,zzz"), | ||
| examples.NewExample( | ||
| `List all STACKIT folders that a certain user is a member of`, | ||
| "$ stackit folder list --member example@email.com"), |
There was a problem hiding this comment.
| "$ stackit folder list --member example@email.com"), | |
| "$ stackit alpha folder list --member example@email.com"), |
| _ paginate.Response[resourcemanager.ListFoldersResponseItemsInner] = listFoldersAdapterResponse{} | ||
| ) | ||
|
|
||
| // listFoldersAdapter maps the token-based paginate API onto the |
There was a problem hiding this comment.
Since this adapter implementation isn't directly tied to your CLI subcommand implementation, please move this here: https://github.com/stackitcloud/stackit-cli/tree/65a1e7327739fd4d03584c7af3307c06ec162c5b/internal/pkg/services/resourcemanager/utils
There was a problem hiding this comment.
Just create some new file in the utils package and place it there
| Args: args.NoArgs, | ||
| Example: examples.Build( | ||
| examples.NewExample( | ||
| `List all STACKIT folders that are children of the configured project`, |
There was a problem hiding this comment.
From my understanding a folder can't be a child of a project. It's the other way around.
| `List all STACKIT folders that are children of a specific parent`, | ||
| "$ stackit folder list --parent-id xxx"), | ||
| examples.NewExample( | ||
| `List all STACKIT folders that match the given project IDs, located under the same parent resource`, |
There was a problem hiding this comment.
How would a folder match a project id?
| // listFoldersAdapter maps the token-based paginate API onto the | ||
| // offset/limit-based ListFolders endpoint. The page token is the | ||
| // decimal offset of the next page. | ||
| type listFoldersAdapter struct { |
There was a problem hiding this comment.
| type listFoldersAdapter struct { | |
| type ListFoldersPaginationAdapter struct { |

Description
Partially onboard
foldercommand as for internal purposes only folder information retrieval is required.relates to #1736
Checklist
make fmtmake generate-docs(will be checked by CI)make test(will be checked by CI)make lint(will be checked by CI)