-
Notifications
You must be signed in to change notification settings - Fork 187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[tests-only] add API test coverage for trying to search with invalid pattern #8441
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,39 +3,19 @@ Feature: Search | |
I want to search for resources in the space | ||
So that I can get them quickly | ||
|
||
Note - this feature is run in CI with ACCOUNTS_HASH_DIFFICULTY set to the default for production | ||
See https://github.com/owncloud/ocis/issues/1542 and https://github.com/owncloud/ocis/pull/839 | ||
|
||
Background: | ||
Given these users have been created with default attributes and without skeleton files: | ||
| username | | ||
| Alice | | ||
| Brian | | ||
And using spaces DAV path | ||
And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API | ||
And user "Alice" has created a space "find data" with the default quota using the Graph API | ||
And user "Alice" has created a folder "folderMain/SubFolder1/subFOLDER2" in space "find data" | ||
And user "Alice" has uploaded a file inside space "find data" with content "some content" to "folderMain/SubFolder1/subFOLDER2/insideTheFolder.txt" | ||
|
||
|
||
Scenario Outline: user can find data from the project space | ||
Given using <dav-path-version> DAV path | ||
When user "Alice" searches for "*fol*" using the WebDAV API | ||
Then the HTTP status code should be "207" | ||
And the search result should contain "4" entries | ||
And the search result of user "Alice" should contain these entries: | ||
| /folderMain | | ||
| /folderMain/SubFolder1 | | ||
| /folderMain/SubFolder1/subFOLDER2 | | ||
| /folderMain/SubFolder1/subFOLDER2/insideTheFolder.txt | | ||
Examples: | ||
| dav-path-version | | ||
| old | | ||
| new | | ||
| spaces | | ||
And user "Alice" has created a space "project101" with the default quota using the Graph API | ||
And user "Alice" has created a folder "folderMain/SubFolder1/subFOLDER2" in space "project101" | ||
And user "Alice" has uploaded a file inside space "project101" with content "some content" to "folderMain/SubFolder1/subFOLDER2/insideTheFolder.txt" | ||
|
||
|
||
Scenario Outline: user can only find data that they searched for from the project space | ||
Scenario Outline: user can search items from the project space | ||
Given using <dav-path-version> DAV path | ||
When user "Alice" searches for "*SUB*" using the WebDAV API | ||
Then the HTTP status code should be "207" | ||
|
@@ -53,9 +33,9 @@ Feature: Search | |
| spaces | | ||
|
||
|
||
Scenario Outline: user can find data from the shares | ||
Scenario Outline: user can search items from the shares | ||
Given using <dav-path-version> DAV path | ||
And user "Alice" has created a share inside of space "find data" with settings: | ||
And user "Alice" has created a share inside of space "project101" with settings: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for clarity |
||
| path | folderMain | | ||
| shareWith | Brian | | ||
| role | viewer | | ||
|
@@ -74,9 +54,9 @@ Feature: Search | |
| spaces | | ||
|
||
|
||
Scenario Outline: user can find hidden file | ||
Scenario Outline: user can search hidden files | ||
Given using <dav-path-version> DAV path | ||
And user "Alice" has created a folder ".space" in space "find data" | ||
And user "Alice" has created a folder ".space" in space "project101" | ||
When user "Alice" searches for "*.sp*" using the WebDAV API | ||
Then the HTTP status code should be "207" | ||
And the search result should contain "1" entries | ||
|
@@ -89,10 +69,10 @@ Feature: Search | |
| spaces | | ||
|
||
|
||
Scenario Outline: user cannot find pending share | ||
Scenario Outline: user cannot search pending share | ||
Given user "Brian" has disabled auto-accepting | ||
And using <dav-path-version> DAV path | ||
And user "Alice" has created a share inside of space "find data" with settings: | ||
And user "Alice" has created a share inside of space "project101" with settings: | ||
| path | folderMain | | ||
| shareWith | Brian | | ||
| role | viewer | | ||
|
@@ -110,9 +90,9 @@ Feature: Search | |
| spaces | | ||
|
||
|
||
Scenario Outline: user cannot find declined share | ||
Scenario Outline: user cannot search declined share | ||
Given using <dav-path-version> DAV path | ||
And user "Alice" has created a share inside of space "find data" with settings: | ||
And user "Alice" has created a share inside of space "project101" with settings: | ||
| path | folderMain | | ||
| shareWith | Brian | | ||
| role | viewer | | ||
|
@@ -131,9 +111,9 @@ Feature: Search | |
| spaces | | ||
|
||
|
||
Scenario Outline: user cannot find deleted folder | ||
Scenario Outline: user cannot search deleted items | ||
Given using <dav-path-version> DAV path | ||
And user "Alice" has removed the folder "folderMain" from space "find data" | ||
And user "Alice" has removed the folder "folderMain" from space "project101" | ||
When user "Alice" searches for "*folderMain*" using the WebDAV API | ||
Then the HTTP status code should be "207" | ||
And the search result should contain "0" entries | ||
|
@@ -144,12 +124,12 @@ Feature: Search | |
| spaces | | ||
|
||
|
||
Scenario Outline: user can find project space by name | ||
Scenario Outline: user can search project space by name | ||
Given using <dav-path-version> DAV path | ||
When user "Alice" searches for '"*find data*"' using the WebDAV API | ||
When user "Alice" searches for '*project101*' using the WebDAV API | ||
Then the HTTP status code should be "207" | ||
And the search result should contain "1" entries | ||
And for user "Alice" the search result should contain space "find data" | ||
And for user "Alice" the search result should contain space "project101" | ||
Examples: | ||
| dav-path-version | | ||
| old | | ||
|
@@ -159,7 +139,7 @@ Feature: Search | |
|
||
Scenario Outline: user can search inside folder in space | ||
Given using <dav-path-version> DAV path | ||
When user "Alice" searches for "*folder*" inside folder "/folderMain" in space "find data" using the WebDAV API | ||
When user "Alice" searches for "*folder*" inside folder "/folderMain" in space "project101" using the WebDAV API | ||
Then the HTTP status code should be "207" | ||
And the search result should contain "3" entries | ||
And the search result of user "Alice" should contain only these entries: | ||
|
@@ -177,7 +157,7 @@ Feature: Search | |
|
||
Scenario Outline: search inside folder in shares | ||
Given using <dav-path-version> DAV path | ||
And user "Alice" has created a share inside of space "find data" with settings: | ||
And user "Alice" has created a share inside of space "project101" with settings: | ||
| path | folderMain | | ||
| shareWith | Brian | | ||
| role | viewer | | ||
|
@@ -277,16 +257,24 @@ Feature: Search | |
|
||
Scenario Outline: search resources using different search patterns (KQL feature) | ||
Given using spaces DAV path | ||
And user "Alice" has created a folder "subfolder" in space "find data" | ||
And user "Alice" has created a folder "subfolder" in space "project101" | ||
When user "Alice" searches for '<pattern>' using the WebDAV API | ||
Then the HTTP status code should be "207" | ||
And the search result should contain "1" entries | ||
And the search result of user "Alice" should contain these entries: | ||
| <search-result> | | ||
Examples: | ||
| description | pattern | search-result | | ||
| starts with | fold* | /folderMain | | ||
| ends with | *der1 | /folderMain/SubFolder1 | | ||
| strict search | subfolder | /subfolder | | ||
| using patern "name:" | name:*der2 | /folderMain/SubFolder1/subFOLDER2 | | ||
| using the pattern "name:" where the value is in quotes | name:"*der2" | /folderMain/SubFolder1/subFOLDER2 | | ||
| pattern | search-result | description | | ||
| fold* | /folderMain | starts with | | ||
| *der1 | /folderMain/SubFolder1 | ends with | | ||
| subfolder | /subfolder | exact search | | ||
| name:*der2 | /folderMain/SubFolder1/subFOLDER2 | patern 'name:'' | | ||
| name:"*der2" | /folderMain/SubFolder1/subFOLDER2 | pattern 'name:""' (with quotes) | | ||
|
||
@issue-7812 @issue-8442 | ||
Scenario: try to search with invalid patterns | ||
Given using spaces DAV path | ||
And user "Alice" has uploaded file with content "test file" to "testFile.txt" | ||
When user "Alice" searches for 'AND mediatype:document' using the WebDAV API | ||
Then the HTTP status code should be "400" | ||
And the value of the item "/d:error/s:message" in the response should be "error: bad request: the expression can't begin from a binary operator: 'AND'" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should cover by the scenario below