Exemple #1
0
 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"])
Exemple #2
0
def db(request):
    db_config = load_config(request.config.getoption("--target"))['db']
    dbfixture= Dbfixture(host=db_config['host'],name =db_config['name'],user=db_config['user'],password=db_config['password'])
    def fin():
        dbfixture.destroy()
    request.addfinalizer(fin)
    return dbfixture
Exemple #3
0
def db(request):
    db_config = load_config(request.config.getoption("--target"))["db"]
    dbfixture=Dbfixture(host=db_config["host"], name=db_config["name"], user=db_config["user"], password=db_config["password"])
    def fin():
        dbfixture.destroy()
    request.addfinalizer(fin)
    return dbfixture
def db(request):
    db_config = load_config(request.config.getoption('--target'))["db"]
    dbfixture = Dbfixture(host=db_config["host"],
                          database=db_config["database"],
                          user=db_config["user"],
                          password=db_config["password"])

    def final():
        dbfixture.destroy()

    request.addfinalizer(final)
    return dbfixture
Exemple #5
0
def db(request, app, generator):
    global dbfixture

    if dbfixture is None:
        dbfixture = Dbfixture(app, generator)

    def fin():
        dbfixture.destroy()

    request.addfinalizer(fin)

    return dbfixture
__author__ = 'Liudmila'
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()


Exemple #7
0
import pymysql.cursors
from fixture.db import Dbfixture
#from Model.projectmodel import Project

db = Dbfixture(host='127.0.0.1', name='bugtracker', user='******', password='')

try:
    l = db.get_project_list()
    for item in l:
        print(item)
    print(len(l))
finally:
    pass
Exemple #8
0
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()
Exemple #9
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 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 group_list_should_be_equal(self, list1, list2):
        assert sorted(list1,
                      key=Group.id_or_max) == sorted(list2,
                                                     key=Group.id_or_max)

    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_contact_list(self):
        return self.dbfixture.get_contact_list()

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

    def contact_list_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, new_contact):
        self.fixture.contact.modify_contact_by_id(contact.id, new_contact)

    def create_contact(self, contact):
        self.fixture.contact.add_new_contact(contact)
Exemple #10
0
def db(request, config):
    dbfixture = Dbfixture(host=config['db']['host'],name=config['db']['name'],user=config['db']['user'],password = config['db']['password'])
    def fin():
        dbfixture.destroy()
    request.addfinalizer(fin)
    return dbfixture