Debian Codegraph @

storage/accesscontrol/ace_test.go

raw symbols SCIP
1 package accesscontrolscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/
2
3 import (
4 "testingscip-go gomod github.com/golang/go/src go1.13 testing/"
5
6 "github.com/google/uuidscip-go gomod github.com/google/uuid v1.1.1 `github.com/google/uuid`/"
7 "github.com/stretchr/testify/assertscip-go gomod github.com/stretchr/testify v1.3.0 `github.com/stretchr/testify/assert`/"
8 )
9
10 func TestACEValidate_WithValidACEscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/TestACEValidate_WithValidACE().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) {
11 ace := ACEscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/ACE#{
12 TagTypescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/ACE#TagType.: TagTypeUserscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/TagTypeUser.,
13 Permissionsscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/ACE#Permissions.: "rwx",
14 }
15 assertscip-go gomod github.com/stretchr/testify v1.3.0 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.3.0 `github.com/stretchr/testify/assert`/Nil().(t, ace.Validatescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/ACE#Validate().(), "Expected ACE to Validate successfully")
16 }
17
18 func TestACEValidate_WithACEInvalidPermisionsscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/TestACEValidate_WithACEInvalidPermisions().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) {
19 ace := ACEscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/ACE#{
20 TagTypescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/ACE#TagType.: TagTypeUserscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/TagTypeUser.,
21 Permissionsscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/ACE#Permissions.: "awx",
22 }
23
24 assertscip-go gomod github.com/stretchr/testify v1.3.0 `github.com/stretchr/testify/assert`/.EqualErrorscip-go gomod github.com/stretchr/testify v1.3.0 `github.com/stretchr/testify/assert`/EqualError().(t, ace.Validatescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/ACE#Validate().(), "Permissions must be of the form [r-][w-][x-]")
25 }
26
27 func TestACEValidate_WithACEQualifierSetForMaskscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/TestACEValidate_WithACEQualifierSetForMask().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) {
28 qualifier := uuidscip-go gomod github.com/google/uuid v1.1.1 `github.com/google/uuid`/.MustParsescip-go gomod github.com/google/uuid v1.1.1 `github.com/google/uuid`/MustParse().("ba4662cb-995c-479d-8f7c-a1b3d8ae05a9")
29 ace := ACEscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/ACE#{
30 TagTypescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/ACE#TagType.: TagTypeMaskscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/TagTypeMask.,
31 TagQualifierscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/ACE#TagQualifier.: &qualifier,
32 Permissionsscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/ACE#Permissions.: "rwx",
33 }
34
35 assertscip-go gomod github.com/stretchr/testify v1.3.0 `github.com/stretchr/testify/assert`/.EqualErrorscip-go gomod github.com/stretchr/testify v1.3.0 `github.com/stretchr/testify/assert`/EqualError().(t, ace.Validatescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/ACE#Validate().(), "TagQualifier cannot be set for 'mask' or 'other' TagTypes")
36 }
37
38 func TestACEParse_WithValidDefaultscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/TestACEParse_WithValidDefault().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) {
39 ace, err := ParseACEscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/ParseACE().("default:user:22edd3d8-9253-4463-b8f8-442ebe33b622:rwx")
40 assertscip-go gomod github.com/stretchr/testify v1.3.0 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.3.0 `github.com/stretchr/testify/assert`/NoError().(t, err)
41 assertscip-go gomod github.com/stretchr/testify v1.3.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.3.0 `github.com/stretchr/testify/assert`/Equal().(t, true, ace.IsDefaultscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/ACE#IsDefault., "Expected default")
42 assertscip-go gomod github.com/stretchr/testify v1.3.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.3.0 `github.com/stretchr/testify/assert`/Equal().(t, TagTypeUserscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/TagTypeUser., ace.TagTypescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/ACE#TagType.)
43 assertscip-go gomod github.com/stretchr/testify v1.3.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.3.0 `github.com/stretchr/testify/assert`/Equal().(t, "22edd3d8-9253-4463-b8f8-442ebe33b622", ace.TagQualifierscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/ACE#TagQualifier..Stringscip-go gomod github.com/google/uuid v1.1.1 `github.com/google/uuid`/UUID#String().())
44 assertscip-go gomod github.com/stretchr/testify v1.3.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.3.0 `github.com/stretchr/testify/assert`/Equal().(t, "rwx", ace.Permissionsscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/ACE#Permissions.)
45 }
46 func TestACEParse_WithValidNonDefaultscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/TestACEParse_WithValidNonDefault().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) {
47 ace, err := ParseACEscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/ParseACE().("user:885d0d94-9ecb-4e0d-8581-781b56d27b10:rwx")
48 assertscip-go gomod github.com/stretchr/testify v1.3.0 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.3.0 `github.com/stretchr/testify/assert`/NoError().(t, err)
49 assertscip-go gomod github.com/stretchr/testify v1.3.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.3.0 `github.com/stretchr/testify/assert`/Equal().(t, false, ace.IsDefaultscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/ACE#IsDefault., "Expected non-default")
50 assertscip-go gomod github.com/stretchr/testify v1.3.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.3.0 `github.com/stretchr/testify/assert`/Equal().(t, TagTypeUserscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/TagTypeUser., ace.TagTypescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/ACE#TagType.)
51 assertscip-go gomod github.com/stretchr/testify v1.3.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.3.0 `github.com/stretchr/testify/assert`/Equal().(t, "885d0d94-9ecb-4e0d-8581-781b56d27b10", ace.TagQualifierscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/ACE#TagQualifier..Stringscip-go gomod github.com/google/uuid v1.1.1 `github.com/google/uuid`/UUID#String().())
52 assertscip-go gomod github.com/stretchr/testify v1.3.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.3.0 `github.com/stretchr/testify/assert`/Equal().(t, "rwx", ace.Permissionsscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/ACE#Permissions.)
53 }
54
55 func TestACEParse_WithInvalid4Partscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/TestACEParse_WithInvalid4Part().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) {
56 _, err := ParseACEscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/ParseACE().("test:::")
57 assertscip-go gomod github.com/stretchr/testify v1.3.0 `github.com/stretchr/testify/assert`/.EqualErrorscip-go gomod github.com/stretchr/testify v1.3.0 `github.com/stretchr/testify/assert`/EqualError().(t, err, "When specifying a 4-part ACE the first part must be 'default'")
58 }
59 func TestACEParse_WithInvalidTagTypescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/TestACEParse_WithInvalidTagType().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) {
60 _, err := ParseACEscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/ParseACE().("wibble::rwx")
61 assertscip-go gomod github.com/stretchr/testify v1.3.0 `github.com/stretchr/testify/assert`/.EqualErrorscip-go gomod github.com/stretchr/testify v1.3.0 `github.com/stretchr/testify/assert`/EqualError().(t, err, "Unrecognized TagType: \"wibble\"")
62 }
63 func TestACEParse_WithInvalidNumberOfPartsscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/TestACEParse_WithInvalidNumberOfParts().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) {
64 _, err := ParseACEscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/ParseACE().("user:rwx")
65 assertscip-go gomod github.com/stretchr/testify v1.3.0 `github.com/stretchr/testify/assert`/.EqualErrorscip-go gomod github.com/stretchr/testify v1.3.0 `github.com/stretchr/testify/assert`/EqualError().(t, err, "ACE string should have either 3 or 4 parts")
66 }
67 func TestACEParse_WithInvalidQualifierscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/TestACEParse_WithInvalidQualifier().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) {
68 _, err := ParseACEscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/ParseACE().("user:wibble94-9ecb-4e0d-8581-781b56d27b10:rwx")
69 assertscip-go gomod github.com/stretchr/testify v1.3.0 `github.com/stretchr/testify/assert`/.EqualErrorscip-go gomod github.com/stretchr/testify v1.3.0 `github.com/stretchr/testify/assert`/EqualError().(t, err, "Error parsing qualifer \"wibble94-9ecb-4e0d-8581-781b56d27b10\": invalid UUID format")
70 }
71
72 func TestACEString_WithDefaultscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/TestACEString_WithDefault().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) {
73 qualifier := uuidscip-go gomod github.com/google/uuid v1.1.1 `github.com/google/uuid`/.MustParsescip-go gomod github.com/google/uuid v1.1.1 `github.com/google/uuid`/MustParse().("ba4662cb-995c-479d-8f7c-a1b3d8ae05a9")
74 ace := ACEscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/ACE#{
75 IsDefaultscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/ACE#IsDefault.: true,
76 TagTypescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/ACE#TagType.: TagTypeUserscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/TagTypeUser.,
77 TagQualifierscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/ACE#TagQualifier.: &qualifier,
78 Permissionsscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/ACE#Permissions.: "r-x",
79 }
80 assertscip-go gomod github.com/stretchr/testify v1.3.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.3.0 `github.com/stretchr/testify/assert`/Equal().(t, "default:user:ba4662cb-995c-479d-8f7c-a1b3d8ae05a9:r-x", ace.Stringscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/ACE#String().())
81 }
82 func TestACEString_WithNonDefaultscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/TestACEString_WithNonDefault().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) {
83 qualifier := uuidscip-go gomod github.com/google/uuid v1.1.1 `github.com/google/uuid`/.MustParsescip-go gomod github.com/google/uuid v1.1.1 `github.com/google/uuid`/MustParse().("ba4662cb-995c-479d-8f7c-a1b3d8ae05a9")
84 ace := ACEscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/ACE#{
85 IsDefaultscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/ACE#IsDefault.: false,
86 TagTypescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/ACE#TagType.: TagTypeGroupscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/TagTypeGroup.,
87 TagQualifierscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/ACE#TagQualifier.: &qualifier,
88 Permissionsscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/ACE#Permissions.: "rw-",
89 }
90 assertscip-go gomod github.com/stretchr/testify v1.3.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.3.0 `github.com/stretchr/testify/assert`/Equal().(t, "group:ba4662cb-995c-479d-8f7c-a1b3d8ae05a9:rw-", ace.Stringscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/accesscontrol`/ACE#String().())
91 }