aboutsummaryrefslogtreecommitdiff
path: root/test/exdatadog/client_test.exs
diff options
context:
space:
mode:
authorkballou <kballou@devnulllabs.io>2016-12-27 10:02:42 -0700
committerkballou <kballou@devnulllabs.io>2016-12-27 10:40:28 -0700
commit6e36a9c3fb482cc993a3fa6511c51cc19b59d5a2 (patch)
tree2b70dbdb2ca4ff29927b61a2c0b845945de3b848 /test/exdatadog/client_test.exs
parentb79f51aac09b6a612725e1fae5af283c4025aa34 (diff)
downloadexdatadog-6e36a9c3fb482cc993a3fa6511c51cc19b59d5a2.tar.gz
exdatadog-6e36a9c3fb482cc993a3fa6511c51cc19b59d5a2.tar.xz
Add base datadog client
This adds a base HTTPoison Datadog Client library.
Diffstat (limited to 'test/exdatadog/client_test.exs')
-rw-r--r--test/exdatadog/client_test.exs39
1 files changed, 39 insertions, 0 deletions
diff --git a/test/exdatadog/client_test.exs b/test/exdatadog/client_test.exs
new file mode 100644
index 0000000..dc63c1b
--- /dev/null
+++ b/test/exdatadog/client_test.exs
@@ -0,0 +1,39 @@
+defmodule Exdatadog.Client.Test do
+ @moduledoc """
+ Provides Tests for the Exdatadog.Client module
+ """
+ use ExUnit.Case, async: false
+
+ @endpoint "https://app.datadoghq.com/"
+
+ alias Exdatadog.Client
+
+ test "can create new client" do
+ expected = %Client{endpoint: @endpoint, auth: %{api_key: "1234",
+ app_key: "abcd"}}
+ assert Client.new() == expected
+ end
+
+ test "can create new client with api auth" do
+ actual = Client.new(%{api_key: "1234"})
+ assert actual == %Client{endpoint: @endpoint, auth: %{api_key: "1234"}}
+ end
+
+ test "can create new client with api and app auth" do
+ actual = Client.new(%{api_key: "1234", app_key: "abcd"})
+ assert actual == %Client{endpoint: @endpoint, auth: %{api_key: "1234",
+ app_key: "abcd"}}
+ end
+
+ test "can create new client with auth and custom endpoint" do
+ actual = Client.new(%{api_key: "1234"}, "https://test.datadoghq.com/")
+ assert actual == %Client{endpoint: "https://test.datadoghq.com/",
+ auth: %{api_key: "1234"}}
+ end
+
+ test "trailing / appended to endpoint without" do
+ actual = Client.new(nil, "https://test.datadoghq.com")
+ assert actual == %Client{endpoint: "https://test.datadoghq.com/", auth: nil}
+ end
+
+end