Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
HCookie committed Oct 17, 2024
1 parent 121ae4d commit 94d1fa0
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion contributors/json_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def write_to_json(
repository_list,
sponsor_info,
link_to_profile,
show_organizations_list
show_organizations_list,
):
"""Write data to a JSON file.
Expand Down
6 changes: 3 additions & 3 deletions contributors/markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,14 +223,14 @@ def get_contributor_table(

if not added_to_org:
organization_contributors["Independent"].append(row)


ordered_orgs = [org for org in (*show_organizations_list, "Independent") if org in organization_contributors]
tables = OrderedDict(
[
(org, headers + "".join(organization_contributors[org]))
for org in set((*show_organizations_list, "Independent")).intersection(organization_contributors.keys())
for org in ordered_orgs
]
)
print(tables)

# table += row
return tables, total_contributions
30 changes: 15 additions & 15 deletions tests/test_contributors.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ def test_get_contributors(self, mock_contributor_stats):
get_contributors(mock_repo, "2022-01-01", "2022-12-31")

mock_contributor_stats.assert_called_once_with(
username='user',
new_contributor=False,
avatar_url='https://github.com/avatars/u/12345678?v=4',
contribution_count = 100,
commit_url ='https://github.com/owner/repo/commits?author=user&since=2022-01-01&until=2022-12-31',
sponsor_info='',
organizations=[]
username="user",
new_contributor=False,
avatar_url="https://github.com/avatars/u/12345678?v=4",
contribution_count=100,
commit_url="https://github.com/owner/repo/commits?author=user&since=2022-01-01&until=2022-12-31",
sponsor_info="",
organizations=[],
)

@patch("contributors.get_contributors")
Expand All @@ -55,7 +55,7 @@ def test_get_all_contributors_with_organization(self, mock_get_contributors):
100,
"commit_url",
"sponsor_url_1",
[]
[],
),
]

Expand All @@ -65,13 +65,13 @@ def test_get_all_contributors_with_organization(self, mock_get_contributors):
result,
[
ContributorStats(
username = "user",
username="user",
new_contributor=False,
avatar_url = "https://github.com/avatars/u/29484535?v=4",
avatar_url="https://github.com/avatars/u/29484535?v=4",
contribution_count=200,
commit_url = "commit_url, commit_url",
sponsor_info = "sponsor_url_1",
organizations= [],
commit_url="commit_url, commit_url",
sponsor_info="sponsor_url_1",
organizations=[],
),
],
)
Expand Down Expand Up @@ -136,12 +136,12 @@ def test_get_contributors_skip_users_with_no_commits(self, mock_contributor_stat

# Note that only user is returned and user2 is not returned here because there were no commits in the date range
mock_contributor_stats.assert_called_once_with(
username = "user",
username="user",
new_contributor=False,
avatar_url="https://github.com/avatars/u/12345678?v=4",
contribution_count=100,
commit_url="https://github.com/owner/repo/commits?author=user&since=2022-01-01&until=2022-12-31",
sponsor_info='',
sponsor_info="",
organizations=[],
)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_json_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def setUp(self):
"new_contributor": False,
"avatar_url": "https://test_url.com",
"contribution_count": 10,
'organizations': [],
"organizations": [],
"commit_url": "https://test_commit_url.com",
"sponsor_info": "",
}
Expand Down

0 comments on commit 94d1fa0

Please sign in to comment.