Skip to content

Commit

Permalink
Add coverage
Browse files Browse the repository at this point in the history
Signed-off-by: John Mertic <[email protected]>
  • Loading branch information
jmertic committed Nov 14, 2024
1 parent 3be7900 commit 9df23e8
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1558,7 +1558,28 @@ def testLoadData(self, mock_run):
with unittest.mock.patch('requests_cache.CachedSession', requests.Session):
members.loadData()
self.assertEqual(members.members[0].orgname,"D&I Working Group")
self.assertEqual(members.members[0].crunchbase,"https://www.crunchbase.com/organization/linux-foundation")

@patch('subprocess.run')
def testLoadDataNoTACAgendaProject(self, mock_run):
mock_result = Mock()
mock_result.stdout = '{"items":[{"assignees":["carolalynn"],"content":{"body":"","number":473,"repository":"AcademySoftwareFoundation/tac","title":"D&I Working Group","type":"Issue","url":"https://github.com/AcademySoftwareFoundation/tac/issues/473"},"id":"PVTI_lADOAm6tAs4AS_w4zgJSO7E","labels":["2-annual-review"],"landscape URL":"https://landscape.aswf.io/card-mode?project=working-group&selected=d-i-working-group","pCC Project ID":"a092M00001KWjDZQA1","pCC TSC Committee ID":"ac9cbe7f-0dc8-4be0-b404-cb7b9b0bb22f","repository":"https://github.com/AcademySoftwareFoundation/tac","scheduled Date":"2024-12-11","status":"Next Meeting Agenda Items","title":"D&I Working Group"}],"totalCount":32}'
mock_run.return_value = mock_result

config = Config()
config.slug = 'aswf'
config.projectsAddTechnologySector = True
config.projectsAddIndustrySector = True
config.projectsAddPMOManagedStatus = True
config.projectsAddParentProject = True
config.artworkRepoUrl = "https://artwork.aswf.io/projects/{slug}"
members = TACAgendaProject(config=config,loadData=False)

with self.assertLogs(level='ERROR') as cm:
with unittest.mock.patch('requests_cache.CachedSession', requests.Session):
members.loadData()

self.assertEqual(cm.output, ['ERROR:root:Cannot find GitHub Project - ID: Org:'])
self.assertEqual(members.members,[])

class TestLFXProjects(unittest.TestCase):

Expand Down

0 comments on commit 9df23e8

Please sign in to comment.