Пример #1
0
			Expect(apiErr).NotTo(HaveOccurred())
		})

		It("finds a route by host and domain", func() {
			ts, handler = testnet.NewServer([]testnet.TestRequest{
				testapi.NewCloudControllerTestRequest(testnet.TestRequest{
					Method:   "GET",
					Path:     "/v2/routes?q=host%3Amy-cool-app%3Bdomain_guid%3Amy-domain-guid",
					Response: findRouteByHostResponse,
				}),
			})
			configRepo.SetApiEndpoint(ts.URL)

			domain := models.DomainFields{}
			domain.Guid = "my-domain-guid"
			domainRepo.FindByNameDomain = domain

			route, apiErr := repo.FindByHostAndDomain("my-cool-app", "my-domain.com")

			Expect(apiErr).NotTo(HaveOccurred())
			Expect(handler).To(testnet.HaveAllRequestsCalled())
			Expect(domainRepo.FindByNameName).To(Equal("my-domain.com"))
			Expect(route.Host).To(Equal("my-cool-app"))
			Expect(route.Guid).To(Equal("my-route-guid"))
			Expect(route.Domain.Guid).To(Equal(domain.Guid))
		})

		It("returns 'not found' response when there is no route w/ the given domain and host", func() {
			ts, handler = testnet.NewServer([]testnet.TestRequest{
				testapi.NewCloudControllerTestRequest(testnet.TestRequest{
					Method:   "GET",