def test_modify_group_header(app):
    if app.group.count() == 0:
        app.group.create(GroupParams(name = 'nnn', header = 'www', footer= 'sss'))
    old_groups = app.group.get_group_list()
    app.group.modify_firstgroup(GroupParams(header='New Header'))
    new_groups = app.group.get_group_list()
    assert len(old_groups) == len(new_groups)
def test_modify_group_name(app):
    if app.group.count() == 0:
        app.group.create(GroupParams(name = 'nnn', header = 'www', footer= 'sss'))
    old_groups = app.group.get_group_list()
    index = randrange(len(old_groups))
    group = GroupParams(name='New group')
    group.id = old_groups[index].id
    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=GroupParams.id_or_max) == sorted(new_groups, key=GroupParams.id_or_max)
Exemple #3
0
def test_delete_first_group(app):
    if app.group.count() == 0:
        app.group.create(GroupParams(name='nnn', header='www', footer='sss'))
    old_groups = app.group.get_group_list()
    app.group.delete_first_group()
    new_groups = app.group.get_group_list()
    assert len(old_groups) - 1 == len(new_groups)
    del old_groups[0:1]
    assert old_groups == new_groups
Exemple #4
0
def test_add_empty_group(app):
    old_groups = app.group.get_group_list()
    group = GroupParams(name="", header="", footer="")
    app.group.create(group)
    new_groups = app.group.get_group_list()
    assert len(old_groups) + 1 == len(new_groups)
    old_groups.append(group)
    assert sorted(old_groups, key=GroupParams.id_or_max) == sorted(
        new_groups, key=GroupParams.id_or_max)
Exemple #5
0
def test_delete_some_group(app):
    if app.group.count() == 0:
        app.group.create(GroupParams(name='nnn', header='www', footer='sss'))
    old_groups = app.group.get_group_list()
    index = randrange(len(old_groups))
    app.group.delete_group_by_index(index)
    new_groups = app.group.get_group_list()
    assert len(old_groups) - 1 == len(new_groups)
    del old_groups[index:index + 1]
    assert old_groups == new_groups
Exemple #6
0
def test_add_group(app):
    old_groups = app.group.get_group_list()
    group = GroupParams(name="111", header="22222222", footer="222")
    app.group.create(group)
    assert len(old_groups) + 1 == app.group.count()
    new_groups = app.group.get_group_list()
    app.session.logout()
    old_groups.append(group)
    assert sorted(old_groups, key=GroupParams.id_or_max) == sorted(
        new_groups, key=GroupParams.id_or_max)
    def get_group_list(self):
        if self.group_cache is None:
            wd = self.app.wd
            self.open_group_page()
            self.group_cache = []
            for element in wd.find_elements_by_css_selector('span.group'):
                text = element.text
                id = element.find_element_by_name('selected[]').get_attribute(
                    'value')
                self.group_cache.append(GroupParams(name=text, id=id))

        return list(self.group_cache)
Exemple #8
0
def test_delete_all_groups(app):
    if app.group.count() == 0:
        app.group.create(GroupParams(name='nnn', header='www', footer='sss'))
    app.group.delete_all_groups()