-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclient_test.go
49 lines (42 loc) · 899 Bytes
/
client_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package letswatch
import (
"os"
"testing"
"github.com/drewstinnett/go-letterboxd"
"github.com/spf13/viper"
"github.com/stretchr/testify/require"
)
func TestMain(m *testing.M) {
setup()
code := m.Run()
shutdown()
os.Exit(code)
}
func setup() {
os.Clearenv()
}
func shutdown() {
}
func TestNewClient(t *testing.T) {
c, err := NewClient(ClientConfig{
UseCache: false,
TMDBKey: "foo",
PlexURL: "https://plex.example.com",
PlexToken: "plex-token",
LetterboxdConfig: &letterboxd.ClientConfig{
DisableCache: true,
},
})
require.NoError(t, err)
require.NotNil(t, c)
}
func TestNewClientWithViper(t *testing.T) {
v := viper.New()
v.Set("tmdb_key", "foo")
v.Set("plex_url", "https://plex.example.com")
v.Set("plex_token", "token")
v.Set("redis-host", "http://localhost:8888")
got, err := NewClientWithViper(*v)
require.NoError(t, err)
require.NotNil(t, got)
}