<commit_before>@api
Feature: Sharing Custom Groups

  Background:
    Given using OCS API version "1"
    And using new dav path

  Scenario: Check that skeleton is properly set
    Given as user "admin"
    And user "user0" has been created
    Then user "user0" should see the following elements
      | /FOLDER/           |
      | /PARENT/           |
      | /PARENT/parent.txt |
      | /textfile0.txt     |
      | /textfile1.txt     |
      | /textfile2.txt     |
      | /textfile3.txt     |
      | /textfile4.txt     |
      | /welcome.txt       |

  Scenario: Creating a share with a custom group
    Given as user "admin"
    And user "user0" has been created
    And user "user1" has been created
    And user "member1" has been created
    And user "user1" has created a custom group called "sharing-group"
    And user "user1" has made user "member1" a member of custom group "sharing-group"
    When user "user0" sends HTTP method "POST" to OCS API endpoint "/apps/files_sharing/api/v1/shares" with body
      | path      | welcome.txt               |
      | shareWith | customgroup_sharing-group |
      | shareType | 1                         |
    Then the OCS status code should be "100"
    And the HTTP status code should be "200"

  Scenario: Creating a new share with user who already received a share through their custom group
    Given as user "admin"
    And user "user0" has been created
    And user "user1" has been created
    And user "user1" has created a custom group called "sharing-group"
    And user "user0" has shared file "welcome.txt" with group "customgroup_sharing-group"
    When user "user0" sends HTTP method "POST" to OCS API endpoint "/apps/files_sharing/api/v1/shares" with body
      | path      | welcome.txt |
      | shareWith | user1       |
      | shareType | 0           |
    Then the OCS status code should be "100"
    And the HTTP status code should be "200"

  Scenario: Keep custom group permissions in sync
    Given as user "admin"
    And user "user0" has been created
    And user "user1" has been created
    And user "user1" has created a custom group called "group1"
    And user "user0" has shared file "textfile0.txt" with group "customgroup_group1"
    And user "user1" has moved file "/textfile0.txt" to "/FOLDER/textfile0.txt"
    When user "user0" updates the last share using the sharing API with
      | permissions | 1 |
    And user "user0" gets the info of the last share using the sharing API
    Then the OCS status code should be "100"
    And the HTTP status code should be "200"
    And the share fields of the last share should include
      | id                | A_NUMBER       |
      | item_type         | file           |
      | item_source       | A_NUMBER       |
      | share_type        | 1              |
      | file_source       | A_NUMBER       |<commit_msg>Adjust check for fields of share response<commit_after>@api
Feature: Sharing Custom Groups

  Background:
    Given using OCS API version "1"
    And using new dav path

  Scenario: Check that skeleton is properly set
    Given as user "admin"
    And user "user0" has been created
    Then user "user0" should see the following elements
      | /FOLDER/           |
      | /PARENT/           |
      | /PARENT/parent.txt |
      | /textfile0.txt     |
      | /textfile1.txt     |
      | /textfile2.txt     |
      | /textfile3.txt     |
      | /textfile4.txt     |
      | /welcome.txt       |

  Scenario: Creating a share with a custom group
    Given as user "admin"
    And user "user0" has been created
    And user "user1" has been created
    And user "member1" has been created
    And user "user1" has created a custom group called "sharing-group"
    And user "user1" has made user "member1" a member of custom group "sharing-group"
    When user "user0" sends HTTP method "POST" to OCS API endpoint "/apps/files_sharing/api/v1/shares" with body
      | path      | welcome.txt               |
      | shareWith | customgroup_sharing-group |
      | shareType | 1                         |
    Then the OCS status code should be "100"
    And the HTTP status code should be "200"

  Scenario: Creating a new share with user who already received a share through their custom group
    Given as user "admin"
    And user "user0" has been created
    And user "user1" has been created
    And user "user1" has created a custom group called "sharing-group"
    And user "user0" has shared file "welcome.txt" with group "customgroup_sharing-group"
    When user "user0" sends HTTP method "POST" to OCS API endpoint "/apps/files_sharing/api/v1/shares" with body
      | path      | welcome.txt |
      | shareWith | user1       |
      | shareType | 0           |
    Then the OCS status code should be "100"
    And the HTTP status code should be "200"

  Scenario: Keep custom group permissions in sync
    Given as user "admin"
    And user "user0" has been created
    And user "user1" has been created
    And user "user1" has created a custom group called "group1"
    And user "user0" has shared file "textfile0.txt" with group "customgroup_group1"
    And user "user1" has moved file "/textfile0.txt" to "/FOLDER/textfile0.txt"
    When user "user0" updates the last share using the sharing API with
      | permissions | 1 |
    And user "user0" gets the info of the last share using the sharing API
    Then the OCS status code should be "100"
    And the HTTP status code should be "200"
    And the fields of the last response should include
      | id                | A_NUMBER       |
      | item_type         | file           |
      | item_source       | A_NUMBER       |
      | share_type        | 1              |
      | file_source       | A_NUMBER       |
{'fraction_non_alphanumeric': 0.06922943120542703, 'fraction_numerical': 0.019829535571403722, 'mean_word_length': 2.162816281628163, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '830326', 'n_tokens_mistral': 1694, 'n_tokens_neox': 1622, 'n_words': 693}