-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
auth_test.go
28 lines (22 loc) · 864 Bytes
/
auth_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
package ssh2docker
import (
"os"
"testing"
"github.com/apex/log"
"github.com/apex/log/handlers/text"
. "github.com/smartystreets/goconvey/convey"
)
func TestServer_CheckConfig(t *testing.T) {
log.SetHandler(text.New(os.Stderr))
Convey("Testing Server.CheckConfig", t, FailureContinues, func() {
// FIXME: check with a script
server, err := NewServer()
So(err, ShouldBeNil)
server.AllowedImages = []string{"alpine", "ubuntu:trusty", "abcde123"}
So(server.CheckConfig(&ClientConfig{ImageName: "alpine"}), ShouldBeNil)
So(server.CheckConfig(&ClientConfig{ImageName: "ubuntu:trusty"}), ShouldBeNil)
So(server.CheckConfig(&ClientConfig{ImageName: "abcde123"}), ShouldBeNil)
So(server.CheckConfig(&ClientConfig{ImageName: "abcde124"}), ShouldNotBeNil)
So(server.CheckConfig(&ClientConfig{ImageName: "ubuntu:vivid"}), ShouldNotBeNil)
})
}