Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @fraud
- Feature: fraud detection feature
- Testing steps:
- 1. Setting through admin endpoints admin configurations "configs_to_update" [success]
- 2. Register user with metadata set #1 [success]
- 3. Register user with metadata set #1 [success]
- 4. Register user with metadata set #1 [error]
- 5. Login with registered user #1 [success]
- 6. Update user #1 with phone number #1 [success]
- 7. Update user #2 with phone number #1 [error]
- 8. Update user #1 with bank account #1 [success]
- 9. Update user #2 with bank account #1 [error]
- Background:
- Given the following fixtures files are loaded:
- | @AppBundle/DataFixtures/ORM/Flow/EvaluationDay/Rank_Rank.yml |
- | @AppBundle/DataFixtures/ORM/Flow/EvaluationDay/Receipt.yml |
- | @AppBundle/DataFixtures/ORM/Flow/EvaluationDay/User_User.yml |
- And stored collection "metadata":
- | key | value |
- | google_advertising_id | qwer!qwer |
- | apple_advertising_id | asdf!asdf |
- | third_party_id | zxcv!zxcv |
- | os | android |
- | version | 5.2 KitKat |
- | device_type | Nexus |
- # And stored collection "configs_to_update":
- # | config_key | config_value |
- # | snapcart_max_daily_receipt_quantity | 2 |
- # | snapcart_warns_limit | 2 |
- # | snapcart_max_receipt_per_day_for_warned_user | 1 |
- # | snapcart_receipts_upload_days_streak | 2 |
- # | snapcart_receipts_upload_total_streak | 3 |
- # | snapcart_metadata_block_keys | ['google_advertising_id', 'apple_advertising_id', 'third_party_id'] |
- # | snapcart_max_registration_per_metadata | 2 |
- @restoreDatabase
- Scenario: # 1. a) Setting through admin endpoints admin configurations
- Given I am authenticating as "%fxtr.admin_1.email%" with "%fxtr.admin_1.password%" password
- When I send a PUT request for each item in collection "configs_to_update" to "/admin/configurations/%config_key%" with body:
- """
- {
- configValue: %config_value%
- }
- """
- Then the response code should be 200
- # Scenario: # 1. b) Checking set configurations to be sure, that this mechanism works
- # Given I am authenticating as "%fxtr.admin_1.email%" with "%fxtr.admin_1.password%" password
- # When I send a GET request to "/admin/configurations"
- # Then the response code should be 200
- # Then each item from list "configs_to_update" should be:
- # """
- # response.configurations.%config_key% = %config_value%
- # """
- # Scenario: # 2. Register user #1 with metadata set #1
- # When I send a POST request to "/auth/register" with body:
- # """
- # {
- # email: 'user_reg_1@snapcart.asia',
- # password: '123123',
- # 'metadata': {
- # '%metadata.1.key%': '%metadata.1.value%',
- # '%metadata.2.key%': '%metadata.2.value%',
- # '%metadata.3.key%': '%metadata.3.value%'
- # }
- # }
- # """
- # Then the response code should be 201
- # Then the response should contain json:
- # """
- # {
- # 'id': "\d+",
- # 'email': 'user_reg_1@snapcart.asia',
- # 'verified': false
- # }
- # """
- # Scenario: # 3. Register user #2 with metadata set #1
- # When I send a POST request to "/auth/register" with body:
- # """
- # {
- # email: 'user_reg_2@snapcart.asia',
- # password: '123123',
- # 'metadata': {
- # '%metadata.1.key%': '%metadata.1.value%',
- # '%metadata.2.key%': '%metadata.2.value%',
- # '%metadata.3.key%': '%metadata.3.value%'
- # }
- # }
- # """
- # Then the response code should be 201
- # Then the response should contain json:
- # """
- # {
- # "id": "\d+",
- # "email": "user_reg_1@snapcart.asia",
- # "verified": false
- # }
- # """
- # Scenario: # 4. Register user #3 with metadata set #1
- # When I send a POST request to "/auth/register" with body:
- # """
- # {
- # "email": "user_reg_3@snapcart.asia",
- # "password": "123123",
- # "metadata": {
- # "%metadata.1.key%": "%metadata.1.value%",
- # "%metadata.2.key%": "%metadata.2.value%",
- # "%metadata.3.key%": "%metadata.3.value%"
- # }
- # }
- # """
- # Then the response code should be 403
- # Scenario: # 5. Login with registered user #1
- # Given I am authenticating as "user_reg_1@snapcart.asia" with "123123" password
- # When I send a GET request to "/user_incent/me"
- # Then the response code should be 200
- # Then the response should contain json:
- # """
- # {
- # "remaining_daily_receipts": 2
- # }
- # """
- # Scenario: # 6. Update user #1 with phone number #1 [!!here is question with telco_id!!!]
- # Given I am authenticating as "user_reg_1@snapcart.asia" with "123123" password
- # When I send a PATCH request to "/user_incent/me/phone_number" with body:
- # """
- # {
- # "phone_number": "123456789",
- # "telco_id": "100"
- # }
- # """
- # Then the response code should be 200
- # Scenario: # 7. Update user #2 with phone number #1 [!!here is question with telco_id!!!]
- # Given I am authenticating as "user_reg_2@snapcart.asia" with "123123" password
- # When I send a PATCH request to "/user_incent/me/phone_number" with body:
- # """
- # {
- # "phone_number": "123456789",
- # "telco_id": "100"
- # }
- # """
- # Then the response code should be 400
- # Then the response should contain json:
- # """
- # {
- # "code": 400,
- # "message": "Error(s) found in 'phoneNumber'",
- # "extra": [{
- # "key": "phone_number",
- # "message": "validation.error.field.must_be_unique"
- # }]
- # }
- # """
- # Scenario: # 8. Update user #1 with bank account #1 [!!here is question with bank id!!!]
- # Given I am authenticating as "user_reg_1@snapcart.asia" with "123123" password
- # When I send a PATCH request to "/user_incent/me/bank_account" with body:
- # """
- # {
- # "bank": "123",
- # "bank_account_number": "1234123412341234",
- # "bank_account_holder": "User Reg 1",
- # }
- # """
- # Then the response code should be 200
- # Scenario: # 9. Update user #2 with bank account #1 [!!here is question with bank id!!!]
- # Given I am authenticating as "user_reg_1@snapcart.asia" with "123123" password
- # When I send a PATCH request to "/user_incent/me/bank_account" with body:
- # """
- # {
- # "bank": "123",
- # "bank_account_number": "1234123412341234",
- # "bank_account_holder": "User Reg 2",
- # }
- # """
- # Then the response code should be 400
- # Then the response should contain json:
- # """
- # {
- # "code": 400,
- # "message": "Error(s) found in 'bankAccountNumber'",
- # "extra": [{
- # "key": "bank_account_number",
- # "message": "validation.error.field.must_be_unique"
- # }]
- # }
- # """
- # # Prepared data in fixtures for next scenarios:
- # # 1. login as admin and validate specific receipt, which will lead to user warning
- # # 2. try to upload after daily_limit_for_warned
- # # 3. try to commit receipt after daily_limit
- # # 4. check blocking mechanism for the user, who got total_warns === warns_limit
- # Scenario: # 1.a Check user via /me endpoint on amount of left receipts for today, (expected: 1)
- # Given I am authenticating as "fxtr.user_1.email" with "fxtr.user_1.password" password
- # Given I upload a receipt and store data as "receipt_1"
- # When I send a GET request to "/user_incent/me"
- # Then the response code should be 200
- # Then the response should contain json:
- # """
- # {
- # "remaining_daily_receipts": 1
- # }
- # """
- # Scenario: # 1.b validate user's receipt to make him warned
- # Given I am authenticating as "fxtr.admin_1.email" with "fxtr.admin_1.password" password
- # When I send a PUT request to "/admin/receipts/%receipt_1.id%" with body:
- # """
- # {
- # # here goes some data???
- # }
- # """
- # Then the response code should be 200
- # Then the response should contain json:
- # """
- # {
- # "status": "valid"
- # }
- # """
- # Scenario: # 1.c validate user's receipt to make him warned
- # Given I am authenticating as "fxtr.user_1.email" with "fxtr.user_1.password" password
- # When I send a GET request to "/user_incent/me"
- # Then the response code should be 200
- # Then the response should contain json:
- # """
- # {
- # "remaining_daily_receipts": 0,
- # "warned": true
- # }
- # """
- # Scenario: # 2 Try to commit receipts more than snapcart_max_receipt_per_day_for_warned_user
- # Given I am authenticating as "fxtr.user_1.email" with "fxtr.user_1.password" password
- # When I send a POST request to "/user_incent/receipts" with body:
- # """
- # {}
- # """
- # Then the response code should be 400
- # Then the response should contain json:
- # """
- # {
- # "code": 400,
- # "message": "Error(s) found in 'bankAccountNumber'",
- # "extra": [{
- # "key": "bank_account_number",
- # "message": "validation.error.field.must_be_unique"
- # }]
- # }
- # """
- # Scenario: # 3.a Make sure, that this user uploaded today two receipts
- # Given I am authenticating as "fxtr.user_2.email" with "fxtr.user_2.password" password
- # When I send a GET request to "/user_incent/me"
- # Then the response code should be 200
- # Then the response should contain json:
- # """
- # {
- # "remaining_daily_receipts": 0,
- # "warned": false
- # }
- # """
- # Scenario: # 3.b Try to commit receipt more than snapcart_max_daily_receipt_quantity
- # Given I am authenticating as "fxtr.user_2.email" with "fxtr.user_2.password" password
- # When I send a POST request to "/user_incent/receipts" with body:
- # """
- # {}
- # """
- # Then the response code should be 400
- # Then the response should contain json:
- # """
- # {
- # "code": 400,
- # "message": "Error(s) found in 'bankAccountNumber'",
- # "extra": [{
- # "key": "bank_account_number",
- # "message": "validation.error.field.must_be_unique"
- # }]
- # }
- # """
- # Scenario: # 4.a Check user via /me endpoint on amount of left receipts for today (expected: 1)
- # Given I am authenticating as "fxtr.user_3.email" with "fxtr.user_3.password" password
- # Given I upload a receipt and store data as "receipt_2"
- # When I send a GET request to "/user_incent/me"
- # Then the response code should be 200
- # Then the response should contain json:
- # """
- # {
- # "remaining_daily_receipts": 1,
- # "warned": false
- # }
- # """
- # Scenario: # 4.b validate user's receipt to make him warned
- # Given I am authenticating as "fxtr.admin_1.email" with "fxtr.admin_1.password" password
- # When I send a PUT request to "/admin/receipts/%receipt_1.id%" with body:
- # """
- # {
- # # here goes some data???
- # }
- # """
- # Then the response code should be 200
- # Then the response should contain json:
- # """
- # {
- # "status": "valid"
- # }
- # """
- # Scenario: # 4.c check users parameters
- # Given I am authenticating as "fxtr.admin_1.email" with "fxtr.admin_1.password" password
- # When I send a GET request to "/admin/users/%fxtr.user_3.id%"
- # Then the response code should be 200
- # Then the response should contain json:
- # """
- # {
- # "blocked": true,
- # "warned": true
- # }
- # """
- # Scenario: # 4.d try to login as blocked user
- # When I send a POST request to "/auth/email" with body:
- # """
- # {
- # "email": "%fxtr.user_3.email%",
- # "password": "%fxtr.user_3.password%"
- # }
- # """
- # Then the response code should be 400
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement