-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathlookup_github_users_aws_keys_test.go
73 lines (57 loc) · 1.95 KB
/
lookup_github_users_aws_keys_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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements;
// and to You under the Apache License, Version 2.0. See LICENSE in project root for full license + copyright.
package keynuker
import (
"encoding/json"
"log"
"os"
"testing"
"github.com/google/go-github/github"
"github.com/stretchr/testify/assert"
"github.com/tleyden/keynuker/keynuker-go-common"
)
func TestLookupGithubUsersAwsKeys(t *testing.T) {
SkipIfIntegrationsTestsNotEnabled(t)
dbHost, ok := os.LookupEnv(keynuker_go_common.EnvVarKeyNukerTestDbHost)
if !ok {
t.Skip("You must define environment variable %s to run this test", keynuker_go_common.EnvVarKeyNukerTestDbHost)
}
dbName, ok := os.LookupEnv(keynuker_go_common.EnvVarKeyNukerTestDbName)
if !ok {
t.Skip("You must define environment variable %s to run this test", keynuker_go_common.EnvVarKeyNukerTestDbName)
}
dbUsername, ok := os.LookupEnv(keynuker_go_common.EnvVarKeyNukerTestDbUsername)
if !ok {
t.Skip("You must define environment variable %s to run this test", keynuker_go_common.EnvVarKeyNukerTestDbUsername)
}
dbPassword, ok := os.LookupEnv(keynuker_go_common.EnvVarKeyNukerTestDbPassword)
if !ok {
t.Skip("You must define environment variable %s to run this test", keynuker_go_common.EnvVarKeyNukerTestDbPassword)
}
params := ParamsLookupGithubUsersAwsKeys{
Host: dbHost,
Username: dbUsername,
Password: dbPassword,
DbName: dbName,
KeyNukerOrg: "default",
}
docWrapper, err := LookupGithubUsersAwsKeys(params)
if err != nil {
log.Printf("Error: %v", err)
}
assert.True(t, err == nil)
docWrapperBytes, err := json.MarshalIndent(docWrapper, "", " ")
assert.True(t, err == nil)
log.Printf("docWrapperBytes: %v", string(docWrapperBytes))
}
type TestReproKivikIssueDoc struct {
GithubUsers []*github.User
}
type Params struct {
Doc map[string]interface{}
}
type GithubUsersDoc struct {
Doc struct {
GithubUsers []*github.User
}
}