Exemplo n.º 1
0
		}
		routingApiRepo = &testapi.FakeRoutingApiRepository{}
	})

	runCommand := func(args ...string) bool {
		return testcmd.RunCliCommand("router-groups", args, requirementsFactory, updateCommandDependency, false)
	}

	Describe("login requirements", func() {
		It("fails if the user is not logged in", func() {
			requirementsFactory.LoginSuccess = false
			Expect(runCommand()).To(BeFalse())
		})

		It("fails when the routing API endpoint is not set", func() {
			requirementsFactory.RoutingAPIEndpointSuccess = false
			Expect(runCommand()).To(BeFalse())
		})

		It("should fail with usage when provided any arguments", func() {
			Expect(runCommand("notrequired-option")).To(BeFalse())
			Expect(ui.Outputs).To(ContainSubstrings(
				[]string{"Incorrect Usage", "No argument required"},
			))
		})
	})

	Context("when there are router groups", func() {
		BeforeEach(func() {
			routerGroups := models.RouterGroups{
				models.RouterGroup{