Skip to content

Commit

Permalink
remove cosmoctl user update cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
jlandowner committed Aug 3, 2023
1 parent 1eee651 commit 5f47970
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 527 deletions.
373 changes: 0 additions & 373 deletions internal/cmd/__snapshots__/user_test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -76,24 +76,6 @@ Global Flags:

"""
['cosmoctl [user] [all] ❌ fail with invalid arg: kubeconfig user update user1 --kubeconfig XXXX 1']
SnapShot = """
Error: invalid options: stat XXXX: no such file or directory
Usage:
cosmoctl user update USER_NAME --role ROLE --name NAME [flags]

Flags:
-h, --help help for update
--name string set this flag only if you want to change user display name (default \"-\")
--role strings set this flag only if you want to change user roles. you need pass all roles including roles not changed

Global Flags:
--context string kube-context (default: current context)
--kubeconfig string kubeconfig file path (default: $HOME/.kube/config)
-v, --verbose int log level. -1:DISABLED, 0:INFO, 1:DEBUG, 2:ALL (default -1)

"""
['cosmoctl [user] [create] ✅ success in normal context: user create user-create --addon user-template1 --cluster-addon user-clustertemplate1 1']
SnapShot = """
\u001B[32mSuccessfully created user user-create
Expand Down Expand Up @@ -1017,358 +999,3 @@ SnapShot = """
['cosmoctl [user] [reset-password] ❌ fail with invalid args: user reset-password user1 --password 2']
SnapShot = 'success'

['cosmoctl [user] [update] ✅ success in normal context: user update upd-norole --name 1']
SnapShot = """
\u001B[32mSuccessfully updated user upd-norole
\u001B[0m"""
['cosmoctl [user] [update] ✅ success in normal context: user update upd-norole --name 2']
SnapShot = 'success'

['cosmoctl [user] [update] ✅ success in normal context: user update upd-norole --name 3']
SnapShot = """
{
\"Name\": \"upd-norole\",
\"Namespace\": \"\",
\"Spec\": {
\"displayName\": \"ロールなし\",
\"authType\": \"password-secret\"
},
\"Status\": {
\"namespace\": {}
}
}
"""
['cosmoctl [user] [update] ✅ success in normal context: user update upd-norole --name 4']
SnapShot = """
{
\"Name\": \"upd-norole\",
\"Namespace\": \"\",
\"Spec\": {
\"authType\": \"password-secret\"
},
\"Status\": {
\"namespace\": {}
}
}
"""
['cosmoctl [user] [update] ✅ success in normal context: user update upd-norole --name name1 --role team-dev 1']
SnapShot = """
\u001B[32mSuccessfully updated user upd-norole
\u001B[0m"""
['cosmoctl [user] [update] ✅ success in normal context: user update upd-norole --name name1 --role team-dev 2']
SnapShot = 'success'

['cosmoctl [user] [update] ✅ success in normal context: user update upd-norole --name name1 --role team-dev 3']
SnapShot = """
{
\"Name\": \"upd-norole\",
\"Namespace\": \"\",
\"Spec\": {
\"displayName\": \"ロールなし\",
\"authType\": \"password-secret\"
},
\"Status\": {
\"namespace\": {}
}
}
"""
['cosmoctl [user] [update] ✅ success in normal context: user update upd-norole --name name1 --role team-dev 4']
SnapShot = """
{
\"Name\": \"upd-norole\",
\"Namespace\": \"\",
\"Spec\": {
\"displayName\": \"name1\",
\"roles\": [
{
\"name\": \"team-dev\"
}
],
\"authType\": \"password-secret\"
},
\"Status\": {
\"namespace\": {}
}
}
"""
['cosmoctl [user] [update] ✅ success in normal context: user update upd-norole --name namechanged 1']
SnapShot = """
\u001B[32mSuccessfully updated user upd-norole
\u001B[0m"""
['cosmoctl [user] [update] ✅ success in normal context: user update upd-norole --name namechanged 2']
SnapShot = 'success'

['cosmoctl [user] [update] ✅ success in normal context: user update upd-norole --name namechanged 3']
SnapShot = """
{
\"Name\": \"upd-norole\",
\"Namespace\": \"\",
\"Spec\": {
\"displayName\": \"ロールなし\",
\"authType\": \"password-secret\"
},
\"Status\": {
\"namespace\": {}
}
}
"""
['cosmoctl [user] [update] ✅ success in normal context: user update upd-norole --name namechanged 4']
SnapShot = """
{
\"Name\": \"upd-norole\",
\"Namespace\": \"\",
\"Spec\": {
\"displayName\": \"namechanged\",
\"authType\": \"password-secret\"
},
\"Status\": {
\"namespace\": {}
}
}
"""
['cosmoctl [user] [update] ✅ success in normal context: user update upd-norole --role cosmo-admin 1']
SnapShot = """
\u001B[32mSuccessfully updated user upd-norole
\u001B[0m"""
['cosmoctl [user] [update] ✅ success in normal context: user update upd-norole --role cosmo-admin 2']
SnapShot = 'success'

['cosmoctl [user] [update] ✅ success in normal context: user update upd-norole --role cosmo-admin 3']
SnapShot = """
{
\"Name\": \"upd-norole\",
\"Namespace\": \"\",
\"Spec\": {
\"displayName\": \"ロールなし\",
\"authType\": \"password-secret\"
},
\"Status\": {
\"namespace\": {}
}
}
"""
['cosmoctl [user] [update] ✅ success in normal context: user update upd-norole --role cosmo-admin 4']
SnapShot = """
{
\"Name\": \"upd-norole\",
\"Namespace\": \"\",
\"Spec\": {
\"displayName\": \"ロールなし\",
\"roles\": [
{
\"name\": \"cosmo-admin\"
}
],
\"authType\": \"password-secret\"
},
\"Status\": {
\"namespace\": {}
}
}
"""
['cosmoctl [user] [update] ✅ success in normal context: user update upd-norole --role team-developer,otherteam-developer 1']
SnapShot = """
\u001B[32mSuccessfully updated user upd-norole
\u001B[0m"""
['cosmoctl [user] [update] ✅ success in normal context: user update upd-norole --role team-developer,otherteam-developer 2']
SnapShot = 'success'

['cosmoctl [user] [update] ✅ success in normal context: user update upd-norole --role team-developer,otherteam-developer 3']
SnapShot = """
{
\"Name\": \"upd-norole\",
\"Namespace\": \"\",
\"Spec\": {
\"displayName\": \"ロールなし\",
\"authType\": \"password-secret\"
},
\"Status\": {
\"namespace\": {}
}
}
"""
['cosmoctl [user] [update] ✅ success in normal context: user update upd-norole --role team-developer,otherteam-developer 4']
SnapShot = """
{
\"Name\": \"upd-norole\",
\"Namespace\": \"\",
\"Spec\": {
\"displayName\": \"ロールなし\",
\"roles\": [
{
\"name\": \"team-developer\"
},
{
\"name\": \"otherteam-developer\"
}
],
\"authType\": \"password-secret\"
},
\"Status\": {
\"namespace\": {}
}
}
"""
['cosmoctl [user] [update] ✅ success in normal context: user update upd-priv --role 1']
SnapShot = """
\u001B[32mSuccessfully updated user upd-priv
\u001B[0m"""
['cosmoctl [user] [update] ✅ success in normal context: user update upd-priv --role 2']
SnapShot = 'success'

['cosmoctl [user] [update] ✅ success in normal context: user update upd-priv --role 3']
SnapShot = """
{
\"Name\": \"upd-priv\",
\"Namespace\": \"\",
\"Spec\": {
\"displayName\": \"特権\",
\"roles\": [
{
\"name\": \"cosmo-admin\"
}
],
\"authType\": \"password-secret\"
},
\"Status\": {
\"namespace\": {}
}
}
"""
['cosmoctl [user] [update] ✅ success in normal context: user update upd-priv --role 4']
SnapShot = """
{
\"Name\": \"upd-priv\",
\"Namespace\": \"\",
\"Spec\": {
\"displayName\": \"特権\",
\"authType\": \"password-secret\"
},
\"Status\": {
\"namespace\": {}
}
}
"""
['cosmoctl [user] [update] ❌ fail with an unexpected error at update: user update upd-norole --name namechanged 1']
SnapShot = """
Error: failed to update user: mock update error
Usage:
cosmoctl user update USER_NAME --role ROLE --name NAME [flags]

