Skip to content
Snippets Groups Projects
Commit 196f0e8d authored by Andrew Crump's avatar Andrew Crump
Browse files

WIP finish up space-role story


[#159969560]

Co-authored-by: default avatarTom Viehman <tviehman@pivotal.io>
parent 012bb0d8
No related branches found
No related tags found
No related merge requests found
......@@ -166,6 +166,7 @@ jobs:
- capi-ci/cf-deployment-operations/seed-credhub-asg.yml
- cli/ci/infrastructure/operations/default-app-memory.yml
- cli/ci/infrastructure/operations/add-oidc-provider.yml
- cli/ci/infrastructure/operations/give-cf-admin-clients-read-scope.yml
- task: upload-to-gcs
file: capi-ci/ci/gcs/upload-to-gcs.yml
input_mapping:
......
......@@ -100,18 +100,48 @@ var _ = Describe("set-space-role command", func() {
spaceName = ReadOnlySpace
})
When("the target user is a client-credentials user", func() {
FWhen("the --client flag is passed", func() {
var clientID string
BeforeEach(func() {
clientID, _ = helpers.SkipIfClientCredentialsNotSet()
})
It("sets the space role for the client", func() {
session := helpers.CF("set-space-role", clientID, orgName, spaceName, "SpaceAuditor", "--client")
Eventually(session).Should(Say("Assigning role RoleSpaceAuditor to user %s in org %s / space %s as admin...", clientID, orgName, spaceName))
Eventually(session).Should(Say("OK"))
Eventually(session).Should(Exit(0))
When("the client exists", func() {
It("sets the org role for the client", func() {
session := helpers.CF("set-space-role", clientID, orgName, spaceName, "SpaceAuditor", "--client")
Eventually(session).Should(Say("Assigning role RoleSpaceAuditor to user %s in org %s / space %s as admin...", clientID, orgName, spaceName))
Eventually(session).Should(Say("OK"))
Eventually(session).Should(Exit(0))
})
When("the active user lacks permissions to look up clients", func() {
BeforeEach(func() {
helpers.SwitchToSpaceRole(orgName, spaceName, "SpaceManager")
})
It("prints an appropriate error and exits 1", func() {
session := helpers.CF("set-space-role", clientID, orgName, spaceName, "SpaceAuditor", "--client")
Eventually(session).Should(Say("FAILED"))
Eventually(session).Should(Say("Server error, status code: 403: Access is denied. You do not have privileges to execute this command."))
Eventually(session).Should(Exit(1))
})
})
})
When("the targeted client does not exist", func() {
var badClientID string
BeforeEach(func() {
badClientID = "nonexistent-client"
})
It("fails with an appropriate error message", func() {
session := helpers.CF("set-space-role", badClientID, orgName, spaceName, "SpaceAuditor", "--client")
Eventually(session).Should(Say("FAILED"))
Eventually(session).Should(Say("Client nonexistent-client not found"))
Eventually(session).Should(Exit(1))
})
})
})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment