test/plugin/test_out_mixpanel.rb in fluent-plugin-mixpanel-0.0.7 vs test/plugin/test_out_mixpanel.rb in fluent-plugin-mixpanel-0.0.8
- old
+ new
@@ -80,10 +80,25 @@
assert_equal time.to_i, @out[0]['properties']['time']
assert_equal "value1", @out[0]['properties']['key1']
assert_equal "value2", @out[0]['properties']['key2']
end
+ def test_write_setting_time_via_export
+ stub_mixpanel_import
+ d = create_driver(CONFIG + "use_import true\nevent_key event")
+ time = Time.new('2014-01-01T01:23:45+00:00')
+ d.emit(sample_record.merge!('time' => 1435707767), time)
+ d.run
+
+ assert_equal "test_token", @out[0]['properties']['token']
+ assert_equal "123", @out[0]['properties']['distinct_id']
+ assert_equal "event1", @out[0]['event']
+ assert_equal 1435707767, @out[0]['properties']['time']
+ assert_equal "value1", @out[0]['properties']['key1']
+ assert_equal "value2", @out[0]['properties']['key2']
+ end
+
def test_write_multi_request
stub_mixpanel_import
d = create_driver(IMPORT_CONFIG + "event_key event")
time1 = Time.new('2014-01-01T01:23:45+00:00')
time2 = Time.new('2014-01-02T01:23:45+00:00')
@@ -216,11 +231,9 @@
assert_equal "mixpanel.test.foo", @out[0]['event']
assert_equal time.to_i, @out[0]['properties']['time']
assert_equal "value1", @out[0]['properties']['key1']
assert_equal "value2", @out[0]['properties']['key2']
end
-
-
def test_write_ignore_special_event
stub_mixpanel
d = create_driver(CONFIG + "event_key event")
time = Time.new('2014-01-01T01:23:45+00:00')