

def test_case_1_phones_on_home_page(app):
    contact_from_home_page = app.contact.get_contact_list()[0]
    contact_from_edit_page = app.contact.get_contact_info_from_edit_page(0)
    assert contact_from_home_page.all_phones_from_home_page \
           == app.contact.merge_for_contact_it_attributes(
                        attributes=all_phones(contact_from_edit_page), map_clearing=app.contact.clear_merge_attributes)


def all_phones(contact):
    return [contact.home,
            contact.mobile,
            contact.work,
            contact.phone2]


def test_case_2_phones_on_contact_view_page(app):
    contact_from_view_page = app.contact.get_contact_from_view_page(0)
    contact_from_edit_page = app.contact.get_contact_info_from_edit_page(0)
    assert contact_from_view_page.home == contact_from_edit_page.home
    assert contact_from_view_page.mobile == contact_from_edit_page.mobile
    assert contact_from_view_page.work == contact_from_edit_page.work
    assert contact_from_view_page.phone2 == contact_from_edit_page.phone2
