test/embulk/input/test_mixpanel.rb in embulk-input-mixpanel-0.2.1 vs test/embulk/input/test_mixpanel.rb in embulk-input-mixpanel-0.3.0

- old
+ new

@@ -8,11 +8,11 @@ API_KEY = "api_key".freeze API_SECRET = "api_secret".freeze FROM_DATE = "2015-02-22".freeze TO_DATE = "2015-03-02".freeze DAYS = 8 - DATES = Date.parse(FROM_DATE)..(Date.parse(FROM_DATE) + DAYS) + DATES = Date.parse(FROM_DATE)..(Date.parse(FROM_DATE) + DAYS - 1) TIMEZONE = "Asia/Tokyo".freeze DURATIONS = [ {from_date: FROM_DATE, to_date: "2015-02-28"}, # It has 7 days between 2015-02-22 and 2015-02-28 {from_date: "2015-03-01", to_date: TO_DATE}, @@ -163,11 +163,11 @@ Mixpanel.transaction(transaction_config(from_date)) end def test_negative_days assert_raise(Embulk::ConfigError) do - Mixpanel.transaction(transaction_config((Date.today - 1).to_s).merge(days: -1)) + Mixpanel.transaction(transaction_config((Date.today - 1).to_s).merge(fetch_days: -1)) end end private @@ -211,11 +211,11 @@ end def transaction_config _config = config.merge( from_date: dates.first.to_s, - days: dates.to_a.size, + fetch_days: dates.to_a.size, timezone: TIMEZONE, columns: schema ) DataSource[*_config.to_a.flatten(1)] end @@ -277,21 +277,21 @@ private def transaction_task(days) from_date = Date.parse(FROM_DATE) task.merge( - dates: (from_date..(from_date + days)).map {|date| date.to_s}, + dates: (from_date..(from_date + days - 1)).map {|date| date.to_s}, api_key: API_KEY, api_secret: API_SECRET, timezone: TIMEZONE, schema: schema ) end def transaction_config(days) _config = config.merge( - days: days, + fetch_days: days, columns: schema, timezone: TIMEZONE, ) DataSource[*_config.to_a.flatten(1)] end @@ -447,10 +447,10 @@ { type: "mixpanel", api_key: API_KEY, api_secret: API_SECRET, from_date: FROM_DATE, - days: DAYS, + fetch_days: DAYS, } end def embulk_config DataSource[*config.to_a.flatten(1)]