---
- name: 'Create new User'
  request:
    headers:
      Content-Type: 'application/json'
    path:        '/users/duffyduck'
    method:      'PUT'
    body:
      username:  'duffyduck'
      watchlist:
      - m333
      - m79
      blacklist:
      - m334
      - m77
      skiplist:
      - m335
      - m78
      ratings:
        m336: 4
        m79: 2.5
        m777: 3.0
        m567: 4.0
        m354: 5.0
      expires_at: 2011-09-09T22:41:50+00:00
  response_expectation:
    status_code: 201
    headers:
      Last-Modified:    /.*/
    body:
      username:       'duffyduck'
      watchlist:
      - m333
      - m79
      blacklist:
      - m334
      - m77
      skiplist:
      - m335
      - m78
      ratings:
        m336: 4.0
        m79: 2.5
      fsk:            "18"
- name: 'Update existing User - Update watchlist'
  request:
    headers:
      Content-Type: 'application/json'
    path:       '/users/duffyduck/watchlist'
    method:     'PUT'
    body:
    - m367
    - m73
  response_expectation:
    status_code: 204
    body:
- name: 'Check User FSK,Watchlist'
  request:
    headers:
      Content-Type: 'application/json'
    path:        '/users/duffyduck'
    method:      'GET'
  response_expectation:
    status_code: 200
    headers:
      Last-Modified:    /.*/
    body:
      username:       'duffyduck'
      fsk:            "18"
      watchlist:
      - m367
      - m73
      blacklist:
      - m334
      - m77
      skiplist:
      - m335
      - m78
      ratings:
        m336: 4.0
        m79: 2.5
- name: 'Set 10 Ratings'
  request:
    headers:
      Content-Type: 'application/json'
    path:        '/users/duffyduck/ratings'
    method:      'PUT'
    body:
      "m1035": 1
      "m2087": 0.5
      "m1554": 2
      "m2981": 1.0
      "m1590": 2
      "m12493": 4
      "m1875": 5
      "m7258": 2.5
  response_expectation:
    status_code: 204
    headers:
      Last-Modified:    /.*/
- name: 'Check User Ratings Update'
  request:
    headers:
      Content-Type: 'application/json'
    path:        '/users/duffyduck'
    method:      'GET'
  response_expectation:
    status_code: 200
    headers:
      Last-Modified:    /.*/
    body:
      username:       'duffyduck'
      fsk:            "18"
      watchlist:
      - m367
      - m73
      blacklist:
      - m334
      - m77
      skiplist:
      - m335
      - m78
      ratings:
        "m1035": "1.0"
        "m2087": "0.5"
        "m1554": "2.0"
        "m2981": "1.0"
        "m1590": "2.0"
        "m12493": "4.0"
        "m1875": "5.0"
        "m7258": "2.5"
- name: 'User creation should fail on wrong username'
  priority: 2
  request:
    headers:
      Content-Type: 'application/json'
    path:        '/users/duffyduck'
    method:      'PUT'
    body:
     username: '!"§$%&/()=?QWERTZUI"§$%&      /('
  response_expectation:
    status_code: 409
- name: 'User creation should fail on wrong fsk'
  priority: 2
  request:
    headers:
      Content-Type: 'application/json'
    path:        '/users/duffyduck2'
    method:      'PUT'
    body:
     username: 'duffyduck2'
     fsk: 2000000
  response_expectation:
    status_code: 409
- name: 'User creation should fail on wrong expiration_date'
  priority: 2
  request:
    headers:
      Content-Type: 'application/json'
    path:        '/users/duffyduck3'
    method:      'PUT'
    body:
     username: 'duffyduck3'
     expires_at: 2009-09-09T22:41:50+00:00
  response_expectation:
    status_code: 409