from webtest import TestApp
import dropshot


def test_create_player():
    app = TestApp(dropshot.app)

    params = {'username': 'chapmang',
              'password': 'deadparrot',
              'email': 'chapmang@dropshot.com'}

    expected = {'count': 1,
                'offset': 0,
                'players': [
                    {'gamesPlayed': 0,
                     'username': 'chapmang'}
                ]}

    app.post('/players', params)

    res = app.get('/players')

    assert res.status_int == 200
    assert res.content_type == 'application/json'
    assert res.json == expected

from webtest import TestApp
import dropshot


def test_create_player():
    app = TestApp(dropshot.app)

    params = {'username': 'chapmang',
              'password': 'deadparrot',
              'email': 'chapmang@dropshot.com'}

    expected = {'count': 1,
                'offset': 0,
                'players': [
                    {'gamesPlayed': 0,
                     'username': 'chapmang'}
                ]}

    post_response = app.post('/players', params)
    assert post_response.status_int == 201

    get_response = app.get('/players')
    assert get_response.status_int == 200
    assert get_response.content_type == 'application/json'
    assert get_response.json == expected

Update player creation test to verify POST status code.
Update player creation test to verify POST status code.

  from webtest import TestApp
  import dropshot
  
  
  def test_create_player():
      app = TestApp(dropshot.app)
  
      params = {'username': 'chapmang',
                'password': 'deadparrot',
                'email': 'chapmang@dropshot.com'}
  
      expected = {'count': 1,
                  'offset': 0,
                  'players': [
                      {'gamesPlayed': 0,
                       'username': 'chapmang'}
                  ]}
  
-     app.post('/players', params)
+     post_response = app.post('/players', params)
+     assert post_response.status_int == 201
  
-     res = app.get('/players')
+     get_response = app.get('/players')
+     assert get_response.status_int == 200
+     assert get_response.content_type == 'application/json'
+     assert get_response.json == expected
  
-     assert res.status_int == 200
-     assert res.content_type == 'application/json'
-     assert res.json == expected
- 
Update player creation test to verify POST status code.
## Code Before:
from webtest import TestApp
import dropshot


def test_create_player():
    app = TestApp(dropshot.app)

    params = {'username': 'chapmang',
              'password': 'deadparrot',
              'email': 'chapmang@dropshot.com'}

    expected = {'count': 1,
                'offset': 0,
                'players': [
                    {'gamesPlayed': 0,
                     'username': 'chapmang'}
                ]}

    app.post('/players', params)

    res = app.get('/players')

    assert res.status_int == 200
    assert res.content_type == 'application/json'
    assert res.json == expected

## Instruction:
Update player creation test to verify POST status code.
## Code After:
from webtest import TestApp
import dropshot


def test_create_player():
    app = TestApp(dropshot.app)

    params = {'username': 'chapmang',
              'password': 'deadparrot',
              'email': 'chapmang@dropshot.com'}

    expected = {'count': 1,
                'offset': 0,
                'players': [
                    {'gamesPlayed': 0,
                     'username': 'chapmang'}
                ]}

    post_response = app.post('/players', params)
    assert post_response.status_int == 201

    get_response = app.get('/players')
    assert get_response.status_int == 200
    assert get_response.content_type == 'application/json'
    assert get_response.json == expected
