def test_interfaces(self):
     trail = Trail()
     event_constructor = Event(
         trail,
         222,
         555,
         [333, 444],
         ["test parameter", "other test parameter"]).set_timestamp(TIMESTAMP)
     event_plurals = Event(trail, 222).set_timestamp(TIMESTAMP)
     event_plurals.set_instance_id(555)
     event_plurals.add_static_params([333, 444])
     event_plurals.add_variable_params(["test parameter", "other test parameter"])
     event_singles = Event(trail, 222).set_timestamp(TIMESTAMP)
     event_singles.set_instance_id(555)
     event_singles.add_static_param(333).add_static_param(444)
     event_singles.add_variable_param("test parameter")\
         .add_variable_param("other test parameter")
     self.assertEqual(event_constructor.serialize(), event_plurals.serialize())
     self.assertEqual(event_constructor.serialize(), event_singles.serialize())
     self.assertEqual(event_constructor.serialize(), EVENT_STRING_ALL)
Exemplo n.º 2
0
 def test_interfaces(self):
     trail = Trail()
     event_constructor = Event(trail, 222, 555, [333, 444],
                               ["test parameter", "other test parameter"
                                ]).set_timestamp(TIMESTAMP)
     event_plurals = Event(trail, 222).set_timestamp(TIMESTAMP)
     event_plurals.set_instance_id(555)
     event_plurals.add_static_params([333, 444])
     event_plurals.add_variable_params(
         ["test parameter", "other test parameter"])
     event_singles = Event(trail, 222).set_timestamp(TIMESTAMP)
     event_singles.set_instance_id(555)
     event_singles.add_static_param(333).add_static_param(444)
     event_singles.add_variable_param("test parameter")\
         .add_variable_param("other test parameter")
     self.assertEqual(event_constructor.serialize(),
                      event_plurals.serialize())
     self.assertEqual(event_constructor.serialize(),
                      event_singles.serialize())
     self.assertEqual(event_constructor.serialize(), EVENT_STRING_ALL)
 def test_one_variable_param(self):
     event = Event(Trail(), 222).set_timestamp(TIMESTAMP)
     event.add_variable_param("test parameter")
     self.assertEqual(event.serialize(), EVENT_STRING_ONE_VAR)
Exemplo n.º 4
0
 def test_unknown_compression(self):
     event = Event(Trail(), 222).set_timestamp(TIMESTAMP)
     with self.assertRaises(ValueError):
         event.add_variable_param("test parameter",
                                  compress='bogus_compression')
Exemplo n.º 5
0
 def test_compressed_variable_param(self):
     event = Event(Trail(), 222).set_timestamp(TIMESTAMP)
     event.add_variable_param("test parameter", compress=COMPRESS_ZLIB)
     self.assertEqual(event.serialize(), EVENT_STRING_COMPRESSED_VAR)
Exemplo n.º 6
0
 def test_one_variable_param(self):
     event = Event(Trail(), 222).set_timestamp(TIMESTAMP)
     event.add_variable_param("test parameter")
     self.assertEqual(event.serialize(), EVENT_STRING_ONE_VAR)