Skip to content

Commit 6fce01c

Browse files
committed
tests: Tweak openfga test
Signed-off-by: Stéphane Graber <[email protected]>
1 parent 6ac5950 commit 6fce01c

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

test/suites/openfga.sh

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ test_openfga() {
3535
echo "==> Checking permissions for unknown user..."
3636
user_is_not_server_admin
3737
user_is_not_server_operator
38+
user_is_not_server_viewer
3839
user_is_not_project_admin
3940
user_is_not_project_operator
4041

@@ -105,6 +106,14 @@ test_openfga() {
105106
shutdown_openfga
106107
}
107108

109+
user_is_not_server_viewer() {
110+
# Should still be able to list certificates.
111+
[ "$(incus config trust list oidc-openfga: -f csv -cf | wc -l)" = 1 ]
112+
113+
# Cannot see any config.
114+
! incus info oidc-openfga: | grep -Fq 'core.https_address' || false
115+
}
116+
108117
user_is_not_server_admin() {
109118
# Can always see server info (type-bound public access https://openfga.dev/docs/modeling/public-access).
110119
incus info oidc-openfga: > /dev/null
@@ -125,13 +134,6 @@ user_is_not_server_admin() {
125134

126135
# Should not be able to create a storage pool.
127136
! incus storage create oidc-openfga:test dir || false
128-
129-
# Should still be able to list certificates.
130-
[ "$(incus config trust list oidc-openfga: -f csv -cf | wc -l)" = 1 ]
131-
132-
# Cannot edit certificates.
133-
fingerprint="$(incus config trust list -f csv -cf)"
134-
! incus config trust show "${fingerprint}" | sed -e "s/restricted: false/restricted: true/" | incus config trust edit "oidc-openfga:${fingerprint}" || false
135137
}
136138

137139
user_is_not_server_operator() {
@@ -204,7 +206,6 @@ user_is_project_operator() {
204206
}
205207

206208
user_is_not_project_operator() {
207-
208209
# Project list will not fail but there will be no output.
209210
[ "$(incus project list oidc-openfga: -f csv | wc -l)" = 0 ]
210211
! incus project show oidc-openfga:default || false

0 commit comments

Comments
 (0)