本文整理汇总了Python中tests.run.Session.flush方法的典型用法代码示例。如果您正苦于以下问题:Python Session.flush方法的具体用法?Python Session.flush怎么用?Python Session.flush使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tests.run.Session
的用法示例。
在下文中一共展示了Session.flush方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUpClass
# 需要导入模块: from tests.run import Session [as 别名]
# 或者: from tests.run.Session import flush [as 别名]
def setUpClass(cls):
session = Session()
cls.u1 = TrUser("2013-12-12 12:12:12", "u1", "testtest")
user_list = [cls.u1]
cls.user_count = len(user_list)
session.add_all(user_list)
session.flush()
session.refresh(cls.u1)
session.commit()
cls.d1 = TrDevice("d1", cls.u1.ID)
cls.d2 = TrDevice("d2", cls.u1.ID)
cls.d3 = TrDevice("d3", cls.u1.ID)
device_list = [cls.d1, cls.d2, cls.d3]
cls.device_count = len(device_list)
session.add_all(device_list)
session.commit()
cls.l1 = TrDLocation("55.123,54.332", "2013-12-12 12:12:12", cls.d1.device_ID)
cls.l2 = TrDLocation("33.123,33.332", "2013-12-12 11:11:11", cls.d2.device_ID)
cls.l3 = TrDLocation("44.123,44.332", "2013-10-10 10:10:10", cls.d2.device_ID)
location_list = [cls.l1, cls.l2, cls.l3]
cls.location_count = len(location_list)
session.add_all(device_list)
session.commit()
session.close()
示例2: setUpClass
# 需要导入模块: from tests.run import Session [as 别名]
# 或者: from tests.run.Session import flush [as 别名]
def setUpClass(cls):
session = Session()
cls.u1 = TrUser(login="11111", type="phone", auth_code="1111", authenticated=True)
cls.u2 = TrUser(login="22222", type="phone", auth_code="2222", authenticated=True)
cls.u3 = TrUser(login="33333", type="phone", auth_code="3333", authenticated=True)
cls.u4 = TrUser(login="44444", type="phone", auth_code="4444", authenticated=True)
u_list = [cls.u1, cls.u2, cls.u3, cls.u4]
cls.user_count = len(u_list)
session.add_all(u_list)
session.flush()
session.refresh(cls.u1)
session.refresh(cls.u2)
session.refresh(cls.u3)
session.refresh(cls.u4)
session.commit()
cls.g1 = TrGroup(user_id=cls.u1.id, title="g1")
cls.g2 = TrGroup(user_id=cls.u1.id, title="g2")
g_list = [cls.g1, cls.g2]
cls.group_count = len(g_list)
session.add_all(g_list)
session.commit()
# Add users to groups
cls.g1.users.append(cls.u3)
cls.g1.users.append(cls.u4)
session.add(cls.g1)
session.commit()
session.close()
示例3: setUpClass
# 需要导入模块: from tests.run import Session [as 别名]
# 或者: from tests.run.Session import flush [as 别名]
def setUpClass(cls):
session = Session()
cls.u1 = TrUser("2013-12-12 12:12:12", "u1", "testtest")
cls.u2 = TrUser("2013-12-12 12:12:12", "u2", "testtest1")
user_list = [cls.u1, cls.u2]
cls.user_count = len(user_list)
session.add_all(user_list)
session.flush()
session.refresh(cls.u1)
session.refresh(cls.u2)
session.commit()
cls.d1 = TrDevice("d1", cls.u1.ID)
cls.d2 = TrDevice("d2", cls.u2.ID)
device_list = [cls.d1, cls.d2]
cls.device_count = len(device_list)
session.add_all(device_list)
session.commit()
cls.g1 = TrDGeozone("g1", cls.d1.device_ID)
cls.g2 = TrDGeozone("g2", cls.d2.device_ID)
geo_list = [cls.g1, cls.g2]
cls.geo_count = len(geo_list)
session.add_all(geo_list)
session.commit()
session.close()
示例4: setUpClass
# 需要导入模块: from tests.run import Session [as 别名]
# 或者: from tests.run.Session import flush [as 别名]
def setUpClass(cls):
session = Session()
cls.u1 = TrUser("2013-12-12 12:12:12", "u1", "testtest")
user_list = [cls.u1]
cls.user_count = len(user_list)
session.add_all(user_list)
session.flush()
session.refresh(cls.u1)
session.commit()
cls.v1 = TrVehicle("v1", cls.u1.ID, car_model_id=111)
cls.v2 = TrVehicle("v2", cls.u1.ID, car_model_id=222)
v_list = [cls.v1, cls.v2]
cls.v_count = len(v_list)
session.add_all(v_list)
session.commit()
cls.m1 = TrHelp("Message1", "54.55,55.123", cls.v1.id)
message_list = [cls.m1]
cls.message_count = len(message_list)
session.add_all(message_list)
session.commit()
session.close()
示例5: setUpClass
# 需要导入模块: from tests.run import Session [as 别名]
# 或者: from tests.run.Session import flush [as 别名]
def setUpClass(cls):
session = Session()
cls.u1 = TrUser(login="11111", type="phone", auth_code="1111", authenticated=True)
cls.u2 = TrUser(login="22222", type="phone", auth_code="2222", authenticated=True)
cls.u3 = TrUser(login="33333", type="phone", auth_code="3333", authenticated=True)
user_list = [cls.u1, cls.u2, cls.u3]
cls.user_count = len(user_list)
session.add_all(user_list)
session.flush()
session.refresh(cls.u1)
session.refresh(cls.u2)
session.commit()
cls.p1 = TrPlace(title="Title1", latitude=54.123, longitude=35.123, type="Restaurant", user_id=cls.u1.id)
cls.p2 = TrPlace(title="Title2", latitude=54.123, longitude=35.123, type="Parking", user_id=cls.u2.id)
cls.p3 = TrPlace(title=u'Заголовок3', latitude=54.123, longitude=35.123, type="Caffe", user_id=cls.u2.id)
p_list = [cls.p1, cls.p2, cls.p3]
cls.p_count = len(p_list)
session.add_all(p_list)
session.commit()
session.close()
示例6: setUpClass
# 需要导入模块: from tests.run import Session [as 别名]
# 或者: from tests.run.Session import flush [as 别名]
def setUpClass(cls):
session = Session()
cls.u1 = TrUser(login="11111", type="phone", auth_code="1111", authenticated=True)
cls.u2 = TrUser(login="22222", type="phone", auth_code="2222", authenticated=True)
cls.u3 = TrUser(login="33333", type="phone", auth_code="3333", authenticated=True)
u_list = [cls.u1, cls.u2, cls.u3]
cls.user_count = len(u_list)
session.add_all(u_list)
session.flush()
session.refresh(cls.u1)
session.refresh(cls.u2)
session.commit()
cls.v1 = TrVehicle("v1", cls.u1.id, car_model_id=111, year=1991)
cls.v2 = TrVehicle("v2", cls.u2.id, car_model_id=111, year=1991)
cls.v3 = TrVehicle("v3", cls.u2.id, car_model_id=111, year=1991)
v_list = [cls.v1, cls.v2, cls.v3]
cls.v_count = len(v_list)
session.add_all(v_list)
session.commit()
cls.d1 = TrDevice(sn='EW-14100001-UT', imei_number='1234', accel_stat=True, time_interval=1, phone1="+79260000001", vehicle_id=cls.v1.id)
cls.d2 = TrDevice(sn='EW-14100002-UT', imei_number='5678', accel_stat=True, time_interval=2, phone1="+79260000002", vehicle_id=cls.v2.id)
cls.d3 = TrDevice(sn='EW-14100003-UT', imei_number='9012', accel_stat=True, time_interval=3, phone1="+79260000003", vehicle_id=None)
cls.d4 = TrDevice(sn='EW-14100004-UT', imei_number='3456', accel_stat=True, time_interval=4, phone1="+79260000003", vehicle_id=None)
d_list = [cls.d1, cls.d2, cls.d3, cls.d4]
cls.device_count = len(d_list)
session.add_all(d_list)
session.commit()
session.close()
示例7: setUpClass
# 需要导入模块: from tests.run import Session [as 别名]
# 或者: from tests.run.Session import flush [as 别名]
def setUpClass(cls):
session = Session()
cls.u1 = TrUser(login="11111", type="phone", auth_code="1111", authenticated=True)
session.add(cls.u1)
session.flush()
session.refresh(cls.u1)
session.commit()
session.close()
示例8: setUpClass
# 需要导入模块: from tests.run import Session [as 别名]
# 或者: from tests.run.Session import flush [as 别名]
def setUpClass(cls):
session = Session()
cls.u1 = TrUser("2013-12-12 12:12:12", "u1", "testtest")
user_list = [cls.u1]
cls.user_count = len(user_list)
session.add_all(user_list)
session.flush()
session.refresh(cls.u1)
session.commit()
session.close()