def test_create_char(testapp): request_data = { 'name': 'Leo', 'age': 23, 'weight': 66.5, 'human': True } resp = testapp.post('/character/', content_type='application/json', data=json.dumps(request_data)) # Tests assert resp.status_code == 201 assert CharacterModel.get_char(1) assert not HatModel.get_hat_by_char(1)
def test_delete_char_with_hat(testapp): request_data = { 'name': 'Leo', 'age': 23, 'weight': 66.5, 'human': True, 'hat': { 'color': 'YELLOW' } } testapp.post('/character/', content_type='application/json', data=json.dumps(request_data)) resp = testapp.delete('/character/4') # Tests assert resp.status_code == 200 assert not CharacterModel.get_char(4) assert not HatModel.get_hat_by_char(4)