예제 #1
0
// newStreamService returns a new StreamService.
func newStreamService(client *http.Client, sling *sling.Sling) *StreamService {
	sling.Set("User-Agent", userAgent)
	return &StreamService{
		client: client,
		public: sling.New().Base(publicStream).Path("statuses/"),
		user:   sling.New().Base(userStream),
		site:   sling.New().Base(siteStream),
	}
}
예제 #2
0
		bodyBytes, err := ioutil.ReadAll(resp.Body)
		Expect(err).NotTo(HaveOccurred())

		Expect(bodyBytes).To(ContainSubstring("<html>"))
	})

	It("should compute steady-state stats on /steady_state", func() {
		requestData := models.SteadyStateRequest{
			NumHosts:            1000,
			NumApps:             10000,
			MeanInstancesPerApp: 2,
		}
		var responseData models.SteadyStateResponse
		var apiError models.APIError
		resp, err := apiClient.New().Get("/steady_state").QueryStruct(requestData).Receive(&responseData, &apiError)
		Expect(err).NotTo(HaveOccurred())

		Expect(resp.StatusCode).To(Equal(200))
		By("checking the CORS response")
		Expect(resp.Header.Get("Access-Control-Allow-Origin")).To(Equal("*"))

		By("checking the original request is included with the response")
		Expect(responseData.Request).To(Equal(requestData))

		By("checking the mean instances per host")
		Expect(responseData.MeanInstancesPerHost).To(Equal(20.0))

		By("checking the mean instances per host")
		Expect(responseData.Apps).To(HaveLen(10000))
	})
예제 #3
0
// newDirectMessageService returns a new StatusService.
func newDirectMessageService(sling *sling.Sling) *DirectMessageService {
	return &DirectMessageService{
		baseSling: sling.New(),
		sling:     sling.Path("direct_messages/"),
	}
}