当前位置: 首页>>代码示例>>Python>>正文


Python Group.id方法代码示例

本文整理汇总了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
开发者ID:nischalhp,项目名称:linkur,代码行数:30,代码来源:userDAO.py

示例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)
开发者ID:marisly,项目名称:python_train,代码行数:27,代码来源:test_edit_group.py

示例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)
开发者ID:alenickwork,项目名称:python_training,代码行数:28,代码来源:test_modify_group.py

示例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)
开发者ID:emalishenko,项目名称:python_training,代码行数:30,代码来源:test_group_modify.py

示例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)
开发者ID:mynameisalexander,项目名称:python_training,代码行数:27,代码来源:test_modify_group.py

示例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)
开发者ID:Alex-Chizhov,项目名称:python_training,代码行数:11,代码来源:test_modify_group.py

示例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)
开发者ID:SvetlanaPopova,项目名称:python_1,代码行数:12,代码来源:test_modify_group.py

示例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)
开发者ID:Manolaru,项目名称:Python_train,代码行数:13,代码来源:test_modify_group.py

示例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)
开发者ID:Dananas732,项目名称:python,代码行数:13,代码来源:test_mod_group.py

示例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)
开发者ID:rata-mahata,项目名称:python-training,代码行数:14,代码来源:test_modify_group.py

示例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)
开发者ID:volkodav1985,项目名称:volkodavpython,代码行数:14,代码来源:test_edit_group.py

示例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)
开发者ID:sorael,项目名称:addressbook,代码行数:14,代码来源:test_edit_group.py

示例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)
开发者ID:YuliyaYaroshuk,项目名称:pythontrain,代码行数:14,代码来源:test_modify_group.py

示例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)
开发者ID:silverlaurelin,项目名称:training,代码行数:14,代码来源:test_modify_group.py

示例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)
开发者ID:denis-nuzhdin,项目名称:test_py,代码行数:14,代码来源:test_edit_group.py


注:本文中的model.group.Group.id方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。