fix API tests

This commit is contained in:
Michael Barz
2022-02-10 16:18:52 +01:00
parent 57de630e33
commit d3b87fa3a1
3 changed files with 18 additions and 21 deletions

View File

@@ -166,14 +166,15 @@ func (g Graph) GetSpecialSpaceItems(ctx context.Context, baseURL *url.URL, space
readmeItem, err := g.getDriveItem(ctx, &storageprovider.ResourceId{StorageId: space.Root.StorageId, OpaqueId: readmeID})
if err != nil {
g.logger.Error().Err(err).Str("ID", readmeID).Msg("Could not get readme Item")
}
readmePath, err := g.getPathForDriveItem(ctx, &storageprovider.ResourceId{StorageId: space.Root.StorageId, OpaqueId: readmeID})
if err != nil {
g.logger.Error().Err(err).Str("ID", readmeID).Msg("Could not get readme path")
} else {
readmeItem.SpecialFolder = &libregraph.SpecialFolder{Name: libregraph.PtrString(ReadmeSpecialFolderName)}
readmeItem.WebDavUrl = libregraph.PtrString(baseURL.String() + filepath.Join(space.Root.OpaqueId, *readmePath))
spaceItems = append(spaceItems, *readmeItem)
readmePath, err := g.getPathForDriveItem(ctx, &storageprovider.ResourceId{StorageId: space.Root.StorageId, OpaqueId: readmeID})
if err != nil {
g.logger.Error().Err(err).Str("ID", readmeID).Msg("Could not get readme path")
} else {
readmeItem.SpecialFolder = &libregraph.SpecialFolder{Name: libregraph.PtrString(ReadmeSpecialFolderName)}
readmeItem.WebDavUrl = libregraph.PtrString(baseURL.String() + filepath.Join(space.Root.OpaqueId, *readmePath))
spaceItems = append(spaceItems, *readmeItem)
}
}
}
}
@@ -183,14 +184,15 @@ func (g Graph) GetSpecialSpaceItems(ctx context.Context, baseURL *url.URL, space
imageItem, err := g.getDriveItem(ctx, &storageprovider.ResourceId{StorageId: space.Root.StorageId, OpaqueId: imageID})
if err != nil {
g.logger.Error().Err(err).Str("ID", imageID).Msg("Could not get image Item")
}
imagePath, err := g.getPathForDriveItem(ctx, &storageprovider.ResourceId{StorageId: space.Root.StorageId, OpaqueId: imageID})
if err != nil {
g.logger.Error().Err(err).Str("ID", imageID).Msg("Could not get image path")
} else {
imageItem.SpecialFolder = &libregraph.SpecialFolder{Name: libregraph.PtrString(SpaceImageSpecialFolderName)}
imageItem.WebDavUrl = libregraph.PtrString(baseURL.String() + filepath.Join(space.Root.OpaqueId, *imagePath))
spaceItems = append(spaceItems, *imageItem)
imagePath, err := g.getPathForDriveItem(ctx, &storageprovider.ResourceId{StorageId: space.Root.StorageId, OpaqueId: imageID})
if err != nil {
g.logger.Error().Err(err).Str("ID", imageID).Msg("Could not get image path")
} else {
imageItem.SpecialFolder = &libregraph.SpecialFolder{Name: libregraph.PtrString(SpaceImageSpecialFolderName)}
imageItem.WebDavUrl = libregraph.PtrString(baseURL.String() + filepath.Join(space.Root.OpaqueId, *imagePath))
spaceItems = append(spaceItems, *imageItem)
}
}
}
}

View File

@@ -289,11 +289,10 @@ func (g Graph) UpdateDrive(w http.ResponseWriter, r *http.Request) {
// Use the Opaque prop of the space
opaque := make(map[string]*types.OpaqueEntry)
spaceDescription := *drive.Description
if spaceDescription != "" {
if drive.Description != nil {
opaque["description"] = &types.OpaqueEntry{
Decoder: "plain",
Value: []byte(spaceDescription),
Value: []byte(*drive.Description),
}
}

View File

@@ -64,10 +64,6 @@ Feature: List and create spaces
| name | Project Mars |
| quota@@@total | 1000000000 |
| root@@@webDavUrl | %base_url%/dav/spaces/%space_id% |
When user "Alice" lists all available spaces via the GraphApi
And user "Alice" lists the content of the space with the name "Project Mars" using the WebDav Api
Then the propfind result of the space should contain these entries:
| .space/ |
Scenario: An admin user can create a Space via the Graph API with certain quota
Given the administrator has given "Alice" the role "Admin" using the settings api