from app.models import User, Author, Book, Customer


def test_new_user():
    """
    test new user
    """
    user = User(username='patkennedy79', email='<EMAIL>')
    user.set_password('<PASSWORD>')
    assert user.username == 'patkennedy79'
    assert user.email == '<EMAIL>'
    assert user.password_hash != '<PASSWORD>'


def test_new_author():
    """
    test new book
    """
    author = Author(first_name='Pat', last_name='Dee', email='<EMAIL>')
    assert author.first_name == 'Pat'
    assert author.last_name == 'Dee'
    assert author.email == '<EMAIL>'


def test_new_book():
    """
    test new book
    """
    author = Author(first_name='Pat', last_name='Dee', email='<EMAIL>')
    book = Book(title='The River Between', rent_charge=1, author=author.id)
    assert book.title == 'The River Between'
    assert book.author == author.id


def test_new_customer():
    """
    test new customer
    """
    customer = Customer(first_name='Jane', last_name='Doe', email='<EMAIL>')
    assert customer.first_name == 'Jane'
    assert customer.last_name == 'Doe'
    assert customer.email == '<EMAIL>'

from app.models import User, Author, Book, Customer


def test_new_user():
    """
    test new user
    """
    user = User(username='patkennedy79', email='<EMAIL>')
    user.set_password('<PASSWORD>')
    assert user.username == 'patkennedy79'
    assert user.email == '<EMAIL>'
    assert user.password_hash != '<PASSWORD>'


def test_new_author():
    """
    test new book
    """
    author = Author(first_name='Pat', last_name='Dee', email='<EMAIL>')
    assert author.first_name == 'Pat'
    assert author.last_name == 'Dee'
    assert author.email == '<EMAIL>'


def test_new_book():
    """
    test new book
    """
    author = Author(first_name='Pat', last_name='Dee', email='<EMAIL>')
    book = Book(title='The River Between', rent_charge=1, author=author.id)
    assert book.title == 'The River Between'
    assert book.author == author.id


def test_new_customer():
    """
    test new customer
    """
    customer = Customer(first_name='Jane', last_name='Doe', email='<EMAIL>')
    assert customer.first_name == 'Jane'
    assert customer.last_name == 'Doe'
    assert customer.email == '<EMAIL>'

test new user test new book test new book test new customer