targetVerifier target_verifier.TargetVerifier ) BeforeEach(func() { fakeReceptorClient = &fake_receptor.FakeClient{} fakeReceptorClientCreator = &fake_receptor_client_creator.FakeCreator{} fakeReceptorClientCreator.CreateReceptorClientReturns(fakeReceptorClient) targetVerifier = target_verifier.New(fakeReceptorClientCreator) }) It("returns up=true, auth=true if the receptor does not return an error", func() { up, auth, err := targetVerifier.VerifyTarget("http://receptor.mylattice.com") Expect(err).NotTo(HaveOccurred()) Expect(up).To(BeTrue()) Expect(auth).To(BeTrue()) Expect(fakeReceptorClientCreator.CreateReceptorClientCallCount()).To(Equal(1)) Expect(fakeReceptorClientCreator.CreateReceptorClientArgsForCall(0)).To(Equal("http://receptor.mylattice.com")) }) It("returns up=true, auth=false if the receptor returns an authorization error", func() { fakeReceptorClient.DesiredLRPsReturns([]receptor.DesiredLRPResponse{}, receptor.Error{ Type: receptor.Unauthorized, Message: "Go home. You're not welcome here.", }) up, auth, err := targetVerifier.VerifyTarget("http://receptor.mylattice.com") Expect(err).NotTo(HaveOccurred()) Expect(up).To(BeTrue()) Expect(auth).To(BeFalse()) })