Esempio n. 1
0
class AddressBook:

    ROBOT_LIBRARY_SCOPE = 'TEST SUITE'

    def __init__(self, config="target.json", browser="firefox"):
        self.browser = browser
        config_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", config)
        with open(config_file) as f:
            self.target = json.load(f)

    def init_fixtures(self):
        web_config = self.target['web']
        self.fixture = Application(browser=self.browser, base_url=web_config['baseUrl'])
        self.fixture.session.ensure_login(username=web_config['username'], password=web_config['password'])
        db_config = self.target['db']
        self.dbfixture = DbFixture(host=db_config['host'], name=db_config['name'], user=db_config['user'], password=db_config['password'])

    def destroy_fixtures(self):
        self.dbfixture.destroy()
        self.fixture.destroy()

    def new_group(self, name, header, footer):
        return Group(name=name, header=header, footer=footer)

    def get_group_list(self):
        return self.dbfixture.get_group_list()

    def create_group(self, group):
        self.fixture.group.create(group)

    def delete_group(self, group):
        self.fixture.group.delete_group_by_id(group.id)

    def modify_group(self, source_group, new_data_group):
        self.fixture.group.modify_group_by_id(source_group.id, new_data_group)

    def group_lists_should_be_equal(self, list1, list2):
        assert sorted(list1, key=Group.id_or_max) == sorted(list2, key=Group.id_or_max)

    def new_contact(self, lastname, firstname, address, home, mobile, work, phone2, email, email2, email3):
        return Contact(lastname=lastname, firstname=firstname, address=address,
                   home=home, mobile=mobile, work=work, phone2=phone2,
                   email=email, email2=email2, email3=email3)

    def get_contact_list(self):
        return self.dbfixture.get_contact_list()

    def add_contact(self, contact):
        self.fixture.contact.add(contact)

    def delete_contact(self, contact):
        self.fixture.contact.delete_contact_by_id(contact.id)
        self.fixture.wd.implicitly_wait(5)

    def modify_contact(self, source_contact, new_data_contact):
        self.fixture.contact.modify_contact_by_id(source_contact.id, new_data_contact)

    def contact_lists_should_be_equal(self, list1, list2):
        assert sorted(list1, key=Contact.id_or_max) == sorted(list2, key=Contact.id_or_max)
Esempio n. 2
0
class AddressBook:

    ROBOT_LIBRARY_SCOPE = 'TEST SUITE'

    def __init__(self, config = 'target.json', browser='firefox'):
        self.browser = browser
        config_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', config)
        with open(config_file) as f:
            self.target = json.load(f)

    def init_fixtures(self):
        web_config = self.target["web"]
        self.fixture = Application(browser=self.browser, base_url=web_config['baseUrl'])
        self.fixture.session.ensure_login(username=web_config["username"], password=web_config["password"])
        db_config = self.target["db"]
        self.dbfixture = DbFixture(host=db_config["host"], name=db_config["name"], user=db_config["user"], password=db_config["password"])

    def destroy_fixtures(self):
        self.fixture.destroy()
        self.dbfixture.destroy()

    def get_group_list(self):
        return self.dbfixture.get_group_list()

    def get_contact_list(self):
        return self.dbfixture.get_contact_list()

    def new_group(self, name, header, footer):
        return Group(name=name, header=header, footer=footer)

    def new_contact(self, firstname, lastname):
        return Contact(firstname=firstname, lastname=lastname)

    def create_group(self, group):
        self.fixture.group.create(group)

    def create_contact(self, contact):
        self.fixture.contact.add_new(contact)

    def delete_group(self, group):
        self.fixture.group.delete_group_by_id(group.id)

    def delete_contact(self, contact):
        self.fixture.contact.delete_contact_by_id(contact.id)

    def change_contact_name(self, contact, new_name):
        edited_contact = contact
        edited_contact.firstname = new_name
        self.fixture.contact.edit_contact_by_id(edited_contact, contact.id)

    def group_lists_should_be_equal(self, list1, list2):
        assert sorted(list1, key=Group.id_or_max) == sorted(list2, key=Group.id_or_max)

    def contact_lists_should_be_equal(self, list1, list2):
        assert sorted(list1, key=Contact.id_or_max) == sorted(list2, key=Contact.id_or_max)
