Пример #1
0
		It("passes requirements when provided two args", func() {
			runCommand("my-org", "my-quota")
			Expect(testcmd.CommandDidPassRequirements).To(BeTrue())
			Expect(requirementsFactory.OrganizationName).To(Equal("my-org"))
		})

		It("assigns a quota to an org", func() {
			org := models.Organization{}
			org.Name = "my-org"
			org.Guid = "my-org-guid"

			quota := models.QuotaFields{Name: "my-quota", Guid: "my-quota-guid"}

			quotaRepo.FindByNameReturns.Quota = quota
			requirementsFactory.Organization = org

			runCommand("my-org", "my-quota")

			testassert.SliceContains(ui.Outputs, testassert.Lines{
				{"Setting quota", "my-quota", "my-org", "my-user"},
				{"OK"},
			})

			Expect(quotaRepo.FindByNameCalledWith.Name).To(Equal("my-quota"))
			Expect(quotaRepo.AssignQuotaToOrgCalledWith.OrgGuid).To(Equal("my-org-guid"))
			Expect(quotaRepo.AssignQuotaToOrgCalledWith.QuotaGuid).To(Equal("my-quota-guid"))
		})
	})
})
Пример #2
0
		Expect(ui.FailedWithUsage).To(BeTrue())
	})

	It("fails requirements when not logged in", func() {
		callRenameOrg([]string{"my-org", "my-new-org"}, reqFactory, orgRepo)
		Expect(testcmd.CommandDidPassRequirements).To(BeFalse())
	})

	Context("when logged in and given an org to rename", func() {
		var ui *testterm.FakeUI

		BeforeEach(func() {
			org := models.Organization{}
			org.Name = "my-org"
			org.Guid = "my-org-guid"
			reqFactory.Organization = org
			reqFactory.LoginSuccess = true
			ui = callRenameOrg([]string{"my-org", "my-new-org"}, reqFactory, orgRepo)
		})

		It("pass requirements", func() {
			Expect(testcmd.CommandDidPassRequirements).To(BeTrue())
		})

		It("renames an organization", func() {
			Expect(reqFactory.OrganizationName).To(Equal("my-org"))
			testassert.SliceContains(ui.Outputs, testassert.Lines{
				{"Renaming org", "my-org", "my-new-org", "my-user"},
				{"OK"},
			})