Skip to content

Commit ebce1b9

Browse files
authored
Merge pull request #9 from advanced-security/fix-tests
Fixed list secrets script and test to avoid quality warnings
2 parents 6c2344e + 8e0c4d6 commit ebce1b9

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

list_secret_scanning_alerts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def make_result(
6565
if alert.get("commit") is not None:
6666
commit_info = alert["commit"]
6767
result["first_commit_date"] = commit_info["committer"]["date"]
68-
result["first_commit_author"] = f"{commit_info["author"]["name"]} <{commit_info["author"]["email"]}>"
68+
result["first_commit_author"] = f"{commit_info['author']['name']} <{commit_info['author']['email']}>"
6969

7070
if include_locations:
7171
# use decorated alert info, if it's there

test_tls_cert_support.py

100644100755
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def test_github_verify_default():
1414

1515
from githubapi import GitHub
1616

17-
gh = GitHub()
17+
_gh = GitHub()
1818

1919
# Verify that session.verify is set to True by default
2020
assert mock_session.verify == True
@@ -29,7 +29,7 @@ def test_github_verify_false():
2929

3030
from githubapi import GitHub
3131

32-
gh = GitHub(verify=False)
32+
_gh = GitHub(verify=False)
3333

3434
# Verify that session.verify is set to False
3535
assert mock_session.verify == False
@@ -45,7 +45,7 @@ def test_github_verify_cert_bundle():
4545
from githubapi import GitHub
4646

4747
cert_path = "/path/to/cert.pem"
48-
gh = GitHub(verify=cert_path)
48+
_gh = GitHub(verify=cert_path)
4949

5050
# Verify that session.verify is set to the certificate path
5151
assert mock_session.verify == cert_path
@@ -56,16 +56,15 @@ def test_github_token_required():
5656
with patch.dict(os.environ, {}, clear=True):
5757
with pytest.raises(ValueError, match="GITHUB_TOKEN environment variable must be set"):
5858
from githubapi import GitHub
59-
gh = GitHub()
59+
_gh = GitHub()
6060

6161

6262
def test_github_hostname_validation():
6363
"""Test that GitHub class validates hostname."""
6464
with patch.dict(os.environ, {"GITHUB_TOKEN": "test_token"}):
6565
with pytest.raises(ValueError, match="Invalid server hostname"):
6666
from githubapi import GitHub
67-
gh = GitHub(hostname="invalid hostname with spaces")
68-
67+
_gh = GitHub(hostname="invalid hostname with spaces")
6968

7069
if __name__ == "__main__":
7170
pytest.main([__file__, "-v"])

0 commit comments

Comments
 (0)