-
Notifications
You must be signed in to change notification settings - Fork 0
/
main_test.go
36 lines (26 loc) · 1.06 KB
/
main_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
package main
import (
"os"
"testing"
"github.com/stretchr/testify/assert"
)
func TestLoadLoginRelationsFromEnvNoLogins(t *testing.T) {
os.Setenv("LOGIN_RELATION_1", "")
os.Setenv("LOGIN_RELATION_2", "")
var trelloSlackLoginRelations []loginRelation
loadLoginRelationsFromEnv(&trelloSlackLoginRelations)
assert.Equal(t, []loginRelation(nil), trelloSlackLoginRelations)
}
func TestLoadLoginRelationsFromEnv(t *testing.T) {
os.Setenv("LOGIN_RELATION_1", "@test|slackId")
var trelloSlackLoginRelations []loginRelation
loadLoginRelationsFromEnv(&trelloSlackLoginRelations)
assert.Equal(t, []loginRelation{{trello: "@test", slack: "slackId"}}, trelloSlackLoginRelations)
}
func TestLoadLoginRelationsFromEnvTwoLogins(t *testing.T) {
os.Setenv("LOGIN_RELATION_1", "@test|slackId")
os.Setenv("LOGIN_RELATION_2", "@test1|slackId1")
var trelloSlackLoginRelations []loginRelation
loadLoginRelationsFromEnv(&trelloSlackLoginRelations)
assert.Equal(t, []loginRelation{{trello: "@test", slack: "slackId"}, {trello: "@test1", slack: "slackId1"}}, trelloSlackLoginRelations)
}