Skip to content

Commit

Permalink
Merge pull request #4581 from LibreSign/chore/tests-improvement
Browse files Browse the repository at this point in the history
chore: tests improvement
  • Loading branch information
vitormattos authored Feb 1, 2025
2 parents a04defd + 8945a32 commit 65fbcd4
Showing 1 changed file with 24 additions and 19 deletions.
43 changes: 24 additions & 19 deletions tests/integration/features/identify-account/search.feature
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
Feature: search
Background: Create users
Given user "search-signer1" exists
Given user "search-signer2" exists

Scenario: Search account by specific user
Given as user "admin"
And user "search-signer1" exists
And user "search-signer2" exists
When sending "get" to ocs "/apps/libresign/api/v1/identify-account/search?search=search-signer1"
Then the response should have a status code 200
And the response should be a JSON array with the following mandatory values
Expand All @@ -19,6 +17,8 @@ Feature: search

Scenario: Search account by multiple users
Given as user "admin"
And user "search-signer1" exists
And user "search-signer2" exists
When sending "get" to ocs "/apps/libresign/api/v1/identify-account/search?search=search-signer"
Then the response should have a status code 200
And the response should be a JSON array with the following mandatory values
Expand All @@ -40,32 +40,37 @@ Feature: search

Scenario: Search account by herself with partial name search
Given as user "admin"
And set the email of user "admin" to "[email protected]"
When sending "get" to ocs "/apps/libresign/api/v1/identify-account/search?search=adm"
And sending "post" to ocs "/apps/provisioning_api/api/v1/config/apps/libresign/identify_methods"
| value | (string)[{"name":"account","enabled":true}] |
And user "can-find-myself" exists
And run the command "group:adduser admin can-find-myself" with result code 0
And set the email of user "can-find-myself" to "[email protected]"
When sending "get" to ocs "/apps/libresign/api/v1/identify-account/search?search=can-"
Then the response should have a status code 200
And the response should be a JSON array with the following mandatory values
| key | value |
| (jq).ocs.data\|length | 1 |
| (jq).ocs.data[0].id | admin |
| (jq).ocs.data[0].isNoUser | false |
| (jq).ocs.data[0].displayName | admin |
| (jq).ocs.data[0].subname | admin@email.tld |
| (jq).ocs.data[0].icon | icon-user |
| (jq).ocs.data[0].shareType | 0 |
| key | value |
| (jq).ocs.data\|length | 1 |
| (jq).ocs.data[0].id | can-find-myself |
| (jq).ocs.data[0].isNoUser | false |
| (jq).ocs.data[0].displayName | can-find-myself-displayname |
| (jq).ocs.data[0].subname | my@email.tld |
| (jq).ocs.data[0].icon | icon-user |
| (jq).ocs.data[0].shareType | 0 |

Scenario: Search account by herself without permission to identify by account
Given as user "admin"
And sending "post" to ocs "/apps/provisioning_api/api/v1/config/apps/libresign/identify_methods"
| value | (string)[{"name":"email","enabled":true}] |
And set the display name of user "admin" to "Temporary Name"
And set the email of user "admin" to "[email protected]"
And sending "get" to ocs "/apps/libresign/api/v1/identify-account/search?search=admin"
Given user "cant-find-myself" exists
And run the command "group:adduser admin cant-find-myself" with result code 0
And set the display name of user "cant-find-myself" to "Temporary Name"
And set the email of user "cant-find-myself" to "[email protected]"
When as user "cant-find-myself"
And sending "get" to ocs "/apps/libresign/api/v1/identify-account/search?search=cant-find-myself"
Then the response should have a status code 200
And the response should be a JSON array with the following mandatory values
| key | value |
| (jq).ocs.data\|length | 0 |
And set the email of user "admin" to "[email protected]"
And set the display name of user "admin" to "admin"

Scenario: Search account by herself with permission to identify by account
Given as user "admin"
Expand Down

0 comments on commit 65fbcd4

Please sign in to comment.