Esempio n. 3
0
class AddressBook:

    ROBOT_LIBRARY_SCOPE = 'TEST SUITE'

    def __init__(self, config="target.json", browser="firefox"):
        self.browser = browser
        config_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", config)
        with open(config_file) as f:
            self.target = json.load(f)

    def init_fixtures(self):
        web_config = self.target['web']
        self.fixture = Application(browser=self.browser, base_url=web_config['baseUrl'])
        self.fixture.session.ensure_login(username=web_config['username'], password=web_config['password'])
        db_config = self.target['db']
        self.dbfixture = DbFixture(host=db_config['host'], name=db_config['name'], user=db_config['user'],
                                   password=db_config['password'])

    def destroy_fixtures(self):
        self.dbfixture.destroy()
        self.fixture.destroy()

    def create_group(self, group):
        self.fixture.group.create(group)

    def delete_group(self, group):
        self.fixture.group.delete_group_by_id(group.id)

    def get_group_list(self):
        return self.dbfixture.get_group_list()

    def new_group(self, name, header, footer):
        return Group(name=name, header=header, footer=footer)

    def new_contact(self, firstname, lastname):
        return Contact(firstname=firstname, lastname=lastname)

    def get_contact_list(self):
        return self.dbfixture.get_contact_list()

    def create_contact(self, contact):
        self.fixture.contact.create(contact)

    def delete_contact(self, contact):
        self.fixture.contact.delete_contact_by_id(contact.id)

    def modify_contact(self, new_contact, contact):
        self.fixture.contact.modify_contact_by_id(new_contact, contact.id)

    def group_lists_should_be_equal(self, list1, list2):
        assert sorted(list1, key=Group.id_or_max) == sorted(list2, key=Group.id_or_max)

    def contact_lists_should_be_equal(self, list1, list2):
        assert sorted(list1, key=Contact.id_or_max) == sorted(list2, key=Contact.id_or_max)
Esempio n. 4
0
class AddressBook:

    ROBOT_LIBRARY_SCOPE = 'TEST SUITE'

    def __init__(self, config='target.json', browser='chrome'):
        self.browser = browser
        config_file = os.path.join(os.path.dirname(os.path.abspath(__file__)),
                                   "..", config)
        with open(config_file) as f:
            self.target = json.load(f)

    def init_fixtures(self):
        web_config = self.target["web"]
        self.fixture = Application(browser=self.browser,
                                   base_url=web_config["baseUrl"])
        self.fixture.session.ensure_login(username=web_config["username"],
                                          password=web_config["password"])
        db_config = self.target["db"]
        self.dbfixture = DbFixture(host=db_config["host"],
                                   name=db_config["name"],
                                   user=db_config["user"],
                                   password=db_config["password"])

    def destroy_fixtures(self):
        self.dbfixture.destroy()
        self.fixture.destroy()

    def new_group(self, name, header, footer):
        return Group(name=name, header=header, footer=footer)

    def get_group_list(self):
        return self.dbfixture.get_group_list()

    def create_group(self, group):
        self.fixture.group.create(group)

    def group_lists_should_be_equal(self, list1, list2):
        assert sorted(list1,
                      key=Group.id_or_max) == sorted(list2,
                                                     key=Group.id_or_max)

    def delete_group(self, group):
        self.fixture.group.delete_group_by_id(group.id)

    def get_contact_list(self):
        return self.dbfixture.get_contact_list()

    def new_contact(self, firstname, lastname, address, home, mobile):
        return Contact(firstname=firstname,
                       lastname=lastname,
                       address=address,
                       home=home,
                       mobile=mobile)

    def new_contact_data(self, id, firstname, lastname, address, home, mobile):
        return Contact(id=id,
                       firstname=firstname,
                       lastname=lastname,
                       address=address,
                       home=home,
                       mobile=mobile)

    def create_contact(self, contact):
        self.fixture.contact.create(contact)

    def contact_lists_should_be_equal(self, list1, list2):
        assert sorted(list1,
                      key=Contact.id_or_max) == sorted(list2,
                                                       key=Contact.id_or_max)

    def edit_contact(self, contact, contact_data):
        self.fixture.contact.edit_contact_by_id(contact.id, contact_data)

    def delete_contact(self, contact):
        self.fixture.contact.delete_by_id_from_edit_form(contact.id)
