You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

comments.feature 14KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. Feature: comments
  2. Scenario: Creating a comment on a file belonging to myself
  3. Given user "user0" exists
  4. Given As an "user0"
  5. Given User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"
  6. When "user0" posts a comment with content "My first comment" on the file named "/myFileToComment.txt" it should return "201"
  7. Then As "user0" load all the comments of the file named "/myFileToComment.txt" it should return "207"
  8. And the response should contain a property "oc:parentId" with value "0"
  9. And the response should contain a property "oc:childrenCount" with value "0"
  10. And the response should contain a property "oc:verb" with value "comment"
  11. And the response should contain a property "oc:actorType" with value "users"
  12. And the response should contain a property "oc:objectType" with value "files"
  13. And the response should contain a property "oc:message" with value "My first comment"
  14. And the response should contain a property "oc:actorDisplayName" with value "user0"
  15. And the response should contain only "1" comments
  16. Scenario: Creating a comment on a shared file belonging to another user
  17. Given user "user0" exists
  18. Given user "12345" exists
  19. Given User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"
  20. Given As "user0" sending "POST" to "/apps/files_sharing/api/v1/shares" with
  21. | path | myFileToComment.txt |
  22. | shareWith | 12345 |
  23. | shareType | 0 |
  24. When "12345" posts a comment with content "A comment from another user" on the file named "/myFileToComment.txt" it should return "201"
  25. Then As "12345" load all the comments of the file named "/myFileToComment.txt" it should return "207"
  26. And the response should contain a property "oc:parentId" with value "0"
  27. And the response should contain a property "oc:childrenCount" with value "0"
  28. And the response should contain a property "oc:verb" with value "comment"
  29. And the response should contain a property "oc:actorType" with value "users"
  30. And the response should contain a property "oc:objectType" with value "files"
  31. And the response should contain a property "oc:message" with value "A comment from another user"
  32. And the response should contain a property "oc:actorDisplayName" with value "12345"
  33. And the response should contain only "1" comments
  34. Scenario: Creating a comment on a non-shared file belonging to another user
  35. Given user "user0" exists
  36. Given user "user1" exists
  37. Given User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"
  38. Then "user1" posts a comment with content "My first comment" on the file named "/myFileToComment.txt" it should return "404"
  39. Scenario: Reading comments on a non-shared file belonging to another user
  40. Given user "user0" exists
  41. Given user "user1" exists
  42. Given User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"
  43. Then As "user1" load all the comments of the file named "/myFileToComment.txt" it should return "404"
  44. Scenario: Deleting my own comments on a file belonging to myself
  45. Given user "user0" exists
  46. Given As an "user0"
  47. Given User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"
  48. Given "user0" posts a comment with content "My first comment" on the file named "/myFileToComment.txt" it should return "201"
  49. When As "user0" load all the comments of the file named "/myFileToComment.txt" it should return "207"
  50. Then the response should contain a property "oc:parentId" with value "0"
  51. Then the response should contain a property "oc:childrenCount" with value "0"
  52. And the response should contain a property "oc:verb" with value "comment"
  53. And the response should contain a property "oc:actorType" with value "users"
  54. And the response should contain a property "oc:objectType" with value "files"
  55. And the response should contain a property "oc:message" with value "My first comment"
  56. And the response should contain a property "oc:actorDisplayName" with value "user0"
  57. And the response should contain only "1" comments
  58. And As "user0" delete the created comment it should return "204"
  59. And As "user0" load all the comments of the file named "/myFileToComment.txt" it should return "207"
  60. And the response should contain only "0" comments
  61. Scenario: Deleting my own comments on a file shared by somebody else
  62. Given user "user0" exists
  63. Given user "user1" exists
  64. Given As an "user0"
  65. Given User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"
  66. Given As "user0" sending "POST" to "/apps/files_sharing/api/v1/shares" with
  67. | path | myFileToComment.txt |
  68. | shareWith | user1 |
  69. | shareType | 0 |
  70. Given "user1" posts a comment with content "My first comment" on the file named "/myFileToComment.txt" it should return "201"
  71. When As "user1" load all the comments of the file named "/myFileToComment.txt" it should return "207"
  72. Then the response should contain a property "oc:parentId" with value "0"
  73. And the response should contain a property "oc:childrenCount" with value "0"
  74. And the response should contain a property "oc:verb" with value "comment"
  75. And the response should contain a property "oc:actorType" with value "users"
  76. And the response should contain a property "oc:objectType" with value "files"
  77. And the response should contain a property "oc:message" with value "My first comment"
  78. And the response should contain a property "oc:actorDisplayName" with value "user1"
  79. And the response should contain only "1" comments
  80. And As "user1" delete the created comment it should return "204"
  81. And As "user1" load all the comments of the file named "/myFileToComment.txt" it should return "207"
  82. And the response should contain only "0" comments
  83. Scenario: Deleting my own comments on a file unshared by someone else
  84. Given user "user0" exists
  85. Given user "user1" exists
  86. Given User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"
  87. Given As "user0" sending "POST" to "/apps/files_sharing/api/v1/shares" with
  88. | path | myFileToComment.txt |
  89. | shareWith | user1 |
  90. | shareType | 0 |
  91. Given "user1" posts a comment with content "My first comment" on the file named "/myFileToComment.txt" it should return "201"
  92. When As "user1" load all the comments of the file named "/myFileToComment.txt" it should return "207"
  93. Then the response should contain a property "oc:parentId" with value "0"
  94. And the response should contain a property "oc:childrenCount" with value "0"
  95. And the response should contain a property "oc:verb" with value "comment"
  96. And the response should contain a property "oc:actorType" with value "users"
  97. And the response should contain a property "oc:objectType" with value "files"
  98. And the response should contain a property "oc:message" with value "My first comment"
  99. And the response should contain a property "oc:actorDisplayName" with value "user1"
  100. And the response should contain only "1" comments
  101. And As "user0" remove all shares from the file named "/myFileToComment.txt"
  102. And As "user1" delete the created comment it should return "404"
  103. And As "user1" load all the comments of the file named "/myFileToComment.txt" it should return "404"
  104. Scenario: Edit my own comments on a file belonging to myself
  105. Given user "user0" exists
  106. Given User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"
  107. Given "user0" posts a comment with content "My first comment" on the file named "/myFileToComment.txt" it should return "201"
  108. When As "user0" load all the comments of the file named "/myFileToComment.txt" it should return "207"
  109. Then the response should contain a property "oc:parentId" with value "0"
  110. And the response should contain a property "oc:childrenCount" with value "0"
  111. And the response should contain a property "oc:verb" with value "comment"
  112. And the response should contain a property "oc:actorType" with value "users"
  113. And the response should contain a property "oc:objectType" with value "files"
  114. And the response should contain a property "oc:message" with value "My first comment"
  115. And the response should contain a property "oc:actorDisplayName" with value "user0"
  116. And the response should contain only "1" comments
  117. When As "user0" edit the last created comment and set text to "My edited comment" it should return "207"
  118. Then As "user0" load all the comments of the file named "/myFileToComment.txt" it should return "207"
  119. And the response should contain a property "oc:parentId" with value "0"
  120. And the response should contain a property "oc:childrenCount" with value "0"
  121. And the response should contain a property "oc:verb" with value "comment"
  122. And the response should contain a property "oc:actorType" with value "users"
  123. And the response should contain a property "oc:objectType" with value "files"
  124. And the response should contain a property "oc:message" with value "My edited comment"
  125. And the response should contain a property "oc:actorDisplayName" with value "user0"
  126. Scenario: Edit my own comments on a file shared by someone with me
  127. Given user "user0" exists
  128. Given user "user1" exists
  129. Given User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"
  130. Given As "user0" sending "POST" to "/apps/files_sharing/api/v1/shares" with
  131. | path | myFileToComment.txt |
  132. | shareWith | user1 |
  133. | shareType | 0 |
  134. Given "user1" posts a comment with content "My first comment" on the file named "/myFileToComment.txt" it should return "201"
  135. When As "user0" load all the comments of the file named "/myFileToComment.txt" it should return "207"
  136. Then the response should contain a property "oc:parentId" with value "0"
  137. And the response should contain a property "oc:childrenCount" with value "0"
  138. And the response should contain a property "oc:verb" with value "comment"
  139. And the response should contain a property "oc:actorType" with value "users"
  140. And the response should contain a property "oc:objectType" with value "files"
  141. And the response should contain a property "oc:message" with value "My first comment"
  142. And the response should contain a property "oc:actorDisplayName" with value "user1"
  143. And the response should contain only "1" comments
  144. Given As "user1" edit the last created comment and set text to "My edited comment" it should return "207"
  145. Then As "user1" load all the comments of the file named "/myFileToComment.txt" it should return "207"
  146. And the response should contain a property "oc:parentId" with value "0"
  147. And the response should contain a property "oc:childrenCount" with value "0"
  148. And the response should contain a property "oc:verb" with value "comment"
  149. And the response should contain a property "oc:actorType" with value "users"
  150. And the response should contain a property "oc:objectType" with value "files"
  151. And the response should contain a property "oc:message" with value "My edited comment"
  152. And the response should contain a property "oc:actorDisplayName" with value "user1"
  153. Scenario: Edit my own comments on a file unshared by someone with me
  154. Given user "user0" exists
  155. Given user "user1" exists
  156. Given User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"
  157. Given As "user0" sending "POST" to "/apps/files_sharing/api/v1/shares" with
  158. | path | myFileToComment.txt |
  159. | shareWith | user1 |
  160. | shareType | 0 |
  161. When "user1" posts a comment with content "My first comment" on the file named "/myFileToComment.txt" it should return "201"
  162. Then As "user0" load all the comments of the file named "/myFileToComment.txt" it should return "207"
  163. And the response should contain a property "oc:parentId" with value "0"
  164. And the response should contain a property "oc:childrenCount" with value "0"
  165. And the response should contain a property "oc:verb" with value "comment"
  166. And the response should contain a property "oc:actorType" with value "users"
  167. And the response should contain a property "oc:objectType" with value "files"
  168. And the response should contain a property "oc:message" with value "My first comment"
  169. And the response should contain a property "oc:actorDisplayName" with value "user1"
  170. And the response should contain only "1" comments
  171. And As "user0" remove all shares from the file named "/myFileToComment.txt"
  172. When As "user1" edit the last created comment and set text to "My edited comment" it should return "404"
  173. Then As "user0" load all the comments of the file named "/myFileToComment.txt" it should return "207"
  174. And the response should contain a property "oc:parentId" with value "0"
  175. And the response should contain a property "oc:childrenCount" with value "0"
  176. And the response should contain a property "oc:verb" with value "comment"
  177. And the response should contain a property "oc:actorType" with value "users"
  178. And the response should contain a property "oc:objectType" with value "files"
  179. And the response should contain a property "oc:message" with value "My first comment"
  180. And the response should contain a property "oc:actorDisplayName" with value "user1"
  181. Scenario: Edit comments of other users should not be possible
  182. Given user "user0" exists
  183. Given user "user1" exists
  184. Given User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"
  185. Given As "user0" sending "POST" to "/apps/files_sharing/api/v1/shares" with
  186. | path | myFileToComment.txt |
  187. | shareWith | user1 |
  188. | shareType | 0 |
  189. Given "user1" posts a comment with content "My first comment" on the file named "/myFileToComment.txt" it should return "201"
  190. When As "user0" load all the comments of the file named "/myFileToComment.txt" it should return "207"
  191. Then the response should contain a property "oc:parentId" with value "0"
  192. And the response should contain a property "oc:childrenCount" with value "0"
  193. And the response should contain a property "oc:verb" with value "comment"
  194. And the response should contain a property "oc:actorType" with value "users"
  195. And the response should contain a property "oc:objectType" with value "files"
  196. And the response should contain a property "oc:message" with value "My first comment"
  197. And the response should contain a property "oc:actorDisplayName" with value "user1"
  198. And the response should contain only "1" comments
  199. Then As "user0" edit the last created comment and set text to "My edited comment" it should return "403"