本文整理汇总了Python中model.group.Group.id方法的典型用法代码示例。如果您正苦于以下问题:Python Group.id方法的具体用法?Python Group.id怎么用?Python Group.id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model.group.Group
的用法示例。
在下文中一共展示了Group.id方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_groups
# 需要导入模块: from model.group import Group [as 别名]
# 或者: from model.group.Group import id [as 别名]
def get_groups(self, uname):
# get all groups for this user
group = None
user_groups = None
try:
collection = self.user_collection
user_groups = collection.find_one({'_id':uname},{"groups":True})
except Exception as inst:
print "error reading groups"
print inst
if user_groups != None:
group_cursor = user_groups["groups"]
groups = []
for item in group_cursor:
print item
group = Group()
group.id = str(item["_id"])
group.name = item["name"]
group.hash = item["hash"]
groups.append(group)
return groups
else:
return None
示例2: test_edit_group_name
# 需要导入模块: from model.group import Group [as 别名]
# 或者: from model.group.Group import id [as 别名]
def test_edit_group_name(app):
if app.group.count() == 0:
app.group.create(Group(name="test", header="test", footer="test"))
old_groups = app.group.get_group_list()
index = randrange(len(old_groups))
group = Group(name="new")
group.id = old_groups[index].id
app.group.edit_group_by_index(index, group)
new_groups = app.group.get_group_list()
assert len(old_groups) == len(new_groups)
old_groups[index]=group
assert sorted(old_groups, key=Group.id_or_max) == sorted(new_groups, key=Group.id_or_max)
#def test_edit_group_header(app):
# if app.group.count() == 0:
# app.group.create(Group(name="test", header="test", footer="test"))
# old_groups = app.group.get_group_list()
# group = Group(header="new")
# group.id = old_groups[0].id
# app.group.edit_first_group(group)
# new_groups = app.group.get_group_list()
# assert len(old_groups) == len(new_groups)
# old_groups[0]=group
# assert sorted(old_groups, key=Group.id_or_max) == sorted(new_groups, key=Group.id_or_max)
示例3: test_modify_group
# 需要导入模块: from model.group import Group [as 别名]
# 或者: from model.group.Group import id [as 别名]
def test_modify_group(app, db, check_ui):
if len(db.get_group_list()) == 0:
test_group = Group()
test_group.dummy()
app.group.create(test_group)
old_groups = db.get_group_list()
group = random.choice(old_groups)
test_group_new = Group(name = "random")
test_group_new.id = group.id
app.group.modify_by_id(group.id, test_group_new)
new_groups = db.get_group_list()
assert len(old_groups) == len(new_groups)
old_groups[old_groups.index(group)] = test_group_new
assert old_groups == new_groups
if check_ui:
assert sorted(map(clean, new_groups), key = Group.id_or_max) == \
sorted(app.group.get_group_list(), key = Group.id_or_max)
示例4: test_modify_group_name
# 需要导入模块: from model.group import Group [as 别名]
# 或者: from model.group.Group import id [as 别名]
def test_modify_group_name(app):
group = Group(name="To be modified")
if app.group.count() == 0:
app.group.create(Group(name="New group name"))
old_groups = app.group.get_group_list()
index = randrange(len(old_groups))
group.id = old_groups[index].id
app.group.modify_group_by_index(group, index)
assert len(old_groups) == app.group.count()
new_groups = app.group.get_group_list()
old_groups[index] = group
assert sorted(old_groups, key = Group.id_or_max) == sorted(new_groups, key = Group.id_or_max)
# def test_modify_group_header(app):
# if app.group.count() == 0:
# app.group.create(Group(header="To be modified"))
# app.group.modify_first_group(Group(header="New group header"))
# old_groups = app.group.get_group_list()
# new_groups = app.group.get_group_list()
# assert len(old_groups) == len(new_groups)
#
# def test_modify_group_footer(app):
# if app.group.count() == 0:
# app.group.create(Group(footer="To be modified"))
# app.group.modify_first_group(Group(footer="New group footer"))
# old_groups = app.group.get_group_list()
# new_groups = app.group.get_group_list()
# assert len(old_groups) == len(new_groups)
示例5: test_modify_some_group
# 需要导入模块: from model.group import Group [as 别名]
# 或者: from model.group.Group import id [as 别名]
def test_modify_some_group(app, db, check_ui):
if len(db.get_group_list()) == 0:
app.group.create(Group(name='test'))
old_groups = db.get_group_list()
random_group = random.choice(old_groups)
group = Group(name="update")
group.id = random_group.id
app.group.modify_group_by_id(group)
new_groups = db.get_group_list()
assert len(old_groups) == len(new_groups)
i = 0
for x in old_groups:
if x.id == random_group.id:
old_groups[i] = group
i += 1
assert old_groups == new_groups
if check_ui:
assert sorted(new_groups, key=Group.id_or_max) == sorted(app.group.get_group_list(), key=Group.id_or_max)
#def test_modify_group_header(app):
# old_groups = app.group.get_group_list()
# app.group.modify_first_group(Group(header="update"))
# new_groups = app.group.get_group_list()
# assert len(old_groups) == len(new_groups)
示例6: test_modify_gname
# 需要导入模块: from model.group import Group [as 别名]
# 或者: from model.group.Group import id [as 别名]
def test_modify_gname(app):
old_groups = app.group.get_group_list()
group = Group(name= 'New Group')
group.id = old_groups[0].id
app.group.modify_first_group(group)
new_groups = app.group.get_group_list()
assert len(old_groups) == len(new_groups)
old_groups[0]= group
assert sorted(old_groups,key=Group.id_or_max) == sorted(new_groups,key=Group.id_or_max)
示例7: test_modify_group_name
# 需要导入模块: from model.group import Group [as 别名]
# 或者: from model.group.Group import id [as 别名]
def test_modify_group_name(app, db, check_ui):
if app.group.count() == 0:
app.group.create(Group(name="TestGroupName"))
old_groups = db.get_group_list()
old_group = random.choice(old_groups)
group = Group(name="ModifyGroup")
group.id = old_group.id
old_groups.remove(old_group)
app.group.modify_group_by_id(group)
app.group.check_add_or_modify_success(db, group, old_groups, check_ui)
示例8: test_modify_group_name
# 需要导入模块: from model.group import Group [as 别名]
# 或者: from model.group.Group import id [as 别名]
def test_modify_group_name(app):
if app.group.count() == 0:
app.group.create(Group(name="testing"))
old_groups = app.group.get_group_list()
group = Group (name= "NewGroup")
group.id = old_groups[0].id
app.group.modify_first_group(group)
new_groups = app.group.get_group_list()
assert len(old_groups) == len (new_groups)
old_groups[0]=group
assert sorted(old_groups,key=Group.id_or_max) == sorted(new_groups,key=Group.id_or_max)
示例9: test_modify_group_name
# 需要导入模块: from model.group import Group [as 别名]
# 或者: from model.group.Group import id [as 别名]
def test_modify_group_name(app, orm):
check_for_group(app)
old_groups = orm.get_group_list()
group = random.choice(old_groups)
gr_obj = Group(name="popopo")
gr_obj.id = group.id
old_groups.remove(group)
old_groups.append(gr_obj)
app.group.modify_by_id(gr_obj)
new_groups = orm.get_group_list()
assert sorted(old_groups, key=Group.id_or_max) == sorted(new_groups, key=Group.id_or_max)
示例10: test_modify_group_by_index
# 需要导入模块: from model.group import Group [as 别名]
# 或者: from model.group.Group import id [as 别名]
def test_modify_group_by_index(app):
old_groups = app.group.get_group_list()
index = randrange(len(old_groups))
group = Group(name="test group")
group.id = old_groups[index].id
if app.group.count()== 0:
app.group.create(Group(name="test group"))
app.group.modify_group_by_index(index, group)
new_groups = app.group.get_group_list()
assert len(old_groups) == len(new_groups)
old_groups[index] = group
assert sorted(old_groups, key=Group.id_or_max)== sorted (new_groups, key=Group.id_or_max)
示例11: test_edit_group
# 需要导入模块: from model.group import Group [as 别名]
# 或者: from model.group.Group import id [as 别名]
def test_edit_group(app):
if app.group.count() == 0:
app.group.create(Group(name="test"))
old_groups = app.group.get_group_list()
index = randrange(len(old_groups))
group=Group(name="aaaaa", header="kkk", footer="ccc")
group.id = old_groups[index].id
app.group.edit_group_by_index(index, group)
new_groups = app.group.get_group_list()
assert len(old_groups) == len(new_groups)
old_groups[index] =group
assert sorted(old_groups, key=Group.id_or_max) == sorted(new_groups, key=Group.id_or_max)
示例12: test_edit_group_name
# 需要导入模块: from model.group import Group [as 别名]
# 或者: from model.group.Group import id [as 别名]
def test_edit_group_name(gen):
if gen.group.count() == 0:
gen.group.create(Group(name="test"))
old_groups = gen.group.get_group_list()
index = randrange(len(old_groups))
group = Group(name="New name")
group.id = old_groups[index].id
gen.group.edit_group_by_index(index, group)
assert len(old_groups) == gen.group.count()
new_groups = gen.group.get_group_list()
old_groups[index] = group
assert sorted(old_groups, key=Group.id_or_max) == sorted(new_groups, key=Group.id_or_max)
示例13: test_mod_some_group_name
# 需要导入模块: from model.group import Group [as 别名]
# 或者: from model.group.Group import id [as 别名]
def test_mod_some_group_name(app):
if app.group.count() == 0:
app.group.create(Group(name="test"))
old_groups = app.group.get_group_list()
index = randrange(len(old_groups))
group = Group(name="new group")
group.id = old_groups[index].id
app.group.modify_group_by(group,index)
new_groups = app.group.get_group_list()
assert len(old_groups) == app.group.count()
old_groups[index] = group
assert sorted(old_groups, key=Group.id_or_max) == sorted(new_groups, key=Group.id_or_max)
示例14: test_modify_group_name
# 需要导入模块: from model.group import Group [as 别名]
# 或者: from model.group.Group import id [as 别名]
def test_modify_group_name(app):
if app.group.count() == 0:
app.group.create(Group(name="some name", header="some logo", footer="some footer"))
old_groups = app.group.get_groups_list()
index = randrange(len(old_groups))
group = Group(name="new name")
group.id = old_groups[index].id
app.group.modify_group_by_index(index, group)
new_groups = app.group.get_groups_list()
assert len(old_groups) == len(new_groups)
old_groups[index] = group
assert sorted(old_groups, key=Group.id_or_max) == sorted(new_groups, key=Group.id_or_max)
示例15: test_edit_some_group_name
# 需要导入模块: from model.group import Group [as 别名]
# 或者: from model.group.Group import id [as 别名]
def test_edit_some_group_name(app):
if app.group.count() ==0:
app.group.create(Group(gr_name="for edit group"))
old_groups = app.group.get_group_list()
index = randrange(len(old_groups))
group = Group(gr_name="edit_test111111")
group.id = old_groups[index].id
app.group.edit_group_by_index(index, group)
new_groups = app.group.get_group_list()
assert len(old_groups) == len(new_groups)
old_groups[index] = group
assert sorted(old_groups, key=Group.id_or_max) == sorted(new_groups, key=Group.id_or_max)