-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
23b81f9
commit 2c0378d
Showing
4 changed files
with
120 additions
and
114 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
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
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,104 @@ | ||
package plivo | ||
|
||
import ( | ||
"errors" | ||
"testing" | ||
) | ||
|
||
func TestCallService_CreateMaskingSession(t *testing.T) { | ||
expectResponse("createMaskingSessionResponse.json", 200) | ||
|
||
if _, err := client.MaskingSession.CreateMaskingSession(CreateMaskingSessionParams{}); err != nil { | ||
panic(err) | ||
} | ||
|
||
cl := client.httpClient | ||
client.httpClient = nil | ||
_, err := client.MaskingSession.CreateMaskingSession(CreateMaskingSessionParams{}) | ||
if err == nil { | ||
client.httpClient = cl | ||
panic(errors.New("error expected")) | ||
} | ||
client.httpClient = cl | ||
|
||
assertRequest(t, "POST", "Masking/Session") | ||
} | ||
|
||
func TestCallService_DeleteMaskingSession(t *testing.T) { | ||
expectResponse("deleteMaskingSessionResponse.json", 204) | ||
SessionUuid := "15e4256c-be01-475c-9a69-95cf65bbed71" | ||
|
||
if _, err := client.MaskingSession.DeleteMaskingSession(SessionUuid); err != nil { | ||
panic(err) | ||
} | ||
|
||
cl := client.httpClient | ||
client.httpClient = nil | ||
_, err := client.MaskingSession.DeleteMaskingSession(SessionUuid) | ||
if err == nil { | ||
client.httpClient = cl | ||
panic(errors.New("error expected")) | ||
} | ||
client.httpClient = cl | ||
|
||
assertRequest(t, "DELETE", "Masking/Session/%s", SessionUuid) | ||
} | ||
|
||
func TestCallService_GetMaskingSession(t *testing.T) { | ||
expectResponse("getMaskingSessionResponse.json", 200) | ||
SessionUuid := "15e4256c-be01-475c-9a69-95cf65bbed71" | ||
|
||
if _, err := client.MaskingSession.GetMaskingSession(SessionUuid); err != nil { | ||
panic(err) | ||
} | ||
|
||
cl := client.httpClient | ||
client.httpClient = nil | ||
_, err := client.MaskingSession.GetMaskingSession(SessionUuid) | ||
if err == nil { | ||
client.httpClient = cl | ||
panic(errors.New("error expected")) | ||
} | ||
client.httpClient = cl | ||
|
||
assertRequest(t, "GET", "Masking/Session/%s", SessionUuid) | ||
} | ||
|
||
func TestCallService_updateMaskingSession(t *testing.T) { | ||
expectResponse("updateMaskingSessionResponse.json", 204) | ||
SessionUuid := "15e4256c-be01-475c-9a69-95cf65bbed71" | ||
|
||
if _, err := client.MaskingSession.UpdateMaskingSession(UpdateMaskingSessionParams{}, SessionUuid); err != nil { | ||
panic(err) | ||
} | ||
|
||
cl := client.httpClient | ||
client.httpClient = nil | ||
_, err := client.MaskingSession.UpdateMaskingSession(UpdateMaskingSessionParams{}, SessionUuid) | ||
if err == nil { | ||
client.httpClient = cl | ||
panic(errors.New("error expected")) | ||
} | ||
client.httpClient = cl | ||
|
||
assertRequest(t, "POST", "Masking/Session/%s", SessionUuid) | ||
} | ||
|
||
func TestCallService_ListMaskingSession(t *testing.T) { | ||
expectResponse("listMaskingSessionResponse.json", 204) | ||
|
||
if _, err := client.MaskingSession.ListMaskingSession(ListSessionFilterParams{}); err != nil { | ||
panic(err) | ||
} | ||
|
||
cl := client.httpClient | ||
client.httpClient = nil | ||
_, err := client.MaskingSession.ListMaskingSession(ListSessionFilterParams{}) | ||
if err == nil { | ||
client.httpClient = cl | ||
panic(errors.New("error expected")) | ||
} | ||
client.httpClient = cl | ||
|
||
assertRequest(t, "GET", "Masking/Session") | ||
} |