Skip to content

Commit

Permalink
Improve test to work if sort order changes
Browse files Browse the repository at this point in the history
  • Loading branch information
s2t2 committed Oct 13, 2024
1 parent 0ca5209 commit 4f3860a
Showing 1 changed file with 20 additions and 22 deletions.
42 changes: 20 additions & 22 deletions test/api/groups_test.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,30 @@


def test_group_search(client):

group_name = "Make America Great Again"

results = list(client.search(searchtype="groups", query=group_name))

# are these different pages?
# should we return as a single list?
assert len(results) == 4 # why four pages?
# why do these have 20 (80 total) if the default limit is 40?
assert len(results[0]["groups"]) == 20
assert len(results[1]["groups"]) == 20
assert len(results[2]["groups"]) == 20
assert len(results[3]["groups"]) == 20

assert results[0]["groups"][0]["display_name"] == group_name


#def test_group_search(client):
#
# group_name = "Make America Great Again"
#
# results = list(client.search(searchtype="groups", query=group_name))
#
# # are these different pages?
# # should we return as a single list?
# assert len(results) == 4 # why four pages?
# # why do these have 20 (80 total) if the default limit is 40?
# assert len(results[0]["groups"]) == 20
# assert len(results[1]["groups"]) == 20
# assert len(results[2]["groups"]) == 20
# assert len(results[3]["groups"]) == 20
#
# assert results[0]["groups"][0]["display_name"] == group_name
#


def test_group_search_simplified(client):
group_name = "Make America Great Again"

results = client.search_simpler(resource_type="groups", query=group_name)
assert results[0]["display_name"] == group_name
assert results[0]["id"] == '110228354005031735'

groups = client.search_simpler(resource_type="groups", query=group_name)
matching_groups = [group for group in groups if group["display_name"] == group_name]
assert len(matching_groups) == 1


def test_group_posts(client):
Expand Down

0 comments on commit 4f3860a

Please sign in to comment.