コード例 #1
0
ファイル: test_group.py プロジェクト: werbk/task-6.19
def test_edit_group(app):
    """Validation of correct edit group (all field updated)"""

    app.group.validation_of_group_exist()
    old_groups = app.group.get_group_list()
    index = randrange(len(old_groups))

    group = Group(group_name=Profinity.long_word_20, group_header=Profinity.long_word_20,
                  group_footer=Profinity.long_word_20)
    group.id = old_groups[index].id
    app.group.edit_group_by_index(group, index)

    assert len(old_groups) == app.group.count(), 'Group list changed'

    new_groups = app.group.get_group_list()
    app.group.delete_first_group()
    old_groups[index] = group
    assert sorted(old_groups, key=Group.if_or_max) == sorted(new_groups, key=Group.if_or_max), 'Group list is different'
コード例 #2
0
ファイル: test_group.py プロジェクト: werbk/task-6.18
def test_edit_group(app):
    """Validation of correct edit group (all field updated)"""

    app.group.validation_of_group_exist()
    old_groups = app.group.get_group_list()
    index = randrange(len(old_groups))

    group = Group(group_name=Profinity.long_word_20,
                  group_header=Profinity.long_word_20,
                  group_footer=Profinity.long_word_20)
    group.id = old_groups[index].id
    app.group.edit_group_by_index(group, index)

    assert len(old_groups) == app.group.count(), 'Group list changed'

    new_groups = app.group.get_group_list()
    app.group.delete_first_group()
    old_groups[index] = group
    assert sorted(old_groups, key=Group.if_or_max) == sorted(
        new_groups, key=Group.if_or_max), 'Group list is different'
コード例 #3
0
ファイル: test_group.py プロジェクト: werbk/task-7.20
def test_edit_group(app, db, check_ui):
    """Validation of correct edit group (all field updated)"""

    app.group.validation_of_group_exist()
    old_groups = db.get_group_list()


    group = random.choice(old_groups)
    group_id = group.id

    group = Group(group_name=Profinity.long_word_20, group_header=Profinity.long_word_20,
                  group_footer=Profinity.long_word_20)
    group.id=group_id

    app.group.edit_group_by_id(group, group_id)

    new_groups = db.get_group_list()
    #app.group.delete_first_group()
    old_groups.remove(group)
    old_groups.append(group)
    validate_group_list(app, new_groups, old_groups, check_ui)
コード例 #4
0
    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(Group(group_name=text, id=id))

        return list(self.group_cache)
コード例 #5
0
ファイル: add_group.py プロジェクト: werbk/task-6.18
from fixture.TestBase import random_string

from tests_group.group_helper import Group

constant = [
    Group(group_name='name1', group_header='header1', group_footer='footer1'),
    Group(group_name='name1', group_header='header1', group_footer='footer1')
]

test_data = [
    Group(group_name=name, group_header=header, group_footer=footer)
    for name in ['', random_string('name', 10)]
    for header in ['', random_string('header', 20)]
    for footer in ['', random_string('footer', 20)]
]
コード例 #6
0
ファイル: group.py プロジェクト: werbk/task-6.19
    sys.exit(2)

n = 5
f = 'data/groups.json'

for o, a in opts:
    if o == "-n":
        n = int(a)
    elif o == "-f":
        f = str(a)
'''def random_string(prefix, maxlen):
    symbols = string.ascii_letters + string.digits + ' ' #+ string.punctuation
    return prefix + ''.join([random.choice(symbols) for i in range(random.randrange(maxlen))])'''
'''
test_data = [
    Group(group_name=name, group_header=header, group_footer=footer)
    for name in ['', random_string('name', 10)]
    for header in ['', random_string('header', 20)]
    for footer in ['', random_string('footer', 20)]]'''

test_data = [Group(group_name='', group_header='', group_footer='')] + [
    Group(group_name=random_string('name', 10),
          group_header=random_string('header', 10),
          group_footer=random_string('footer', 10)) for i in range(n)
]

file = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", f)

with open(file, 'w') as out:
    jsonpickle.set_encoder_options("json", indent=2)
    out.write(jsonpickle.encode(test_data))
コード例 #7
0
 def validation_of_group_exist(self):
     if self.count() == 0:
         self.create(Group(group_name='test'))
         self.click_group_page()