Esempio n. 5
0
class AddressBook:
    ROBOT_LIBRARY_SCOPE = 'TEST SUITE'

    def __init__(self, config="target.json", browser="chrome"):
        self.browser = browser
        config_file = os.path.join(os.path.dirname(os.path.abspath(__file__)),
                                   "..", config)
        with open(config_file) as f:
            self.target = json.load(f)

    def init_fixture(self):
        web_config = self.target['web']
        self.fixture = Application(browser=self.browser,
                                   base_url=web_config['baseUrl'])
        self.fixture.session.ensure_login(username=web_config['username'],
                                          password=web_config['password'])
        db_config = self.target['db']
        self.dbfixture = DbFixture(host=db_config['host'],
                                   name=db_config['database'],
                                   user=db_config['user'],
                                   password=db_config['password'])

    def destroy_fixture(self):
        self.dbfixture.destroy()
        self.fixture.destroy()

    def new_group(self, name, header, footer):
        return Group(name=name, header=header, footer=footer)

    def get_group_list(self):
        return self.dbfixture.get_group_list()

    def create_group(self, group):
        self.fixture.group.create(group)

    def delete_group(self, group):
        self.fixture.group.delete_group_by_id(group.id)

    def group_lists_should_be_equal(self, list1, list2):
        assert sorted(list1,
                      key=Group.id_or_max) == sorted(list2,
                                                     key=Group.id_or_max)

    def get_contact_list(self):
        return self.dbfixture.get_contact_list()

    def new_contact(self, firstname, middlename, lastname, nickname, title,
                    company, address, home, mobile, work, fax, email, email2,
                    email3, homepage, address2, phone2, notes, bday, bmonth,
                    byear, aday, amonth, ayear):
        return Contact(firstname=firstname,
                       middlename=middlename,
                       lastname=lastname,
                       nickname=nickname,
                       title=title,
                       company=company,
                       address1=address,
                       homephone=home,
                       mobilephone=mobile,
                       workphone=work,
                       fax=fax,
                       email1=email,
                       email2=email2,
                       email3=email3,
                       homepage=homepage,
                       bdaydate=bday,
                       bmonth=bmonth,
                       aday=aday,
                       amonth=amonth,
                       byear=byear,
                       ayear=ayear,
                       address2=address2,
                       phone2=phone2,
                       notes1=notes)

    def create_contact(self, contact):
        self.fixture.contact.add_new_contact()
        self.fixture.contact.fill_data(contact)
        self.fixture.contact.submit()

    def contact_lists_should_be_equal(self, list1, list2):
        assert sorted(list1,
                      key=Contact.id_or_max) == sorted(list2,
                                                       key=Contact.id_or_max)

    def delete_contact(self, contact):
        self.fixture.contact.delete_contact_by_id(contact.id)

    def edit_contact(self, contact):
        self.fixture.contact.edit_contact_by_id(contact.id)

    def edited_contact(self, firstname, middlename, lastname, nickname, title,
                       company, address, home, mobile, work, fax, email,
                       email2, email3, homepage, address2, phone2, notes, bday,
                       bmonth, byear, aday, amonth, ayear):
        return Contact(firstname=firstname,
                       middlename=middlename,
                       lastname=lastname,
                       nickname=nickname,
                       title=title,
                       company=company,
                       address1=address,
                       homephone=home,
                       mobilephone=mobile,
                       workphone=work,
                       fax=fax,
                       email1=email,
                       email2=email2,
                       email3=email3,
                       homepage=homepage,
                       bdaydate=bday,
                       bmonth=bmonth,
                       aday=aday,
                       amonth=amonth,
                       byear=byear,
                       ayear=ayear,
                       address2=address2,
                       phone2=phone2,
                       notes1=notes)

    def update_contact(self, contact):
        self.fixture.contact.fill_data(contact)
        self.fixture.contact.update()
        time.sleep(5)

    def update_old_list(self, old_contact, contact):
        for i in old_contact:
            if i.id == contact.id:
                i.firstname = contact.firstname
                i.lastname = contact.lastname
        return old_contact
