mirror of
https://github.com/christianselig/apollo-backend
synced 2024-11-15 08:27:42 +00:00
9341e08123
* tracing * instrument redis * add instrumentation around queue acks * adjust backoff schedules for reddit * set proper http client on reddit * populate account last message ID on upsert * pass last message id on upsert * schedule accounts in a predictable order
35 lines
653 B
Go
35 lines
653 B
Go
package reddit_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"go.opentelemetry.io/otel"
|
|
|
|
"github.com/christianselig/apollo-backend/internal/reddit"
|
|
)
|
|
|
|
func TestAuthenticatedClientObfuscatedToken(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
tracer := otel.Tracer("test")
|
|
rc := reddit.NewClient("<SECRET>", "<SECRET>", tracer, 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)
|
|
}
|
|
}
|