Feature: Pass requests

  Scenario: passRequests returns results for created pass
    When get access token
    And prepare place, entrance, service and user for pass
    And create pass for prepared place
    When query passRequests by created pass_id
    Then passRequests response contains created pass

  Scenario: Pass request approval requires two confirmations
    When get access token
    And prepare nested places and employees for pass request approval flow
    And create pass in place #3 for approval flow
    When query passRequests by created pass_id with my token
    Then pass request status is pending
    When approve pass request with my token
    And re-query passRequests by created pass_id with my token
    Then pass request status is pending
    When approve pass request with new employee token
    And query passRequests by created pass_id with new employee token
    Then pass request status is active

  Scenario: Pass request rejection prevents activation even with second confirmation
    When get access token
    And prepare nested places and employees for pass request approval flow
    And create pass in place #3 for approval flow
    When query passRequests by created pass_id with my token
    Then pass request status is pending
    When reject pass request with my token
    And re-query passRequests by created pass_id with my token
    Then pass request status is not active
    When approve pass request with new employee token
    And query passRequests by created pass_id with new employee token
    Then pass request status is not active

  Scenario: addUserToPlace adds trusted member with accepted status
    When get access token
    And prepare place with owner and trusted worker for members query
    When query members for prepared place
    Then members response contains trusted worker with accepted status

  Scenario: setUserPlaces moves worker to first three places with trusted privilege
    When get access token
    And prepare four places and worker for setUserPlaces flow
    When apply setUserPlaces for worker to first three places with trusted privilege
    And query places by worker member filter
    Then worker is in first three places with accepted trusted and absent in fourth place

