Skip to content

Commit

Permalink
Add Missing Methods for Execution details
Browse files Browse the repository at this point in the history
  • Loading branch information
sccalabr committed Oct 10, 2023
1 parent 2f0d79a commit 2fd5f79
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lib/novu/execution_details.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
defmodule Novu.ExecutionDetails do
@moduledoc """
Provide access to the Novu Execution Details API
"""

alias Novu.Http

@doc """
Retrieves execution details
[API Documentation](https://docs.novu.co/api-reference/execution-details/get-execution-details/)
"""
@spec get-execution-details :: Http.response()

Check failure on line 13 in lib/novu/execution_details.ex

View workflow job for this annotation

GitHub Actions / Doctor

** (CompileError) lib/novu/execution_details.ex:13: type get/0 undefined (no such type in Novu.ExecutionDetails)

Check failure on line 13 in lib/novu/execution_details.ex

View workflow job for this annotation

GitHub Actions / Dialyzer

** (CompileError) lib/novu/execution_details.ex:13: type get/0 undefined (no such type in Novu.ExecutionDetails)

Check failure on line 13 in lib/novu/execution_details.ex

View workflow job for this annotation

GitHub Actions / Test (Elixir 1.12 OTP 24)

** (CompileError) lib/novu/execution_details.ex:13: type get/0 undefined (no such type in Novu.ExecutionDetails)

Check failure on line 13 in lib/novu/execution_details.ex

View workflow job for this annotation

GitHub Actions / Test (Elixir 1.13 OTP 25)

** (CompileError) lib/novu/execution_details.ex:13: type get/0 undefined (no such type in Novu.ExecutionDetails)

Check failure on line 13 in lib/novu/execution_details.ex

View workflow job for this annotation

GitHub Actions / Test (Elixir 1.14 OTP 25)

** (CompileError) lib/novu/execution_details.ex:13: type get/0 undefined (no such type in Novu.ExecutionDetails)
def get_execution_details do
Http.get("/v1/execution-details")
end
end
37 changes: 37 additions & 0 deletions test/novu/execution_details_test.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
defmodule Novu.ExecutionDetailsTest do
use ExUnit.Case

import Novu.ApiTestHelpers

alias Novu.ExecutionDetails

@test_api_key "test-api-key"

setup do
bypass = Bypass.open()

current_domain = Application.get_env(:novu, :domain)

Application.put_env(:novu, :domain, "http://localhost:#{bypass.port}")
Application.put_env(:novu, :api_key, @test_api_key)

on_exit(fn ->
Application.put_env(:novu, :domain, current_domain)
end)

{:ok, bypass: bypass}
end

describe "get-execution-details/0" do
test "creates a GET to /v1/execution-details", %{bypass: bypass} do
notification_group_name = "Test"

Bypass.expect(bypass, "GET", "/v1/execution-details", fn conn ->
assert %{"name" => ^get_execution_details} = read_json_body(conn)
novu_response(conn, 201, %{data: []})
end)

assert {:ok, _body} = ExecutionDetails.get_execution_details()
end
end
end

0 comments on commit 2fd5f79

Please sign in to comment.