diff --git a/tests/ceo/cli/test_groups.py b/tests/ceo/cli/test_groups.py index 50c4931..b4231d5 100644 --- a/tests/ceo/cli/test_groups.py +++ b/tests/ceo/cli/test_groups.py @@ -77,6 +77,46 @@ def test_groups(cli_setup, ldap_user): result = runner.invoke(cli, ['groups', 'delete', 'test_group_1'], input='y\n') assert result.exit_code == 0 + group_names = [ + "touch", + "error", + "happy", + "moon", + "decisive", + "exciting", + "super", + "ambitious", + "acidic", + "addition", + "blue-eyed", + "grate", + "replace", + "natural", + "explode", + "decorous", + "wide", + "hang", + "tomatoes", + "thirsty", + ] + runner = CliRunner() + for name in group_names: + result = runner.invoke(cli, [ + 'groups', 'add', name, '-d', 'searchable group', + ], input='y\n') + assert result.exit_code == 0 + + for name in group_names: + result = runner.invoke(cli, ['groups', 'search', '--count=1', name]) + assert result.exit_code == 0 + assert result.output.find(name) != -1 + + for name in group_names: + result = runner.invoke(cli, [ + 'groups', 'removemember', name, ldap_user.uid, + ], input='y\n') + assert result.exit_code == 0 + def create_group(group_name, desc): runner = CliRunner() diff --git a/tests/ceod/api/test_groups.py b/tests/ceod/api/test_groups.py index 38d79f9..3709b19 100644 --- a/tests/ceod/api/test_groups.py +++ b/tests/ceod/api/test_groups.py @@ -113,28 +113,158 @@ def test_api_add_member_to_group(client, create_group_result, ldap_user): @pytest.fixture(scope='module') def create_random_names(): - # 20 random names generated using this website: https://randomwordgenerator.com/ + # 150 random names generated with https://www.randomlists.com/random-words random_names = [ - "inspiration", - "at", - "pneumonia", - "vision", - "infrastructure", - "ceremony", - "plastic", - "ambition", - "brain", - "iron", - "world", - "overlook", - "pledge", - "discreet", - "glide", - "brilliance", - "meet", - "hobby", - "applaud", - "frighten", + "intelligent", + "skin", + "shivering", + "hapless", + "abstracted", + "kiss", + "decision", + "van", + "advise", + "parcel", + "disillusioned", + "print", + "skate", + "robin", + "explode", + "fearless", + "feeling", + "chemical", + "identify", + "baseball", + "room", + "contain", + "smooth", + "play", + "fierce", + "north", + "secretive", + "plug", + "rely", + "home", + "push", + "guard", + "allow", + "depressed", + "evasive", + "slap", + "delicate", + "concern", + "consider", + "fang", + "roll", + "bait", + "rabbits", + "guarded", + "abnormal", + "loutish", + "voracious", + "chase", + "army", + "harsh", + "grieving", + "tacky", + "far", + "wise", + "street", + "price", + "bikes", + "post", + "afternoon", + "deranged", + "cart", + "evanescent", + "shrill", + "uppity", + "adhoc ", + "alleged", + "round", + "smart", + "support", + "plantation", + "flap", + "pretty", + "radiate", + "excite", + "memorize", + "whisper", + "thoughtless", + "substantial", + "upset", + "pathetic", + "flow", + "shake", + "wail", + "share", + "songs", + "scream", + "aspiring", + "overwrought", + "mass", + "romantic", + "deliver", + "anxious", + "laborer", + "angry", + "faded", + "wish", + "homeless", + "salty", + "start", + "crooked", + "tremble", + "enjoy", + "chivalrous", + "useless", + "womanly", + "brake", + "wandering", + "please", + "cow", + "reason", + "expert", + "null", + "basket", + "early", + "river", + "prevent", + "sticks", + "vacation", + "eggnog", + "receive", + "memory", + "exchange", + "burly", + "agreement", + "flock", + "subdued", + "clap", + "simplistic", + "tiger", + "responsible", + "knock", + "camera", + "nifty", + "capable", + "disappear", + "afterthought", + "obese", + "harass", + "delicious", + "badge", + "dam", + "plate", + "acrid", + "voiceless", + "mate", + "juice", + "food", + "town", + "giraffe", + "decorate" ] yield random_names @@ -154,11 +284,26 @@ def create_searchable_groups(client, create_random_names): def test_api_group_search(client, create_searchable_groups): cns = create_searchable_groups - for i, cn in enumerate(cns): - status, data = client.get(f'/api/groups/search/{cn}/{i + 1}') + # pairs of cn indices as well as amount of results that should be returned + random_numbers = [ + (88, 68), + (117, 54), + (63, 97), + (64, 19), + (114, 98), + (45, 146), + (58, 12), + (42, 126), + (66, 137), + (39, 135), + ] + + for tup in random_numbers: + cn = cns[tup[0]] + status, data = client.get(f'/api/groups/search/{cn}/{tup[1]}') assert status == 200 assert data[0] == cn - assert len(data) == (i + 1) + assert len(data) == tup[1] for cn in cns: status, data = client.delete(f'/api/groups/{cn}')