Esempio n. 6
0
#import mysql.connector
import pymysql.cursors
from fixture.db import DbFixture

db = DbFixture(host="127.0.0.1", name="addressbook",
                                     user="******", password="")

try:
    contacts = db.get_contact_list()
    for contact in contacts:
        print(contact)
    print(len(contacts))
finally:
    db.destroy()
Esempio n. 7
0
class AddressBook:

    ROBOT_LIBRARY_SCOPE = 'TEST SUITE'

    def __init__(self, config="target.json", browser='firefox'):
        self.browser = browser
        config_file = os.path.join(os.path.dirname(os.path.abspath(__file__)),
                                   '..', config)
        with open(config_file) as f:
            self.target = json.load(f)

    def init_fixtures(self):
        web_config = self.target['web']
        self.fixture = Application(browser=self.browser,
                                   base_url=web_config['baseUrl'])
        self.fixture.session.ensure_login(username=web_config["username"],
                                          password=web_config["password"])
        db_config = self.target['db']
        self.dbfixture = DbFixture(host=db_config['host'],
                                   name=db_config['name'],
                                   user=db_config['user'],
                                   password=db_config['password'])

    def destroy_fixtures(self):
        self.dbfixture.destroy()
        self.fixture.destroy()

    def new_group(self, name, header, footer):
        return Group(name=name, header=header, footer=footer)

    def get_group_list(self):
        return self.dbfixture.get_group_list()

    def create_group(self, group):
        self.fixture.group.create(group)

    def group_lists_should_be_equal(self, list1, list2):
        assert sorted(list1,
                      key=Group.id_or_max) == sorted(list2,
                                                     key=Group.id_or_max)

    def delete_group(self, group):
        self.fixture.group.delete_group_by_id(group.id)

    def edit_group(self, random_group, edit_group):
        edit_group.id = random_group.id
        self.fixture.group.edit_group_by_id(edit_group.id, edit_group)

    def replace_values_list(self, old_list, index, edit_value):
        old_list[index] = edit_value

    def get_contact_list(self):
        return self.dbfixture.get_contact_list()

    def new_contact(self,
                    firstname='name_123',
                    lastname='name_456',
                    mobile='789'):
        return Contact(firstname=firstname, lastname=lastname, mobile=mobile)

    def create_contact(self, contact):
        self.fixture.contact.create(contact)

    def contact_lists_should_be_equal(self, list1, list2):
        assert sorted(list1,
                      key=Contact.id_or_max) == sorted(list2,
                                                       key=Contact.id_or_max)

    def delete_contact(self, contact):
        self.fixture.contact.delete_contact_by_id(contact.id)

    def edit_contact(self, random_contact, edit_contact):
        edit_contact.id = random_contact.id
        self.fixture.contact.edit_contact_by_id(edit_contact.id, edit_contact)
