feat(github): add new service Organization (#6300)

Co-authored-by: MrCloudSec <hello@mistercloudsec.com>
This commit is contained in:
Hugo Pereira Brito
2025-05-14 10:40:26 +02:00
committed by GitHub
parent 9ecf570790
commit 484a773f5b
5 changed files with 75 additions and 1 deletions
@@ -0,0 +1,35 @@
from unittest.mock import patch
from prowler.providers.github.services.organization.organization_service import (
Org,
Organization,
)
from tests.providers.github.github_fixtures import set_mocked_github_provider
def mock_list_organizations(_):
return {
1: Org(
id=1,
name="test-organization",
),
}
@patch(
"prowler.providers.github.services.organization.organization_service.Organization._list_organizations",
new=mock_list_organizations,
)
class Test_Repository_Service:
def test_get_client(self):
repository_service = Organization(set_mocked_github_provider())
assert repository_service.clients[0].__class__.__name__ == "Github"
def test_get_service(self):
repository_service = Organization(set_mocked_github_provider())
assert repository_service.__class__.__name__ == "Organization"
def test_list_organizations(self):
repository_service = Organization(set_mocked_github_provider())
assert len(repository_service.organizations) == 1
assert repository_service.organizations[1].name == "test-organization"