Flags:
-h, --help help for update
--name string set this flag only if you want to change user display name (default \"-\")
--role strings set this flag only if you want to change user roles. you need pass all roles including roles not changed

Global Flags:
--context string kube-context (default: current context)
--kubeconfig string kubeconfig file path (default: $HOME/.kube/config)
-v, --verbose int log level. -1:DISABLED, 0:INFO, 1:DEBUG, 2:ALL (default -1)

"""

['cosmoctl [user] [update] ❌ fail with an unexpected error at update: user update upd-norole --name namechanged 2']
SnapShot = 'failed to update user: mock update error'

['cosmoctl [user] [update] ❌ fail with invalid args: user update 1']
SnapShot = """
Error: validation error: invalid args
Usage:
cosmoctl user update USER_NAME --role ROLE --name NAME [flags]

Flags:
-h, --help help for update
--name string set this flag only if you want to change user display name (default \"-\")
--role strings set this flag only if you want to change user roles. you need pass all roles including roles not changed

Global Flags:
--context string kube-context (default: current context)
--kubeconfig string kubeconfig file path (default: $HOME/.kube/config)
-v, --verbose int log level. -1:DISABLED, 0:INFO, 1:DEBUG, 2:ALL (default -1)

"""

['cosmoctl [user] [update] ❌ fail with invalid args: user update 2']
SnapShot = 'validation error: invalid args'

['cosmoctl [user] [update] ❌ fail with invalid args: user update notfound --name namechanged --role cosmo-admin 1']
SnapShot = """
Error: user is not found: users.cosmo-workspace.github.io \"notfound\" not found
Usage:
cosmoctl user update USER_NAME --role ROLE --name NAME [flags]

Flags:
-h, --help help for update
--name string set this flag only if you want to change user display name (default \"-\")
--role strings set this flag only if you want to change user roles. you need pass all roles including roles not changed

Global Flags:
--context string kube-context (default: current context)
--kubeconfig string kubeconfig file path (default: $HOME/.kube/config)
-v, --verbose int log level. -1:DISABLED, 0:INFO, 1:DEBUG, 2:ALL (default -1)

"""

['cosmoctl [user] [update] ❌ fail with invalid args: user update notfound --name namechanged --role cosmo-admin 2']
SnapShot = 'user is not found: users.cosmo-workspace.github.io "notfound" not found'

['cosmoctl [user] [update] ❌ fail with invalid args: user update upd-priv --role cosmo-admin 1']
SnapShot = """
Error: no change
Usage:
cosmoctl user update USER_NAME --role ROLE --name NAME [flags]

Flags:
-h, --help help for update
--name string set this flag only if you want to change user display name (default \"-\")
--role strings set this flag only if you want to change user roles. you need pass all roles including roles not changed

Global Flags:
--context string kube-context (default: current context)
--kubeconfig string kubeconfig file path (default: $HOME/.kube/config)
-v, --verbose int log level. -1:DISABLED, 0:INFO, 1:DEBUG, 2:ALL (default -1)

"""

['cosmoctl [user] [update] ❌ fail with invalid args: user update upd-priv --role cosmo-admin 2']
SnapShot = 'no change'

['cosmoctl [user] [update] ❌ fail with invalid args: user update upd-priv 1']
SnapShot = """
Error: no change
Usage:
cosmoctl user update USER_NAME --role ROLE --name NAME [flags]

Flags:
-h, --help help for update
--name string set this flag only if you want to change user display name (default \"-\")
--role strings set this flag only if you want to change user roles. you need pass all roles including roles not changed

Global Flags:
--context string kube-context (default: current context)
--kubeconfig string kubeconfig file path (default: $HOME/.kube/config)
-v, --verbose int log level. -1:DISABLED, 0:INFO, 1:DEBUG, 2:ALL (default -1)

"""

['cosmoctl [user] [update] ❌ fail with invalid args: user update upd-priv 2']
SnapShot = 'no change'
4 changes: 0 additions & 4 deletions internal/cmd/user/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ Get Users. This command is similar to "kubectl get namespace"
Aliases: []string{"del"},
Short: "Delete user",
}, o))
userCmd.AddCommand(updateCmd(&cobra.Command{
Use: "update USER_NAME --role ROLE --name NAME",
Short: "Update user",
}, o))

cmd.AddCommand(userCmd)
}
Loading

0 comments on commit 5f47970

Please sign in to comment.