Esempio n. 8
0
class Addressbook:

    ROBOT_LIBRARY_SCOPE = 'TEST SUITE'

    def __init__(self, config="settings.json", browser="firefox"):
        self.browser = browser
        config_file = os.path.join(os.path.dirname(os.path.abspath(__file__)),
                                   "..", config)
        with open(config_file) as f:
            self.settings = json.load(f)

    def init_fixture(self):
        web_conf = self.settings['web']
        self.fixture = Generic(browser=self.browser,
                               base_url=web_conf["base_url"])
        self.fixture.session.ensure_login(username=web_conf["username"],
                                          password=web_conf["password"])
        db_conf = self.settings["db"]
        self.dbfixture = DbFixture(host=db_conf["host"],
                                   name=db_conf["name"],
                                   user=db_conf["username"],
                                   password=db_conf["password"])

    def finish_fixture(self):
        self.fixture.finish()
        self.dbfixture.finish()

    def get_group_list(self):
        return self.dbfixture.get_group_list()

    def new_group(self, name, header, footer):
        return Group(name=name, header=header, footer=footer)

    def create_group(self, group):
        self.fixture.group.create(group)

    def delete_group(self, group):
        self.fixture.group.del_by_id(group.id)

    def group_lists_should_be_equal(self, list1, list2):
        assert sorted(list1,
                      key=Group.id_or_max) == sorted(list2,
                                                     key=Group.id_or_max)

    def get_contact_list(self):
        return self.dbfixture.get_contact_list()

    def new_contact(self, first_name, last_name, address, home_phone):
        return Contact(first_name=first_name,
                       last_name=last_name,
                       address=address,
                       home_phone=home_phone)

    def create_contact(self, contact):
        self.fixture.contact.create(contact)

    def contact_lists_should_be_equal(self, list1, list2):
        assert sorted(list1,
                      key=Contact.id_or_max) == sorted(list2,
                                                       key=Contact.id_or_max)

    def modify_contact(self, contact, modify_data):
        self.fixture.contact.edit_by_id(contact.id, modify_data)
        modify_data.id = contact.id

    def modify_contact_from_detail(self, contact, modify_data):
        self.fixture.contact.edit_from_details_by_id(contact.id, modify_data)
        modify_data.id = contact.id

    def delete_contact(self, contact):
        self.fixture.contact.del_by_id(contact.id)

    def cancel_delete_contact(self, contact):
        self.fixture.contact.cancel_del_by_id(contact.id)

    def delete_all_contacts(self):
        self.fixture.contact.del_by_select_all()

    def contact_list_should_be_empty(self, list):
        assert [] == list

    def check_contact_exist(self):
        if len(self.dbfixture.get_contact_list()) == 0:
            self.fixture.contact.create(
                Contact(first_name="del_contact", fax="573-092", nickname="1"))
            self.fixture.contact.create(
                Contact(first_name="del_contact", fax="573-092", nickname="2"))
            self.fixture.contact.create(
                Contact(first_name="del_contact", fax="573-092", nickname="3"))
import mysql.connector
from fixture.db import DbFixture

#connection = mysql.connector.connect(host="127.0.0.1", db="addressbook", user="******", password="")
# try:
#     cursor = connection.cursor()
#     cursor.execute("select * from group_list")
#     for row in cursor.fetchall():
#         print(row)
#
# finally:
#     connection.close()

db = DbFixture(host="127.0.0.1", name="addressbook", user="******", password="")

# try:
#     groups = db.get_group_list()
#     for group in groups:
#         print(group)
#     print(len(groups))
# finally:
#     db.destroy()

try:
    contacts = db.get_contact_list()
    for contact in contacts:
        print(contact)
    print(len(contacts))
finally:
    db.destroy()
