def orm(request): orm_config = load_config(request.config.getoption("--target"))['orm'] ormfixture = ORMfixture(host=orm_config['host'], name=orm_config['name'], user=orm_config['user'], password=orm_config['password']) return ormfixture
from model.group import Group from fixture.orm import ORMfixture from model.contact_class import Contact import random dbs = ORMfixture(host="127.0.0.1", name="addressbook", user="******", password="") def test_add_to_group(app, db): if len(db.get_group_list()) == 0: app.group.create( Group(name="Group1", header="Group1_Header", footer="Group1_Footer")) elif len(db.get_contact_list()) == 0: app.contact.create( Contact(firstname="Александр", middlename="Владимирович", lastname="Смоляк", nickname="Crucis", title="Новый контакт", company="Новая компания", address="Адрес компании", home_phone="+7(812)999-99-99", mobile_phone="+7(911)923-00-99", work_phone="+7(812)777-77-77", email="*****@*****.**", homepage="http://site.ru/", option_day_birthday=
import mysql.connector from fixture.orm import ORMfixture from model.group import Group db = ORMfixture(host="127.0.0.1", name="addressbook", user="******", password="") try: l = db.get_contacts_not_in_group(Group(id="290")) for item in l: print(item) print(len(l)) finally: pass # db.destroy()
import pymysql.cursors # from fixture.db import DbFixture from fixture.orm import ORMfixture from model.group import Group db = ORMfixture(host="127.0.0.1", name="addressbook", user="******", password="") # connection = pymysql.connect(host="127.0.0.1", database="addressbook", user="******", password="") try: l = db.get_list_of_groups_with_contacts() for item in l: print(item) print(len((l))) finally: pass # db.destroy() # connection = pymysql.connect(host="127.0.0.1", database="addressbook", user="******", password="") # try: # cursor = connection.cursor() # cursor.execute("select * from group_list") # for row in cursor.fetchall(): # print(row) # finally: # connection.close()
import pymysql.connections from fixture.orm import ORMfixture from model.group import Group db = ORMfixture(host="127.0.0.1", name="addressbook", user="******", password="") #connection = pymysql.connect(host="127.0.0.1", database="addressbook", user="******", password="") try: cont = db.get_numbers_in_group(Group(id="144")) for con in cont: print(con) print(len(cont)) # cursor = connection.cursor() # cursor.execute("select 'May' from month_lookup") # for row in cursor.fetchall(): # print(row) finally: pass
from fixture.orm import ORMfixture from model.group import Group db = ORMfixture(host="127.0.0.1", name="addressbook", user="******", password="") try: l = db.get_contacts_in_group(Group(id="21")) for item in l: print(item) print(len(l)) finally: pass # db.destroy()
def orm(request): db_config = load_config(request.config.getoption("--target"))['db'] dbfixtureorm = ORMfixture(host=db_config['host'], name=db_config['name'], user=db_config['user'], password=db_config['password']) return dbfixtureorm