<filename>test_add_contact.py
# -*- coding: utf-8 -*-
from contact import BasicInformation, ContactInformation, SecondaryInformation
from application_contacts import ApplicationContacts
import pytest


@pytest.fixture
def app_contacts(request):
    fixture = ApplicationContacts()
    request.addfinalizer(fixture.destroy)
    return fixture


def test_add_contact(app_contacts):
    app_contacts.login(username="admin", password="<PASSWORD>")
    app_contacts.fill_basic_information_block(BasicInformation(firstname=u"Раз", middlename=u"Два", lastname=u"Три",
                                                           nickname=u"Счет", title=u"Контакт", company=u"Компания",
                                                           address=u"улица дом квартира"))
    app_contacts.fill_contact_information_block(
                                        ContactInformation(home="83831111111", mobile="89831111111", work="83832222222",
                                                           fax="83832233223", email="<EMAIL>",
                                                           email2="<EMAIL>",
                                                           email3="<EMAIL>", homepage="http://homepage.com"))
    app_contacts.fill_secondary_information_block(SecondaryInformation(address2=u"улица1 дом1 квартира1", phone2=u"тут",
                                                                   notes=u"записей нет"))
    app_contacts.logout()


def test_add_empty_contact(app_contacts):
    app_contacts.login(username="admin", password="<PASSWORD>")
    app_contacts.fill_basic_information_block(BasicInformation(firstname="", middlename="", lastname="", nickname="",
                                                           title="", company="", address=""))
    app_contacts.fill_contact_information_block(ContactInformation(home="", mobile="", work="", fax="", email="",
                                                               email2="", email3="", homepage=""))
    app_contacts.fill_secondary_information_block(SecondaryInformation(address2="", phone2="", notes=""))
    app_contacts.logout()

<filename>test_add_contact.py
# -*- coding: utf-8 -*-
from contact import BasicInformation, ContactInformation, SecondaryInformation
from application_contacts import ApplicationContacts
import pytest


@pytest.fixture
def app_contacts(request):
    fixture = ApplicationContacts()
    request.addfinalizer(fixture.destroy)
    return fixture


def test_add_contact(app_contacts):
    app_contacts.login(username="admin", password="<PASSWORD>")
    app_contacts.fill_basic_information_block(BasicInformation(firstname=u"Раз", middlename=u"Два", lastname=u"Три",
                                                           nickname=u"Счет", title=u"Контакт", company=u"Компания",
                                                           address=u"улица дом квартира"))
    app_contacts.fill_contact_information_block(
                                        ContactInformation(home="83831111111", mobile="89831111111", work="83832222222",
                                                           fax="83832233223", email="<EMAIL>",
                                                           email2="<EMAIL>",
                                                           email3="<EMAIL>", homepage="http://homepage.com"))
    app_contacts.fill_secondary_information_block(SecondaryInformation(address2=u"улица1 дом1 квартира1", phone2=u"тут",
                                                                   notes=u"записей нет"))
    app_contacts.logout()


def test_add_empty_contact(app_contacts):
    app_contacts.login(username="admin", password="<PASSWORD>")
    app_contacts.fill_basic_information_block(BasicInformation(firstname="", middlename="", lastname="", nickname="",
                                                           title="", company="", address=""))
    app_contacts.fill_contact_information_block(ContactInformation(home="", mobile="", work="", fax="", email="",
                                                               email2="", email3="", homepage=""))
    app_contacts.fill_secondary_information_block(SecondaryInformation(address2="", phone2="", notes=""))
    app_contacts.logout()

# -*- coding: utf-8 -*-