Esempio n. 10
0
class AddressBook:

    ROBOT_LIBRARY_SCOPE = 'TEST SUITE'

    def __init__(self, config="target.json", browser="chrome"):
        self.browser = browser
        config_file = os.path.join(os.path.dirname(os.path.abspath(__file__)),
                                   "..", config)
        with open(config_file) as f:
            self.target = json.load(f)

    def init_fixtures(self):
        web_config = self.target['web']
        self.fixture = Application(browser=self.browser,
                                   base_url=web_config["baseUrl"])
        self.fixture.session.ensure_login(username=web_config["username"],
                                          password=web_config["password"])
        db_config = self.target['db']
        self.dbfixture = DbFixture(host=db_config['host'],
                                   name=db_config['name'],
                                   user=db_config['user'],
                                   password=db_config['password'])

    def destroy_fixtures(self):
        self.fixture.destroy()
        self.dbfixture.destroy()

    def new_group(self, name, header, footer):
        return Group(name=name, header=header, footer=footer)

    def new_group_for_modify(self, name, header, footer, id):
        return Group(name=name, header=header, footer=footer, id=id)

    def get_group_list(self):
        return self.dbfixture.get_group_list()

    def create_group(self, group):
        self.fixture.group.create(group)

    def delete_group(self, group):
        self.fixture.group.delete_group_by_id(group.id)

    def get_group_id(self, group):
        return group.id

    def get_contact_id(self, contact):
        return contact.id

    def modify_group(self, group1, group2):
        self.fixture.group.modify_group_by_id(group1.id, group2)

    def group_lists_should_be_equal(self, list1, list2):
        assert sorted(list1,
                      key=Group.id_or_max) == sorted(list2,
                                                     key=Group.id_or_max)

    def verify_group_list_is_not_empty(self, list1):
        if len(list1) == 0:
            self.fixture.group.create(Group(name="New_group"))

    def get_contact_list(self):
        return self.dbfixture.get_contact_list()

    def new_contact(self, firstname, lastname, address):
        return Contact(firstname=firstname, lastname=lastname, address=address)

    def new_contact_for_modify(self, firstname, lastname, address, id):
        return Contact(firstname=firstname,
                       lastname=lastname,
                       address=address,
                       id=id)

    def create_contact(self, contact):
        self.fixture.contact.create(contact)

    def verify_contact_list_is_not_empty(self, list1):
        if len(list1) == 0:
            self.fixture.contact.create(
                Contact(firstname="firstname4",
                        lastname="lastname4",
                        address="adress4"))

    def contact_lists_should_be_equal(self, list1, list2):
        assert sorted(list1,
                      key=Contact.id_or_max) == sorted(list2,
                                                       key=Contact.id_or_max)

    def delete_contact(self, contact):
        self.fixture.contact.delete_contact_by_id(contact.id)

    def modify_contact(self, contact1, contact2):
        self.fixture.contact.modify_contact_by_id(contact1.id, contact2)
Esempio n. 11
0
class AddressBook:

    ROBOT_LIBRARY_SCOPE = 'TEST SUITE'

    def __init__(self, config="target.json", browser="chrome"):
        self.browser = browser
        config_file = os.path.join(os.path.dirname(os.path.abspath(__file__)),
                                   "..", config)
        with open(config_file) as f:
            self.target = json.load(f)

    def init_fixtures(self):
        web_config = self.target['web']
        self.fixture = Application(browser=self.browser,
                                   base_url=web_config["baseUrl"])
        self.fixture.session.ensure_login(username=web_config["username"],
                                          password=web_config["password"])
        db_config = self.target['db']
        self.dbFixture = DbFixture(host=db_config["host"],
                                   name=db_config["name"],
                                   user=db_config["user"],
                                   password=db_config["password"])

    def destroy_fixtures(self):
        self.dbFixture.destroy()
        self.fixture.destroy()

    def new_group(self, name, header, footer):
        return Group(name=name, header=header, footer=footer)

    def get_group_list(self):
        return self.dbFixture.get_group_list()

    def create_group(self, group):
        self.fixture.group.create(group)

    def delete_group(self, group):
        self.fixture.group.delete_group_by_id(group.id)

    def group_lists_should_be_equal(self, list1, list2):
        assert sorted(list1,
                      key=Group.id_or_max) == sorted(list2,
                                                     key=Group.id_or_max)

    def new_contact(self, firstname, middlename, lastname, nickname, title,
                    company, address, fax, mobilephone, workphone, homephone,
                    email, email2, email3, homepage, option1, option2, byear,
                    option3, option4, ayear, address2, secondaryphone, notes):
        return Contact(firstname=firstname,
                       middlename=middlename,
                       lastname=lastname,
                       nickname=nickname,
                       title=title,
                       company=company,
                       address=address,
                       fax=fax,
                       mobilephone=mobilephone,
                       workphone=workphone,
                       homephone=homephone,
                       email=email,
                       email2=email2,
                       email3=email3,
                       homepage=homepage,
                       option1=option1,
                       option2=option2,
                       byear=byear,
                       option3=option3,
                       option4=option4,
                       ayear=ayear,
                       address2=address2,
                       secondaryphone=secondaryphone,
                       notes=notes)

    def get_contact_list(self):
        return self.dbFixture.get_contact_list()

    def create_contact(self, contact):
        self.fixture.contact.create(contact)

    def delete_contact(self, contact):
        self.fixture.contact.delete_contact_by_id(contact.id)

    def edit_contact(self, contact, new_contact):
        self.fixture.contact.edit_contact_by_id(contact.id, new_contact)

    def fix_new_contact_id(self, contact, new_contact):
        new_contact.id = contact.id
        return new_contact

    def contact_lists_should_be_equal(self, list1, list2):
        assert sorted(list1,
                      key=Contact.id_or_max) == sorted(list2,
                                                       key=Contact.id_or_max)
