Skip to content

Commit

Permalink
fixup: t-s and i-s
Browse files Browse the repository at this point in the history
  • Loading branch information
16Martin committed Nov 20, 2024
1 parent 6485b3a commit 5dd3cbb
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions tests/test_find_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,36 +25,36 @@
class MockProject:
API_PREFIX = 'https://api.github.com/repos'

def __init__(self, name, data):
def __init__(self, name: str, data: Any) -> None:
self.name = name
self.data = data

@property
def url(self):
def url(self) -> str:
return self.API_PREFIX + '/' + self.name

@property
def html_url(self):
def html_url(self) -> str:
return 'https://github.com/' + self.name

@property
def git_url(self):
def git_url(self) -> str:
return 'git://github.com/' + self.name + '.git'

@property
def tags_url(self):
def tags_url(self) -> str:
return self.url + '/tags'

@property
def archive_url(self):
def archive_url(self) -> str:
return self.url + '/{archive_format}{/ref}'

@property
def git_refs_url(self):
def git_refs_url(self) -> str:
return self.url + '/git/refs{/sha}'

@property
def api_object(self):
def api_object(self) -> Dict[str, Any]:
"""Limited to the values we access ..."""
return {
'full_name': self.name,
Expand All @@ -75,7 +75,7 @@ def mock_github_request(self, url: str, username: str = "",
allow_redirects: bool = True
) -> Any:
_url = urlparse(url)
# print(_url)
result: Any = ''
if isinstance(self.data, dict) and 'message' in self.data:
result = self.data # means error
elif _url.path.endswith(self.name):
Expand Down Expand Up @@ -165,8 +165,10 @@ class TestFindSources(TestBase):
INPUTFILE = "sbom_for_find_sources.json"
OUTPUTFILE = "output.json"

github_projects: Dict[str, MockProject] = {}

@classmethod
def setUpClass(cls):
def setUpClass(cls) -> None:
cls.github_projects = {
name: MockProject(name, data) for name, data in GITHUB_PROJECTS}

Expand Down

0 comments on commit 5dd3cbb

Please sign in to comment.