comments.feature 14 KB

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