Esempio n. 12
0
class AddressBook:

    ROBOT_LIBRARY_SCOPE = 'TEST SUITE'

    def __init__(self, config="target.json", browser="firefox"):
        self.browser = browser
        config_file = os.path.join(os.path.dirname(os.path.abspath(__file__)),
                                   "..", config)
        with open(config_file) as f:
            self.target = json.load(f)

    def init_fixtures(self):
        web_config = self.target['web']
        self.fixture = Application(browser=self.browser,
                                   base_url=web_config["baseUrl"])
        self.fixture.session.ensure_login(username=web_config["username"],
                                          password=web_config["password"])
        db_config = self.target['db']
        self.dbfixture = DbFixture(host=db_config["host"],
                                   name=db_config["name"],
                                   user=db_config["user"],
                                   password=db_config["password"])

    def destroy_fixtures(self):
        self.fixture.destroy()
        self.dbfixture.destroy()

    def new_group(self, name, header, footer):
        return Group(name=name, header=header, footer=footer)

    def new_groupWithID(self, group, name, header, footer):
        return Group(id=group.id, name=name, header=header, footer=footer)

    def get_group_list(self):
        return self.dbfixture.get_group_list()

    def create_group(self, group):
        self.fixture.group.create(group)

    def group_lists_should_be_equal(self, list1, list2):
        assert sorted(list1,
                      key=Group.id_or_max) == sorted(list2,
                                                     key=Group.id_or_max)

    def delete_group(self, group):
        self.fixture.group.delete_group_by_id(group.id)

    def modify_group(self, group):
        self.fixture.group.change_group_by_id(group.id, group)

    def get_contact_list(self):
        return self.dbfixture.get_contact_list()

    def new_contact(self, lastname, firstname, address, email, email2, email3,
                    home_phone, mobile_phone, work_phone, phone2):
        return Contact(lastname=lastname,
                       firstname=firstname,
                       address=address,
                       email=email,
                       email2=email2,
                       email3=email3,
                       home_phone=home_phone,
                       mobile_phone=mobile_phone,
                       work_phone=work_phone,
                       phone2=phone2)

    def new_contactWithID(self, contact, lastname, firstname, address, email,
                          email2, email3, home_phone, mobile_phone, work_phone,
                          phone2):
        return Contact(id=contact.id,
                       lastname=lastname,
                       firstname=firstname,
                       address=address,
                       email=email,
                       email2=email2,
                       email3=email3,
                       home_phone=home_phone,
                       mobile_phone=mobile_phone,
                       work_phone=work_phone,
                       phone2=phone2)

    def create_contact(self, new_contact):
        self.fixture.contact.add_new(new_contact)

    def contact_lists_should_be_equal(self, list1, list2):
        assert sorted(list1,
                      key=Contact.id_or_max) == sorted(list2,
                                                       key=Contact.id_or_max)

    def delete_contact(self, contact):
        self.fixture.contact.delete_contact_by_id(contact.id)

    def modify_contact(self, contact):
        self.fixture.contact.change_contact_by_id(contact.id, contact)