Feature: asset management post and get asset

  Scenario Outline: POST and GET valid asset files
    Given the client has uploaded a valid <file_type> file to s3
    When the user /POST valid <upcased_file_type> asset
    Then the /POST asset response contains a 200 code
    And /GET asset response is [finished]

    Examples:
      |file_type|upcased_file_type|
      |jpg      |JPG              |
      |wav      |WAV              |
      |tif      |TIF              |
      |flac     |FLAC             |
      |m4a      |M4A              |

  Scenario: post and get asset is unsuccessful with non-existent data
    Given the client has uploaded a valid jpg file to s3
    When the user /POST non-existent JPG asset
    Then the /POST asset response contains a 404 code and "not found in bucket" message
    And /GET asset response is [not_found]

  Scenario: post and get asset is unsuccessful with wrong product_id
    Given the client has uploaded a valid jpg file to s3
    When the user /POST asset with non-existent product_id
    Then the /POST asset response contains a 404 code
    And /GET asset response is [not_found]

  Scenario: post and get asset is unsuccessful with wrong filetype
    Given the client has uploaded a valid wav file to s3
    When the user /POST asset with wrong filetype
    Then the /POST asset response contains a 400 code
    And /GET asset response is [not_found]

  Scenario: post asset is unsuccessful if UPC doesn't belong to a product
    Given the client has uploaded a valid jpg file to s3
    When the user /POST asset with wrong UPC
    Then the /POST asset response contains a 403 code

  Scenario: post asset is unsuccessful if TUID doesn't belong to a product
    Given the client has uploaded a valid wav file to s3
    When the user /POST asset with wrong TUID
    Then the /POST asset response contains a 403 code

  Scenario: POST and GET valid asset files as an OA user
    Given valid file upload details and token available for an admin
    When a wav file is uploaded
    Then valid response should be obtained from s3
    When the user /POST valid WAV asset as an OA user
    Then the /POST asset response contains a 200 code
    And /GET asset response is [finished]

  Scenario: POST asset is successful for v2 endpoint
    Given the client has uploaded a valid jpg file to s3
    When the user /POST valid JPG asset to v2 endpoint
    Then the /POST asset response contains a 200 code

  Scenario: POST asset is unsuccessful for v2 endpoint when token is passed
    Given the client has uploaded a valid jpg file to s3
    When the user /POST valid JPG asset to v2 endpoint with token
    Then the /POST asset response contains a [token was unexpected] error
