test/embulk/input/test_mixpanel.rb in embulk-input-mixpanel-0.5.14 vs test/embulk/input/test_mixpanel.rb in embulk-input-mixpanel-0.5.15
- old
+ new
@@ -7,11 +7,10 @@
module Embulk
module Input
class MixpanelTest < Test::Unit::TestCase
include OverrideAssertRaise
- 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 - 1)
@@ -29,11 +28,10 @@
stub(Embulk::Input::MixpanelApi::Client).mixpanel_available? { true }
end
def setup_client
params = {
- api_key: API_KEY,
event: nil,
where: nil,
bucket: nil,
}
@@ -70,11 +68,10 @@
end
def test_from_date_old_date
config = {
type: "mixpanel",
- api_key: API_KEY,
api_secret: API_SECRET,
from_date: FROM_DATE,
}
stub_export_all
@@ -85,11 +82,10 @@
end
def test_from_date_future
config = {
type: "mixpanel",
- api_key: API_KEY,
api_secret: API_SECRET,
timezone: TIMEZONE,
from_date: (today + 1).to_s
}
@@ -101,11 +97,10 @@
def test_from_date_yesterday
from_date = (today - 1).to_s
config = {
type: "mixpanel",
- api_key: API_KEY,
api_secret: API_SECRET,
from_date: from_date,
}
stub_export_all
@@ -115,11 +110,10 @@
end
def test_no_from_date
config = {
type: "mixpanel",
- api_key: API_KEY,
api_secret: API_SECRET,
timezone: TIMEZONE
}
stub_export_all
@@ -139,11 +133,10 @@
def test_mixpanel_is_down
stub(Embulk::Input::MixpanelApi::Client).mixpanel_available? { false }
config = {
type: "mixpanel",
- api_key: API_KEY,
api_secret: API_SECRET,
}
assert_raise(Embulk::DataError) do
Mixpanel.guess(embulk_config(config))
@@ -298,11 +291,10 @@
private
def transaction_task(timezone)
task.merge(
dates: DATES.map {|date| date.to_s},
- api_key: API_KEY,
api_secret: API_SECRET,
incremental: true,
incremental_column: nil,
timezone: timezone,
schema: schema
@@ -364,11 +356,10 @@
def transaction_task(days)
from_date = Date.parse(FROM_DATE)
task.merge(
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
@@ -432,11 +423,10 @@
end
def transaction_task
task.merge(
dates: DATES.map {|date| date.to_s},
- api_key: API_KEY,
api_secret: API_SECRET,
timezone: TIMEZONE,
schema: schema
)
end
@@ -449,11 +439,10 @@
end
def test_export_params
config_params = [
:type, "mixpanel",
- :api_key, API_KEY,
:api_secret, API_SECRET,
:from_date, FROM_DATE,
:to_date, TO_DATE,
:event, ["ViewHoge", "ViewFuga"],
:where, 'properties["$os"] == "Windows"',
@@ -461,11 +450,10 @@
]
config = DataSource[*config_params]
expected = {
- api_key: API_KEY,
event: "[\"ViewHoge\",\"ViewFuga\"]",
where: 'properties["$os"] == "Windows"',
bucket: "987",
}
actual = Mixpanel.export_params(config)
@@ -539,11 +527,10 @@
stub(@httpclient.test_loopback_http_response).shift { "HTTP/1.1 #{code}\r\n\r\n" }
end
def task
{
- api_key: API_KEY,
api_secret: API_SECRET,
export_endpoint: "https://data.mixpanel.com/api/2.0/export/",
timezone: TIMEZONE,
schema: schema,
dates: DATES.to_a.map(&:to_s),
@@ -844,11 +831,10 @@
]
end
def task
{
- api_key: API_KEY,
api_secret: API_SECRET,
export_endpoint: "https://data.mixpanel.com/api/2.0/export/",
timezone: TIMEZONE,
incremental: true,
incremental_column: nil,
@@ -889,10 +875,9 @@
end
def config
{
type: "mixpanel",
- api_key: API_KEY,
api_secret: API_SECRET,
from_date: FROM_DATE,
fetch_days: DAYS,
fetch_unknown_columns: false,
fetch_custom_properties: false,