Example #1
0
 def test_flush_timer(self):
     e1 = Emitter("d3rkrsqld9gmqf.cloudfront.net",
                  method="post",
                  buffer_size=10)
     t = Tracker(e1,
                 namespace="cloudfront",
                 encode_base64=False,
                 app_id="AF003")
     e1.set_flush_timer(3)
     t.track_page_view(
         "http://snowplowanalytics.com/blog/2016/09/22/introducing-sauna-a-decisioning-and-response-platform/"
     )
     t.track_page_view(
         "http://snowplowanalytics.com/blog/2016/03/17/2015-2016-winternship-wrapup/"
     )
     t.track_page_view(
         "http://snowplowanalytics.com/blog/2016/07/31/iglu-r5-scinde-dawk-released/"
     )
     self.assertEqual(len(e1.buffer), 3)
     time.sleep(4)
     self.assertEqual(len(e1.buffer), 0)
     t.track_page_view(
         "http://snowplowanalytics.com/blog/2016/03/03/guide-to-debugging-bad-data-in-elasticsearch-kibana/"
     )
     t.track_page_view(
         "http://snowplowanalytics.com/blog/2016/03/17/2015-2016-winternship-wrapup/"
     )
     self.assertEqual(len(e1.buffer), 2)
 def test_flush_timer(self):
     e1 = Emitter("d3rkrsqld9gmqf.cloudfront.net", method="post", buffer_size=10)
     t = Tracker(e1, namespace="cloudfront", encode_base64=False, app_id="AF003")
     e1.set_flush_timer(3)
     t.track_page_view("http://snowplowanalytics.com/blog/2016/09/22/introducing-sauna-a-decisioning-and-response-platform/")
     t.track_page_view("http://snowplowanalytics.com/blog/2016/03/17/2015-2016-winternship-wrapup/")
     t.track_page_view("http://snowplowanalytics.com/blog/2016/07/31/iglu-r5-scinde-dawk-released/")
     self.assertEqual(len(e1.buffer), 3)
     time.sleep(4)
     self.assertEqual(len(e1.buffer), 0)
     t.track_page_view("http://snowplowanalytics.com/blog/2016/03/03/guide-to-debugging-bad-data-in-elasticsearch-kibana/")
     t.track_page_view("http://snowplowanalytics.com/blog/2016/03/17/2015-2016-winternship-wrapup/")
     self.assertEqual(len(e1.buffer), 2)
 def test_flush_timer(self):
     e1 = Emitter("d3rkrsqld9gmqf.cloudfront.net",
                  method="post",
                  buffer_size=10)
     t = Tracker(e1,
                 namespace="cloudfront",
                 encode_base64=False,
                 app_id="AF003")
     e1.set_flush_timer(3)
     t.track_struct_event("Test", "A")
     t.track_struct_event("Test", "B")
     t.track_struct_event("Test", "C")
     self.assertEqual(len(e1.buffer), 3)
     time.sleep(4)
     self.assertEqual(len(e1.buffer), 0)
     t.track_struct_event("Test", "A")
     t.track_struct_event("Test", "B")
     self.assertEqual(len(e1.buffer), 2)