forked from 2600hz/kazoo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modify kapi_delegate module to use kapi_definition module (2600hz#6329)
- Loading branch information
1 parent
2cb0289
commit 690f372
Showing
4 changed files
with
179 additions
and
58 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
26 changes: 26 additions & 0 deletions
26
applications/crossbar/priv/couchdb/schemas/kapi.delegate.job.json
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,26 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-04/schema#", | ||
"_id": "kapi.delegate.job", | ||
"description": "AMQP API for delegate.job", | ||
"properties": { | ||
"Delegate-Message": { | ||
"type": "string" | ||
}, | ||
"Event-Category": { | ||
"enum": [ | ||
"delegate" | ||
], | ||
"type": "string" | ||
}, | ||
"Event-Name": { | ||
"enum": [ | ||
"job" | ||
], | ||
"type": "string" | ||
} | ||
}, | ||
"required": [ | ||
"Delegate-Message" | ||
], | ||
"type": "object" | ||
} |
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
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,35 @@ | ||
%%%----------------------------------------------------------------------------- | ||
%%% @copyright (C) 2013-2020, 2600Hz | ||
%%% @doc | ||
%%% This Source Code Form is subject to the terms of the Mozilla Public | ||
%%% License, v. 2.0. If a copy of the MPL was not distributed with this | ||
%%% file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
%%% | ||
%%% @end | ||
%%%----------------------------------------------------------------------------- | ||
-module(kapi_delegate_tests). | ||
|
||
-include_lib("eunit/include/eunit.hrl"). | ||
|
||
build_binding_test_() -> | ||
Cat = <<"delegate">>, | ||
App = kz_binary:rand_hex(4), | ||
Key = kz_binary:rand_hex(4), | ||
|
||
[{"Must work with 'undefined' Key" | ||
,?_assertEqual(<<Cat/binary, ".", App/binary>> | ||
,kapi_delegate:build_binding(App, 'undefined') | ||
) | ||
} | ||
,{"Must work with binary Key" | ||
,?_assertEqual(<<Cat/binary, ".", App/binary, ".", Key/binary>> | ||
,kapi_delegate:build_binding(App, Key) | ||
) | ||
} | ||
,{"App must be a binary" | ||
,?_assertException('error' | ||
,'function_clause' | ||
,kapi_delegate:build_binding('undefined', Key) | ||
) | ||
} | ||
]. |