from model.contact import NewContact


def test_add_new_contact(app, db, json_contacts):
    contact = json_contacts
    old_contact = db.get_contact_list()
    app.contact.create_new_contact(contact)
    new_contact = db.get_contact_list()
    old_contact.append(contact)
    assert sorted(old_contact, key=NewContact.id_or_max) == sorted(new_contact, key=NewContact.id_or_max)


'''def test_add_new_contact(app, data_contacts):
    contact = data_contacts
    old_contact = app.contact.get_contact_list()
    app.contact.create_new_contact(contact)
    assert len(old_contact) + 1 == app.contact.count()
    new_contact = app.contact.get_contact_list()
    old_contact.append(contact)
    assert sorted(old_contact, key=NewContact.id_or_max) == sorted(new_contact, key=NewContact.id_or_max)'''
