-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Missing Methods for Execution details
- Loading branch information
Showing
2 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
def get_execution_details do | ||
Http.get("/v1/execution-details") | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/1" 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 |