Advertisement
Guest User

Untitled

a guest
Apr 1st, 2017
520
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.76 KB | None | 0 0
  1. @fraud
  2. Feature: fraud detection feature
  3. Testing steps:
  4. 1. Setting through admin endpoints admin configurations "configs_to_update" [success]
  5. 2. Register user with metadata set #1 [success]
  6. 3. Register user with metadata set #1 [success]
  7. 4. Register user with metadata set #1 [error]
  8. 5. Login with registered user #1 [success]
  9. 6. Update user #1 with phone number #1 [success]
  10. 7. Update user #2 with phone number #1 [error]
  11. 8. Update user #1 with bank account #1 [success]
  12. 9. Update user #2 with bank account #1 [error]
  13.  
  14.  
  15. Background:
  16. Given the following fixtures files are loaded:
  17. | @AppBundle/DataFixtures/ORM/Flow/EvaluationDay/Rank_Rank.yml |
  18. | @AppBundle/DataFixtures/ORM/Flow/EvaluationDay/Receipt.yml |
  19. | @AppBundle/DataFixtures/ORM/Flow/EvaluationDay/User_User.yml |
  20. And stored collection "metadata":
  21. | key | value |
  22. | google_advertising_id | qwer!qwer |
  23. | apple_advertising_id | asdf!asdf |
  24. | third_party_id | zxcv!zxcv |
  25. | os | android |
  26. | version | 5.2 KitKat |
  27. | device_type | Nexus |
  28. # And stored collection "configs_to_update":
  29. # | config_key | config_value |
  30. # | snapcart_max_daily_receipt_quantity | 2 |
  31. # | snapcart_warns_limit | 2 |
  32. # | snapcart_max_receipt_per_day_for_warned_user | 1 |
  33. # | snapcart_receipts_upload_days_streak | 2 |
  34. # | snapcart_receipts_upload_total_streak | 3 |
  35. # | snapcart_metadata_block_keys | ['google_advertising_id', 'apple_advertising_id', 'third_party_id'] |
  36. # | snapcart_max_registration_per_metadata | 2 |
  37.  
  38.  
  39. @restoreDatabase
  40. Scenario: # 1. a) Setting through admin endpoints admin configurations
  41. Given I am authenticating as "%fxtr.admin_1.email%" with "%fxtr.admin_1.password%" password
  42. When I send a PUT request for each item in collection "configs_to_update" to "/admin/configurations/%config_key%" with body:
  43. """
  44. {
  45. configValue: %config_value%
  46. }
  47. """
  48. Then the response code should be 200
  49.  
  50. # Scenario: # 1. b) Checking set configurations to be sure, that this mechanism works
  51. # Given I am authenticating as "%fxtr.admin_1.email%" with "%fxtr.admin_1.password%" password
  52. # When I send a GET request to "/admin/configurations"
  53. # Then the response code should be 200
  54. # Then each item from list "configs_to_update" should be:
  55. # """
  56. # response.configurations.%config_key% = %config_value%
  57. # """
  58.  
  59. # Scenario: # 2. Register user #1 with metadata set #1
  60. # When I send a POST request to "/auth/register" with body:
  61. # """
  62. # {
  63. # email: 'user_reg_1@snapcart.asia',
  64. # password: '123123',
  65. # 'metadata': {
  66. # '%metadata.1.key%': '%metadata.1.value%',
  67. # '%metadata.2.key%': '%metadata.2.value%',
  68. # '%metadata.3.key%': '%metadata.3.value%'
  69. # }
  70. # }
  71. # """
  72. # Then the response code should be 201
  73. # Then the response should contain json:
  74. # """
  75. # {
  76. # 'id': "\d+",
  77. # 'email': 'user_reg_1@snapcart.asia',
  78. # 'verified': false
  79. # }
  80. # """
  81.  
  82. # Scenario: # 3. Register user #2 with metadata set #1
  83. # When I send a POST request to "/auth/register" with body:
  84. # """
  85. # {
  86. # email: 'user_reg_2@snapcart.asia',
  87. # password: '123123',
  88. # 'metadata': {
  89. # '%metadata.1.key%': '%metadata.1.value%',
  90. # '%metadata.2.key%': '%metadata.2.value%',
  91. # '%metadata.3.key%': '%metadata.3.value%'
  92. # }
  93. # }
  94. # """
  95. # Then the response code should be 201
  96. # Then the response should contain json:
  97. # """
  98. # {
  99. # "id": "\d+",
  100. # "email": "user_reg_1@snapcart.asia",
  101. # "verified": false
  102. # }
  103. # """
  104.  
  105. # Scenario: # 4. Register user #3 with metadata set #1
  106. # When I send a POST request to "/auth/register" with body:
  107. # """
  108. # {
  109. # "email": "user_reg_3@snapcart.asia",
  110. # "password": "123123",
  111. # "metadata": {
  112. # "%metadata.1.key%": "%metadata.1.value%",
  113. # "%metadata.2.key%": "%metadata.2.value%",
  114. # "%metadata.3.key%": "%metadata.3.value%"
  115. # }
  116. # }
  117. # """
  118. # Then the response code should be 403
  119.  
  120. # Scenario: # 5. Login with registered user #1
  121. # Given I am authenticating as "user_reg_1@snapcart.asia" with "123123" password
  122. # When I send a GET request to "/user_incent/me"
  123. # Then the response code should be 200
  124. # Then the response should contain json:
  125. # """
  126. # {
  127. # "remaining_daily_receipts": 2
  128. # }
  129. # """
  130. # Scenario: # 6. Update user #1 with phone number #1 [!!here is question with telco_id!!!]
  131. # Given I am authenticating as "user_reg_1@snapcart.asia" with "123123" password
  132. # When I send a PATCH request to "/user_incent/me/phone_number" with body:
  133. # """
  134. # {
  135. # "phone_number": "123456789",
  136. # "telco_id": "100"
  137. # }
  138. # """
  139. # Then the response code should be 200
  140.  
  141. # Scenario: # 7. Update user #2 with phone number #1 [!!here is question with telco_id!!!]
  142. # Given I am authenticating as "user_reg_2@snapcart.asia" with "123123" password
  143. # When I send a PATCH request to "/user_incent/me/phone_number" with body:
  144. # """
  145. # {
  146. # "phone_number": "123456789",
  147. # "telco_id": "100"
  148. # }
  149. # """
  150. # Then the response code should be 400
  151. # Then the response should contain json:
  152. # """
  153. # {
  154. # "code": 400,
  155. # "message": "Error(s) found in 'phoneNumber'",
  156. # "extra": [{
  157. # "key": "phone_number",
  158. # "message": "validation.error.field.must_be_unique"
  159. # }]
  160. # }
  161. # """
  162.  
  163. # Scenario: # 8. Update user #1 with bank account #1 [!!here is question with bank id!!!]
  164. # Given I am authenticating as "user_reg_1@snapcart.asia" with "123123" password
  165. # When I send a PATCH request to "/user_incent/me/bank_account" with body:
  166. # """
  167. # {
  168. # "bank": "123",
  169. # "bank_account_number": "1234123412341234",
  170. # "bank_account_holder": "User Reg 1",
  171. # }
  172. # """
  173. # Then the response code should be 200
  174.  
  175. # Scenario: # 9. Update user #2 with bank account #1 [!!here is question with bank id!!!]
  176. # Given I am authenticating as "user_reg_1@snapcart.asia" with "123123" password
  177. # When I send a PATCH request to "/user_incent/me/bank_account" with body:
  178. # """
  179. # {
  180. # "bank": "123",
  181. # "bank_account_number": "1234123412341234",
  182. # "bank_account_holder": "User Reg 2",
  183. # }
  184. # """
  185. # Then the response code should be 400
  186. # Then the response should contain json:
  187. # """
  188. # {
  189. # "code": 400,
  190. # "message": "Error(s) found in 'bankAccountNumber'",
  191. # "extra": [{
  192. # "key": "bank_account_number",
  193. # "message": "validation.error.field.must_be_unique"
  194. # }]
  195. # }
  196. # """
  197.  
  198.  
  199. # # Prepared data in fixtures for next scenarios:
  200. # # 1. login as admin and validate specific receipt, which will lead to user warning
  201. # # 2. try to upload after daily_limit_for_warned
  202. # # 3. try to commit receipt after daily_limit
  203. # # 4. check blocking mechanism for the user, who got total_warns === warns_limit
  204.  
  205. # Scenario: # 1.a Check user via /me endpoint on amount of left receipts for today, (expected: 1)
  206. # Given I am authenticating as "fxtr.user_1.email" with "fxtr.user_1.password" password
  207. # Given I upload a receipt and store data as "receipt_1"
  208. # When I send a GET request to "/user_incent/me"
  209. # Then the response code should be 200
  210. # Then the response should contain json:
  211. # """
  212. # {
  213. # "remaining_daily_receipts": 1
  214. # }
  215. # """
  216.  
  217. # Scenario: # 1.b validate user's receipt to make him warned
  218. # Given I am authenticating as "fxtr.admin_1.email" with "fxtr.admin_1.password" password
  219. # When I send a PUT request to "/admin/receipts/%receipt_1.id%" with body:
  220. # """
  221. # {
  222. # # here goes some data???
  223. # }
  224. # """
  225. # Then the response code should be 200
  226. # Then the response should contain json:
  227. # """
  228. # {
  229. # "status": "valid"
  230. # }
  231. # """
  232. # Scenario: # 1.c validate user's receipt to make him warned
  233. # Given I am authenticating as "fxtr.user_1.email" with "fxtr.user_1.password" password
  234. # When I send a GET request to "/user_incent/me"
  235. # Then the response code should be 200
  236. # Then the response should contain json:
  237. # """
  238. # {
  239. # "remaining_daily_receipts": 0,
  240. # "warned": true
  241. # }
  242. # """
  243.  
  244. # Scenario: # 2 Try to commit receipts more than snapcart_max_receipt_per_day_for_warned_user
  245. # Given I am authenticating as "fxtr.user_1.email" with "fxtr.user_1.password" password
  246. # When I send a POST request to "/user_incent/receipts" with body:
  247. # """
  248. # {}
  249. # """
  250. # Then the response code should be 400
  251. # Then the response should contain json:
  252. # """
  253. # {
  254. # "code": 400,
  255. # "message": "Error(s) found in 'bankAccountNumber'",
  256. # "extra": [{
  257. # "key": "bank_account_number",
  258. # "message": "validation.error.field.must_be_unique"
  259. # }]
  260. # }
  261. # """
  262.  
  263. # Scenario: # 3.a Make sure, that this user uploaded today two receipts
  264. # Given I am authenticating as "fxtr.user_2.email" with "fxtr.user_2.password" password
  265. # When I send a GET request to "/user_incent/me"
  266. # Then the response code should be 200
  267. # Then the response should contain json:
  268. # """
  269. # {
  270. # "remaining_daily_receipts": 0,
  271. # "warned": false
  272. # }
  273. # """
  274.  
  275. # Scenario: # 3.b Try to commit receipt more than snapcart_max_daily_receipt_quantity
  276. # Given I am authenticating as "fxtr.user_2.email" with "fxtr.user_2.password" password
  277. # When I send a POST request to "/user_incent/receipts" with body:
  278. # """
  279. # {}
  280. # """
  281. # Then the response code should be 400
  282. # Then the response should contain json:
  283. # """
  284. # {
  285. # "code": 400,
  286. # "message": "Error(s) found in 'bankAccountNumber'",
  287. # "extra": [{
  288. # "key": "bank_account_number",
  289. # "message": "validation.error.field.must_be_unique"
  290. # }]
  291. # }
  292. # """
  293.  
  294.  
  295. # Scenario: # 4.a Check user via /me endpoint on amount of left receipts for today (expected: 1)
  296. # Given I am authenticating as "fxtr.user_3.email" with "fxtr.user_3.password" password
  297. # Given I upload a receipt and store data as "receipt_2"
  298. # When I send a GET request to "/user_incent/me"
  299. # Then the response code should be 200
  300. # Then the response should contain json:
  301. # """
  302. # {
  303. # "remaining_daily_receipts": 1,
  304. # "warned": false
  305. # }
  306. # """
  307.  
  308. # Scenario: # 4.b validate user's receipt to make him warned
  309. # Given I am authenticating as "fxtr.admin_1.email" with "fxtr.admin_1.password" password
  310. # When I send a PUT request to "/admin/receipts/%receipt_1.id%" with body:
  311. # """
  312. # {
  313. # # here goes some data???
  314. # }
  315. # """
  316. # Then the response code should be 200
  317. # Then the response should contain json:
  318. # """
  319. # {
  320. # "status": "valid"
  321. # }
  322. # """
  323.  
  324. # Scenario: # 4.c check users parameters
  325. # Given I am authenticating as "fxtr.admin_1.email" with "fxtr.admin_1.password" password
  326. # When I send a GET request to "/admin/users/%fxtr.user_3.id%"
  327. # Then the response code should be 200
  328. # Then the response should contain json:
  329. # """
  330. # {
  331. # "blocked": true,
  332. # "warned": true
  333. # }
  334. # """
  335.  
  336. # Scenario: # 4.d try to login as blocked user
  337. # When I send a POST request to "/auth/email" with body:
  338. # """
  339. # {
  340. # "email": "%fxtr.user_3.email%",
  341. # "password": "%fxtr.user_3.password%"
  342. # }
  343. # """
  344. # Then the response code should be 400
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement