import json


def sample_book(client):
    """
    A book object for use in testing, ideal for repeatedly using the same id.

    Creates the book the first time it is called, then will always return the json of that book. Changes made are permenant.
    """
    data = {
        'title': 'A Darker Shade of Magic', 'author': 'V. E. Schwab', 'isbn': '0765376466', 'date_of_publication': '2016-01-19 00:00:00'
    }
    res = client.post('/books/', data=data)
    loaded_data = json.loads(res.data)
    return loaded_data