Skip to content

Commit 2ad7d98

Browse files
committed
Fix test mock for commits() to return iterator
The test_username_lookup_case_insensitive test was failing because it mocked repo_data.commits() to return a list, but the main function expects an iterator that can be used with next(). Also added explicit owning_team=None to ensure the test takes the original commit author code path for case-insensitive lookup. Fixes TypeError: list object is not an iterator Signed-off-by: Zack Koppert <zkoppert@github.com>
1 parent 711b920 commit 2ad7d98

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

test_case_insensitive_lookup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ def test_username_lookup_case_insensitive(
153153
mock_env.gh_app_private_key_bytes = None
154154
mock_env.gh_app_enterprise_only = False
155155
mock_env.chunk_size = 100
156+
mock_env.owning_team = None # Force using original commit author path
156157
mock_get_env_vars.return_value = mock_env
157158

158159
# Mock GitHub connection and repository
@@ -166,7 +167,7 @@ def test_username_lookup_case_insensitive(
166167
# Mock first commit with different case username
167168
mock_commit = MagicMock()
168169
mock_commit.author.login = "Jeffrey-Luszcz" # Different case!
169-
mock_repo.commits.return_value = [mock_commit]
170+
mock_repo.commits.return_value = iter([mock_commit])
170171

171172
# Mock contributors with different case
172173
mock_contributor = MagicMock()

0 commit comments

Comments
 (0)