From 5fbee63f091e3634d8a657fee599eba086d5247e Mon Sep 17 00:00:00 2001 From: Roman Perekhod Date: Fri, 5 May 2023 12:39:25 +0200 Subject: [PATCH] fix tests --- go.sum | 2 -- .../acceptance/features/apiSpaces/changeSpaces.feature | 6 +++--- .../features/apiSpaces/disableAndDeleteSpaces.feature | 4 ++-- .../features/apiSpaces/spaceManagement.feature | 10 +++++----- .../grpc/services/storageprovider/storageprovider.go | 7 ++++++- vendor/modules.txt | 3 ++- 6 files changed, 18 insertions(+), 14 deletions(-) diff --git a/go.sum b/go.sum index 764143b000..aae053d263 100644 --- a/go.sum +++ b/go.sum @@ -629,8 +629,6 @@ github.com/crewjam/httperr v0.2.0 h1:b2BfXR8U3AlIHwNeFFvZ+BV1LFvKLlzMjzaTnZMybNo github.com/crewjam/httperr v0.2.0/go.mod h1:Jlz+Sg/XqBQhyMjdDiC+GNNRzZTD7x39Gu3pglZ5oH4= github.com/crewjam/saml v0.4.13 h1:TYHggH/hwP7eArqiXSJUvtOPNzQDyQ7vwmwEqlFWhMc= github.com/crewjam/saml v0.4.13/go.mod h1:igEejV+fihTIlHXYP8zOec3V5A8y3lws5bQBFsTm4gA= -github.com/cs3org/reva/v2 v2.13.2-0.20230504093557-756a84314af0 h1:KJHTdnQpEB3hcOSNXtMFedAvplpNRepo3RPArWFiSYo= -github.com/cs3org/reva/v2 v2.13.2-0.20230504093557-756a84314af0/go.mod h1:VxBmpOvIKlgKLPOsHun+fABopzX+3ZELPAp3N5bQMsM= github.com/cubewise-code/go-mime v0.0.0-20200519001935-8c5762b177d8 h1:Z9lwXumT5ACSmJ7WGnFl+OMLLjpz5uR2fyz7dC255FI= github.com/cubewise-code/go-mime v0.0.0-20200519001935-8c5762b177d8/go.mod h1:4abs/jPXcmJzYoYGF91JF9Uq9s/KL5n1jvFDix8KcqY= github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= diff --git a/tests/acceptance/features/apiSpaces/changeSpaces.feature b/tests/acceptance/features/apiSpaces/changeSpaces.feature index 1e0f1884dd..4ad095a0af 100644 --- a/tests/acceptance/features/apiSpaces/changeSpaces.feature +++ b/tests/acceptance/features/apiSpaces/changeSpaces.feature @@ -51,7 +51,7 @@ Feature: Change data of space Scenario Outline: user other than space manager role can't change the name of a Space via the Graph API When user "" changes the name of the "Project Jupiter" space to "Project Jupiter" - Then the HTTP status code should be "403" + Then the HTTP status code should be "404" Examples: | user | | Brian | @@ -90,7 +90,7 @@ Feature: Change data of space Scenario Outline: viewer and editor cannot change the description(subtitle) of a space via the Graph API When user "" changes the description of the "Project Jupiter" space to "The Death Star is a fictional mobile space station" - Then the HTTP status code should be "403" + Then the HTTP status code should be "404" Examples: | user | | Brian | @@ -334,7 +334,7 @@ Feature: Change data of space Given user "Alice" has created a folder ".space" in space "Project Jupiter" And user "Alice" has uploaded a file inside space "Project Jupiter" with content "" to ".space/someImageFile.jpg" When user "Bob" sets the file ".space/someImageFile.jpg" as a space image in a special section of the "Project Jupiter" space - Then the HTTP status code should be "403" + Then the HTTP status code should be "404" Scenario Outline: user set new readme file as description of the space via the graph API diff --git a/tests/acceptance/features/apiSpaces/disableAndDeleteSpaces.feature b/tests/acceptance/features/apiSpaces/disableAndDeleteSpaces.feature index d5727ac82a..d6fa1c900c 100644 --- a/tests/acceptance/features/apiSpaces/disableAndDeleteSpaces.feature +++ b/tests/acceptance/features/apiSpaces/disableAndDeleteSpaces.feature @@ -41,7 +41,7 @@ Feature: Disabling and deleting space Scenario Outline: user with role user and guest cannot disable other space via the Graph API Given the administrator has given "Carol" the role "" using the settings api When user "Carol" tries to disable a space "Project Moon" owned by user "Alice" - Then the HTTP status code should be "403" + Then the HTTP status code should be "404" And the user "Brian" should have a space called "Project Moon" And the user "Bob" should have a space called "Project Moon" Examples: @@ -115,7 +115,7 @@ Feature: Disabling and deleting space Given the administrator has given "Carol" the role "" using the settings api And user "Alice" has disabled a space "Project Moon" When user "Carol" tries to delete a space "Project Moon" owned by user "Alice" - Then the HTTP status code should be "403" + Then the HTTP status code should be "404" Examples: | role | | User | diff --git a/tests/acceptance/features/apiSpaces/spaceManagement.feature b/tests/acceptance/features/apiSpaces/spaceManagement.feature index e8f4048cf0..9f81eb449a 100644 --- a/tests/acceptance/features/apiSpaces/spaceManagement.feature +++ b/tests/acceptance/features/apiSpaces/spaceManagement.feature @@ -113,7 +113,7 @@ Feature: Space management Scenario: user without space admin permission tries to change the name of the project space When user "Carol" tries to change the name of the "Project" space to "New Name" owned by user "Alice" - Then the HTTP status code should be "403" + Then the HTTP status code should be "404" And the user "Alice" should have a space called "Project" @skipOnStable2.0 @@ -140,7 +140,7 @@ Feature: Space management Scenario: user without space admin permission tries to change the description of the project space Given user "Alice" has changed the description of the "Project" space to "old description" When user "Carol" tries to change the description of the "Project" space to "New description" owned by user "Alice" - Then the HTTP status code should be "403" + Then the HTTP status code should be "404" @skipOnStable2.0 Scenario: space admin user disables the project space @@ -151,12 +151,12 @@ Feature: Space management Scenario: user without space admin permission tries to disable the project space When user "Carol" tries to disable a space "Project" owned by user "Alice" - Then the HTTP status code should be "403" + Then the HTTP status code should be "404" Scenario Outline: space admin user tries to disable the personal space When user "" disables a space "Alice Hansen" owned by user "Alice" - Then the HTTP status code should be "403" + Then the HTTP status code should be "404" Examples: | user | | Brian | @@ -173,7 +173,7 @@ Feature: Space management Scenario: user without space admin permission tries to delete the project space Given user "Alice" has disabled a space "Project" When user "Carol" tries to delete a space "Project" owned by user "Alice" - Then the HTTP status code should be "403" + Then the HTTP status code should be "404" @skipOnStable2.0 Scenario: space admin user enables the project space diff --git a/vendor/github.com/cs3org/reva/v2/internal/grpc/services/storageprovider/storageprovider.go b/vendor/github.com/cs3org/reva/v2/internal/grpc/services/storageprovider/storageprovider.go index ce81eae99a..2980077f2c 100644 --- a/vendor/github.com/cs3org/reva/v2/internal/grpc/services/storageprovider/storageprovider.go +++ b/vendor/github.com/cs3org/reva/v2/internal/grpc/services/storageprovider/storageprovider.go @@ -599,13 +599,18 @@ func (s *service) DeleteStorageSpace(ctx context.Context, req *provider.DeleteSt if err != nil || len(spaces) != 1 { var st *rpc.Status switch err.(type) { - case errtypes.IsNotFound, errtypes.PermissionDenied: + case errtypes.IsNotFound: + st = status.NewNotFound(ctx, "not found when deleting space") + case errtypes.PermissionDenied: st = status.NewPermissionDenied(ctx, err, "permission denied") case errtypes.BadRequest: st = status.NewInvalid(ctx, err.Error()) default: st = status.NewInternal(ctx, "error deleting space: "+req.Id.String()) } + if len(spaces) == 0 { + st = status.NewNotFound(ctx, "not found when deleting space") + } return &provider.DeleteStorageSpaceResponse{ Status: st, }, nil diff --git a/vendor/modules.txt b/vendor/modules.txt index f4c43537f1..6e5cd72fe3 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -349,7 +349,7 @@ github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1 github.com/cs3org/go-cs3apis/cs3/storage/registry/v1beta1 github.com/cs3org/go-cs3apis/cs3/tx/v1beta1 github.com/cs3org/go-cs3apis/cs3/types/v1beta1 -# github.com/cs3org/reva/v2 v2.13.2-0.20230504093557-756a84314af0 +# github.com/cs3org/reva/v2 v2.13.2-0.20230504093557-756a84314af0 => github.com/2403905/reva/v2 v2.0.0-20230504205508-69238ad9d885 ## explicit; go 1.19 github.com/cs3org/reva/v2/cmd/revad/internal/grace github.com/cs3org/reva/v2/cmd/revad/runtime @@ -2124,3 +2124,4 @@ stash.kopano.io/kgol/oidc-go ## explicit; go 1.13 stash.kopano.io/kgol/rndm # github.com/cs3org/go-cs3apis => github.com/c0rby/go-cs3apis v0.0.0-20230110100311-5b424f1baa35 +# github.com/cs3org/reva/v2 => github.com/2403905/reva/v2 v2.0.0-20230504205508-69238ad9d885