forked from algebraic-brain/algorithmia-go
-
Notifications
You must be signed in to change notification settings - Fork 2
/
acl_test.go
41 lines (33 loc) · 1.08 KB
/
acl_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
package algorithmia
import (
"testing"
)
func TestAcl(t *testing.T) {
if s := AclTypePrivate.AclString(); s != "" {
t.Fatal(int(AclTypePrivate), "empty string expected, got", s)
}
if s := AclTypeMyAlgos.AclString(); s != "algo://.my/*" {
t.Fatal(int(AclTypeMyAlgos), "'algo://.my/*' expected, got", s)
}
if s := AclTypePublic.AclString(); s != "user://*" {
t.Fatal(int(AclTypePublic), "'user://*' expected, got", s)
}
if s := AclTypeDefault.AclString(); s != AclTypeMyAlgos.AclString() {
t.Fatal(int(AclTypeDefault), AclTypeMyAlgos.AclString()+" expected, got", s)
}
if typ, err := aclTypeFromResponse([]string{}); err != nil {
t.Fatal(err)
} else if typ != AclTypePrivate {
t.Fatal("AclTypePrivate expected, got", typ)
}
if typ, err := aclTypeFromResponse([]string{"algo://.my/*"}); err != nil {
t.Fatal(err)
} else if typ != AclTypeMyAlgos {
t.Fatal("AclTypeMyAlgos expected, got", typ)
}
if typ, err := aclTypeFromResponse([]string{"user://*"}); err != nil {
t.Fatal(err)
} else if typ != AclTypePublic {
t.Fatal("AclTypePublic expected, got", typ)
}
}