def test_post(self):
    recv = self.client.post('/post', data='post data')

    self.assertIn('200 OK', recv.status)
    self.assertIn('Hello', str(recv.data))

    version, json = zmq_pull_once(host())

    self.assertTrue(json['har']['log']['entries'][0]['timings']['wait'] >= 10)
  def test_get(self):
    recv = self.client.get('/get?foo=bar', headers={'CONTENT_TYPE': 'text/plain', 'X-Custom': 'custom'})

    self.assertIn('200 OK', recv.status)
    self.assertIn('Hello', str(recv.data))

    version, json = zmq_pull_once(host())

    self.assertTrue(json['har']['log']['entries'][0]['timings']['wait'] >= 10)
  def test_get(self):
    client = Client(self.app)
    data, status, headers = client.open()
    data = (b'').join(data)

    self.assertIn('Hello', str(data))

    version, alf = zmq_pull_once(host())

    self.assertTrue(alf['har']['log']['entries'][0]['timings']['wait'] >= 10)
    def test_get(self):
        client = Client(self.app)
        data, status, headers = client.open()
        data = "".join(data)

        self.assertIn("Hello", data)

        version, alf = zmq_pull_once(host())

        self.assertEqual(version, "alf_1.0.0")

        self.assertEqual(alf["serviceToken"], "SERVICE-TOKEN")
        self.assertEqual(alf["har"]["log"]["creator"]["name"], "mashape-analytics-agent-python")
        self.assertEqual(alf["har"]["log"]["entries"][0]["request"]["method"], "GET")
        self.assertEqual(alf["har"]["log"]["entries"][0]["request"]["url"], "http://localhost/")
        self.assertEqual(alf["har"]["log"]["entries"][0]["response"]["status"], 200)
        self.assertEqual(alf["har"]["log"]["entries"][0]["response"]["statusText"], "OK CUSTOM")
        self.assertEqual(alf["har"]["log"]["entries"][0]["response"]["content"]["mimeType"], "text/plain")
        self.assertEqual(alf["har"]["log"]["entries"][0]["response"]["content"]["size"], 11)
        self.assertTrue(alf["har"]["log"]["entries"][0]["timings"]["wait"] >= 10)