def test_edit_contact_firstname(app):
    if app.contact.count_c() == 0:
        app.contact.create_c(Contact(userfirstname="name_modify"))
    app.contact.editing_first_contact(Contact(userfirstname="NewName"))
    old_contacts = app.contact.get_contact_list()
    contact = Contact(userfirstname="NewName")
    contact.id = old_contacts[0].id
    app.contact.editing_first_contact(contact)
    new_contacts = app.contact.get_contact_list()
    assert len(old_contacts) == len(new_contacts)
    old_contacts[0] = contact
    assert sorted(old_contacts, key=Contact.id_or_maxc) == sorted(new_contacts, key=Contact.id_or_maxc)
def test_edit_firstname_random_contact(app):
    if app.contact.count_c() == 0:
        app.contact.create_c(Contact(userfirstname="name_modify"))
    old_contacts = app.contact.get_contact_list()
    index = randrange(len(old_contacts))
    contact = Contact(userfirstname="NewName")
    contact.id = old_contacts[index].id
    app.contact.editing_contact_by_index(index, contact)
    new_contacts = app.contact.get_contact_list()
    assert len(old_contacts) == len(new_contacts)
    old_contacts[index] = contact
    assert sorted(old_contacts, key=Contact.id_or_maxc) == sorted(new_contacts, key=Contact.id_or_maxc)
Ejemplo n.º 3
0
def test_edit_contact_firstname(app):
    if app.contact.count_c() == 0:
        app.contact.create_c(Contact(userfirstname="name_modify"))
    app.contact.editing_first_contact(Contact(userfirstname="NewName"))
    old_contacts = app.contact.get_contact_list()
    contact = Contact(userfirstname="NewName")
    contact.id = old_contacts[0].id
    app.contact.editing_first_contact(contact)
    new_contacts = app.contact.get_contact_list()
    assert len(old_contacts) == len(new_contacts)
    old_contacts[0] = contact
    assert sorted(old_contacts,
                  key=Contact.id_or_maxc) == sorted(new_contacts,
                                                    key=Contact.id_or_maxc)
Ejemplo n.º 4
0
def test_edit_firstname_random_contact(app):
    if app.contact.count_c() == 0:
        app.contact.create_c(Contact(userfirstname="name_modify"))
    old_contacts = app.contact.get_contact_list()
    index = randrange(len(old_contacts))
    contact = Contact(userfirstname="NewName")
    contact.id = old_contacts[index].id
    app.contact.editing_contact_by_index(index, contact)
    new_contacts = app.contact.get_contact_list()
    assert len(old_contacts) == len(new_contacts)
    old_contacts[index] = contact
    assert sorted(old_contacts,
                  key=Contact.id_or_maxc) == sorted(new_contacts,
                                                    key=Contact.id_or_maxc)
Ejemplo n.º 5
0
def test_edit_contact(app, db, check_ui):
    if len(db.get_contact_list()) == 0:
        app.contact.create(
            Contact(firstname="Alexandr",
                    lastname="Gubanov",
                    nickname="Guban",
                    address="Street",
                    homephone="+790999999",
                    mobilephone="+7909123456",
                    workphone="+89891234567",
                    secondaryphone="+79876654432",
                    email="*****@*****.**",
                    email2="*****@*****.**",
                    email3="*****@*****.**"))
    old_contacts = db.get_contact_list()
    edit_contact = random.choice(old_contacts)
    contact = Contact(firstname="Alexandr_QA",
                      lastname="Gubanov",
                      nickname="Guban",
                      address="Street",
                      homephone="+790999999",
                      mobilephone="+7909123456",
                      workphone="+89891234567",
                      secondaryphone="+79876654432",
                      email="*****@*****.**",
                      email2="*****@*****.**",
                      email3="*****@*****.**")
    contact.id = edit_contact.id
    app.contact.edit_contact_by_id(edit_contact.id, contact)
    new_contacts = db.get_contact_list()
    assert len(old_contacts) == len(new_contacts)
    old_contacts.remove(edit_contact)
    old_contacts.append(contact)
    assert sorted(old_contacts,
                  key=Contact.id_or_max) == sorted(new_contacts,
                                                   key=Contact.id_or_max)
    assert sorted(old_contacts,
                  key=Contact.id_or_max) == sorted(new_contacts,
                                                   key=Contact.id_or_max)
    if check_ui:
        assert sorted(new_contacts, key=Contact.id_or_max) == sorted(
            app.contact.get_contact_list(), key=Contact.id_or_max)