Guest User

Untitled

a guest
Jan 15th, 2021
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 1.01 KB | None | 0 0
  1. package main
  2.  
  3. import (
  4.     "testing"
  5.  
  6.     cidp "github.com/aws/aws-sdk-go/service/cognitoidentityprovider"
  7.     cidpif "github.com/aws/aws-sdk-go/service/cognitoidentityprovider/cognitoidentityprovideriface"
  8. )
  9.  
  10.  
  11. type mockDescribeUserPoolClient struct {
  12.     cidpif.CognitoIdentityProviderAPI
  13.     Response *cidp.DescribeUserPoolClientOutput
  14.     Error    error
  15. }
  16.  
  17. func (m mockDescribeUserPoolClient) DescribeUserPoolClient(*cidp.DescribeUserPoolClientInput) (*cidp.DescribeUserPoolClientOutput, error) {
  18.     return m.Response, nil
  19. }
  20.  
  21. func TestGetUserPoolClientSecret(t *testing.T) {
  22.     t.Run("Successfully obtained client pool secret", func(t *testing.T) {
  23.         idpMock := mockDescribeUserPoolClient{
  24.             Response: &cidp.DescribeUserPoolClientOutput{},
  25.             Error:    nil,
  26.         }
  27.  
  28.         app := application{config: configuration{
  29.             ClientPoolID: "test",
  30.             UserPoolID:   "test",
  31.             idp:          idpMock,
  32.         }}
  33.  
  34.         _, err := app.getUserPoolClientSecret()
  35.         if err != nil {
  36.             t.Fatal("App secret should have been obtained")
  37.         }
  38.     })
  39. }
  40.  
Advertisement
Add Comment
Please, Sign In to add comment