comments.feature 14.2 KB
Newer Older
1
Feature: comments
Sergio Bertolin's avatar
Sergio Bertolin committed
2

3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
  Scenario: Creating a comment on a file belonging to myself
    Given user "user0" exists
    Given As an "user0"
    Given User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"
    When "user0" posts a comment with content "My first comment" on the file named "/myFileToComment.txt" it should return "201"
    Then As "user0" load all the comments of the file named "/myFileToComment.txt" it should return "207"
    And the response should contain a property "oc:parentId" with value "0"
    And the response should contain a property "oc:childrenCount" with value "0"
    And the response should contain a property "oc:verb" with value "comment"
    And the response should contain a property "oc:actorType" with value "users"
    And the response should contain a property "oc:objectType" with value "files"
    And the response should contain a property "oc:message" with value "My first comment"
    And the response should contain a property "oc:actorDisplayName" with value "user0"
    And the response should contain only "1" comments

  Scenario: Creating a comment on a shared file belonging to another user
    Given user "user0" exists
Sergio Bertolin's avatar
Sergio Bertolin committed
20 21 22
    And user "user1" exists
    And User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"
    And file "/myFileToComment.txt" of user "user0" is shared with user "user1"
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207
    When "user1" posts a comment with content "A comment from another user" on the file named "/myFileToComment.txt" it should return "201"
    Then As "user1" load all the comments of the file named "/myFileToComment.txt" it should return "207"
    And the response should contain a property "oc:parentId" with value "0"
    And the response should contain a property "oc:childrenCount" with value "0"
    And the response should contain a property "oc:verb" with value "comment"
    And the response should contain a property "oc:actorType" with value "users"
    And the response should contain a property "oc:objectType" with value "files"
    And the response should contain a property "oc:message" with value "A comment from another user"
    And the response should contain a property "oc:actorDisplayName" with value "user1"
    And the response should contain only "1" comments

  Scenario: Creating a comment on a non-shared file belonging to another user
    Given user "user0" exists
    Given user "user1" exists
    Given User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"
    Then "user1" posts a comment with content "My first comment" on the file named "/myFileToComment.txt" it should return "404"

  Scenario: Reading comments on a non-shared file belonging to another user
    Given user "user0" exists
    Given user "user1" exists
    Given User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"
    Then As "user1" load all the comments of the file named "/myFileToComment.txt" it should return "404"

  Scenario: Deleting my own comments on a file belonging to myself
    Given user "user0" exists
    Given As an "user0"
    Given User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"
    Given "user0" posts a comment with content "My first comment" on the file named "/myFileToComment.txt" it should return "201"
    When As "user0" load all the comments of the file named "/myFileToComment.txt" it should return "207"
    Then the response should contain a property "oc:parentId" with value "0"
    Then the response should contain a property "oc:childrenCount" with value "0"
    And the response should contain a property "oc:verb" with value "comment"
    And the response should contain a property "oc:actorType" with value "users"
    And the response should contain a property "oc:objectType" with value "files"
    And the response should contain a property "oc:message" with value "My first comment"
    And the response should contain a property "oc:actorDisplayName" with value "user0"
    And the response should contain only "1" comments
    And As "user0" delete the created comment it should return "204"
    And As "user0" load all the comments of the file named "/myFileToComment.txt" it should return "207"
    And the response should contain only "0" comments

  Scenario: Deleting my own comments on a file shared by somebody else
    Given user "user0" exists
    Given user "user1" exists
    Given As an "user0"
    Given User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"
    Given As "user0" sending "POST" to "/apps/files_sharing/api/v1/shares" with
      | path | myFileToComment.txt |
      | shareWith | user1 |
      | shareType | 0 |
    Given "user1" posts a comment with content "My first comment" on the file named "/myFileToComment.txt" it should return "201"
    When As "user1" load all the comments of the file named "/myFileToComment.txt" it should return "207"
    Then the response should contain a property "oc:parentId" with value "0"
    And the response should contain a property "oc:childrenCount" with value "0"
    And the response should contain a property "oc:verb" with value "comment"
    And the response should contain a property "oc:actorType" with value "users"
    And the response should contain a property "oc:objectType" with value "files"
    And the response should contain a property "oc:message" with value "My first comment"
    And the response should contain a property "oc:actorDisplayName" with value "user1"
    And the response should contain only "1" comments
    And As "user1" delete the created comment it should return "204"
    And As "user1" load all the comments of the file named "/myFileToComment.txt" it should return "207"
    And the response should contain only "0" comments

  Scenario: Deleting my own comments on a file unshared by someone else
    Given user "user0" exists
    Given user "user1" exists
    Given User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"
    Given As "user0" sending "POST" to "/apps/files_sharing/api/v1/shares" with
      | path | myFileToComment.txt |
      | shareWith | user1 |
      | shareType | 0 |
    Given "user1" posts a comment with content "My first comment" on the file named "/myFileToComment.txt" it should return "201"
    When As "user1" load all the comments of the file named "/myFileToComment.txt" it should return "207"
    Then the response should contain a property "oc:parentId" with value "0"
    And the response should contain a property "oc:childrenCount" with value "0"
    And the response should contain a property "oc:verb" with value "comment"
    And the response should contain a property "oc:actorType" with value "users"
    And the response should contain a property "oc:objectType" with value "files"
    And the response should contain a property "oc:message" with value "My first comment"
    And the response should contain a property "oc:actorDisplayName" with value "user1"
    And the response should contain only "1" comments
    And As "user0" remove all shares from the file named "/myFileToComment.txt"
    And As "user1" delete the created comment it should return "404"
    And As "user1" load all the comments of the file named "/myFileToComment.txt" it should return "404"

  Scenario: Edit my own comments on a file belonging to myself
    Given user "user0" exists
    Given User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"
    Given "user0" posts a comment with content "My first comment" on the file named "/myFileToComment.txt" it should return "201"
    When As "user0" load all the comments of the file named "/myFileToComment.txt" it should return "207"
    Then the response should contain a property "oc:parentId" with value "0"
    And the response should contain a property "oc:childrenCount" with value "0"
    And the response should contain a property "oc:verb" with value "comment"
    And the response should contain a property "oc:actorType" with value "users"
    And the response should contain a property "oc:objectType" with value "files"
    And the response should contain a property "oc:message" with value "My first comment"
    And the response should contain a property "oc:actorDisplayName" with value "user0"
    And the response should contain only "1" comments
    When As "user0" edit the last created comment and set text to "My edited comment" it should return "207"
    Then As "user0" load all the comments of the file named "/myFileToComment.txt" it should return "207"
    And the response should contain a property "oc:parentId" with value "0"
    And the response should contain a property "oc:childrenCount" with value "0"
    And the response should contain a property "oc:verb" with value "comment"
    And the response should contain a property "oc:actorType" with value "users"
    And the response should contain a property "oc:objectType" with value "files"
    And the response should contain a property "oc:message" with value "My edited comment"
    And the response should contain a property "oc:actorDisplayName" with value "user0"

  Scenario: Edit my own comments on a file shared by someone with me
    Given user "user0" exists
    Given user "user1" exists
    Given User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"
    Given As "user0" sending "POST" to "/apps/files_sharing/api/v1/shares" with
      | path | myFileToComment.txt |
      | shareWith | user1 |
      | shareType | 0 |
    Given "user1" posts a comment with content "My first comment" on the file named "/myFileToComment.txt" it should return "201"
    When As "user0" load all the comments of the file named "/myFileToComment.txt" it should return "207"
    Then the response should contain a property "oc:parentId" with value "0"
    And the response should contain a property "oc:childrenCount" with value "0"
    And the response should contain a property "oc:verb" with value "comment"
    And the response should contain a property "oc:actorType" with value "users"
    And the response should contain a property "oc:objectType" with value "files"
    And the response should contain a property "oc:message" with value "My first comment"
    And the response should contain a property "oc:actorDisplayName" with value "user1"
    And the response should contain only "1" comments
    Given As "user1" edit the last created comment and set text to "My edited comment" it should return "207"
    Then As "user1" load all the comments of the file named "/myFileToComment.txt" it should return "207"
    And the response should contain a property "oc:parentId" with value "0"
    And the response should contain a property "oc:childrenCount" with value "0"
    And the response should contain a property "oc:verb" with value "comment"
    And the response should contain a property "oc:actorType" with value "users"
    And the response should contain a property "oc:objectType" with value "files"
    And the response should contain a property "oc:message" with value "My edited comment"
    And the response should contain a property "oc:actorDisplayName" with value "user1"

  Scenario: Edit my own comments on a file unshared by someone with me
    Given user "user0" exists
    Given user "user1" exists
    Given User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"
    Given As "user0" sending "POST" to "/apps/files_sharing/api/v1/shares" with
      | path | myFileToComment.txt |
      | shareWith | user1 |
      | shareType | 0 |
    When "user1" posts a comment with content "My first comment" on the file named "/myFileToComment.txt" it should return "201"
    Then As "user0" load all the comments of the file named "/myFileToComment.txt" it should return "207"
    And the response should contain a property "oc:parentId" with value "0"
    And the response should contain a property "oc:childrenCount" with value "0"
    And the response should contain a property "oc:verb" with value "comment"
    And the response should contain a property "oc:actorType" with value "users"
    And the response should contain a property "oc:objectType" with value "files"
    And the response should contain a property "oc:message" with value "My first comment"
    And the response should contain a property "oc:actorDisplayName" with value "user1"
    And the response should contain only "1" comments
    And As "user0" remove all shares from the file named "/myFileToComment.txt"
    When As "user1" edit the last created comment and set text to "My edited comment" it should return "404"
    Then As "user0" load all the comments of the file named "/myFileToComment.txt" it should return "207"
    And the response should contain a property "oc:parentId" with value "0"
    And the response should contain a property "oc:childrenCount" with value "0"
    And the response should contain a property "oc:verb" with value "comment"
    And the response should contain a property "oc:actorType" with value "users"
    And the response should contain a property "oc:objectType" with value "files"
    And the response should contain a property "oc:message" with value "My first comment"
    And the response should contain a property "oc:actorDisplayName" with value "user1"

  Scenario: Edit comments of other users should not be possible
    Given user "user0" exists
    Given user "user1" exists
    Given User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"
    Given As "user0" sending "POST" to "/apps/files_sharing/api/v1/shares" with
      | path | myFileToComment.txt |
      | shareWith | user1 |
      | shareType | 0 |
    Given "user1" posts a comment with content "My first comment" on the file named "/myFileToComment.txt" it should return "201"
    When As "user0" load all the comments of the file named "/myFileToComment.txt" it should return "207"
    Then the response should contain a property "oc:parentId" with value "0"
    And the response should contain a property "oc:childrenCount" with value "0"
    And the response should contain a property "oc:verb" with value "comment"
    And the response should contain a property "oc:actorType" with value "users"
    And the response should contain a property "oc:objectType" with value "files"
    And the response should contain a property "oc:message" with value "My first comment"
    And the response should contain a property "oc:actorDisplayName" with value "user1"
    And the response should contain only "1" comments
    Then As "user0" edit the last created comment and set text to "My edited comment" it should return "403"