Skip to content

Commit

Permalink
added test for TestGetTenantWithTextOutput - part of neo4j#87
Browse files Browse the repository at this point in the history
  • Loading branch information
KazChe committed Dec 8, 2024
1 parent 5261912 commit 05f4742
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions neo4j-cli/aura/internal/subcommands/tenant/get_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,36 @@ func TestGetTenantWithTableOutput(t *testing.T) {
instance configurations are not visible with table or text output - please use a different output setting using --output if you would like to view these
`)
}

func TestGetTenantWithTextOutput(t *testing.T) {
helper := testutils.NewAuraTestHelper(t)
defer helper.Close()
tenantId := "6981ace7-efe8-4f5c-b7c5-267b5162ce91"

getMockHandler := helper.NewRequestHandlerMock(fmt.Sprintf("/v1/tenants/%s", tenantId), http.StatusOK, `{
"data": {
"id": "6981ace7-efe8-4f5c-b7c5-267b5162ce91",
"name": "Production",
"instance_configurations": []
}
}`)
metricsIntegrationMockHandler := helper.NewRequestHandlerMock(fmt.Sprintf("/v1/tenants/%s/metrics-integration", tenantId), http.StatusBadRequest, `{
"errors": [
{
"message": "This tenant has no instances eligible for metrics integration",
"reason": "tenant-incapable-of-action"
}
]
}`)

helper.ExecuteCommand(fmt.Sprintf("tenant get %s --output text", tenantId))

getMockHandler.AssertCalledTimes(1)
getMockHandler.AssertCalledWithMethod(http.MethodGet)
metricsIntegrationMockHandler.AssertCalledTimes(1)
metricsIntegrationMockHandler.AssertCalledWithMethod(http.MethodGet)

helper.AssertOut(`6981ace7-efe8-4f5c-b7c5-267b5162ce91 Production
instance configurations are not visible with table or text output - please use a different output setting using --output if you would like to view these
`)
}

0 comments on commit 05f4742

Please sign in to comment.