mirror of
https://github.com/christianselig/apollo-backend
synced 2024-11-14 07:57:44 +00:00
34 lines
586 B
Go
34 lines
586 B
Go
|
package reddit_test
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
|
||
|
"github.com/stretchr/testify/assert"
|
||
|
|
||
|
"github.com/christianselig/apollo-backend/internal/reddit"
|
||
|
)
|
||
|
|
||
|
func TestAuthenticatedClientObfuscatedToken(t *testing.T) {
|
||
|
t.Parallel()
|
||
|
|
||
|
rc := reddit.NewClient("<SECRET>", "<SECRET>", nil, nil, 1)
|
||
|
|
||
|
type test struct {
|
||
|
have string
|
||
|
want string
|
||
|
}
|
||
|
|
||
|
tests := []test{
|
||
|
{"abc", "<SHORT>"},
|
||
|
{"abcdefghi", "abc...ghi"},
|
||
|
}
|
||
|
|
||
|
for _, tc := range tests {
|
||
|
tc := tc
|
||
|
rac := rc.NewAuthenticatedClient("<ID>", "<REFRESH>", tc.have)
|
||
|
got := rac.ObfuscatedAccessToken()
|
||
|
|
||
|
assert.Equal(t, tc.want, got)
|
||
|
}
|
||
|
}
|