text: # -*- coding: utf-8 -*-
  __author__ = 'Администратор'
  
  from model.group import Group
  import random
  
  #def test_modify_group_name_empty(app):
   #   if app.group.count == 0:
    #      app.group.create(Group(name=""))
     # old_groups = app.group.get_group_list()
      #app.group.modify_first_group(Group(name = "New group"))
      #new_groups = app.group.get_group_list()
      #assert len(old_groups) + 1 == len(new_groups)
  
  def test_modify_group_name(app, db, check_ui):
      if len(db.get_group_list()) == 0:
          app.group.create(Group(name="Last name"))
      old_groups = db.get_group_list()
      group = random.choice(old_groups)
      app.group.select_group_by_id(group.id)
      group_new = Group(name = "New group")
      group_new.id = group.id
      app.group.modify_group_by_id(group_new.id, group_new)
      new_groups = db.get_group_list()
      assert len(old_groups) == len(new_groups)
      old_groups.remove(group)
      old_groups.append(group_new)
      assert sorted(old_groups, key = Group.id_or_max) == sorted(new_groups, key = Group.id_or_max)
      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_empty(app):
   #   if app.group.count == 0:
    #      app.group.create(Group(header=""))
     # old_groups = app.group.get_group_list()
      #app.group.modify_first_group(Group(header = "New header"))
      #new_groups = app.group.get_group_list()
      #assert len(old_groups) == len(new_groups)
  
  #def test_modify_group_header(app):
   #   if app.group.count == 0:
    #      app.group.create(Group(header="Last header"))
     # old_groups = app.group.get_group_list()
      #app.group.modify_first_group(Group(header = "New header"))
      #new_groups = app.group.get_group_list()
      #assert len(old_groups) == len(new_groups)
  
  #def test_modify_group_footer_empty(app):
   #   if app.group.count == 0:
    #      app.group.create(Group(footer=""))
     # old_groups = app.group.get_group_list()
      #app.group.modify_first_group(Group(footer = "New footer"))
      #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="Last header"))
     # old_groups = app.group.get_group_list()
      #app.group.modify_first_group(Group(footer = "New footer"))
      #new_groups = app.group.get_group_list()
      #assert len(old_groups) == len(new_groups)