feat: added testing

Added testing classes for provider, new service and check and corrected minor issues.
This commit is contained in:
HugoPBrito committed 2024-11-20 18:09:10 +01:00
1 parent c11e6449f9
commit 5ee960e13d
10 files changed
+334 -17

No files matched your search

+20 -8
View File
@@ -1,4 +1,5 @@
from mock import MagicMock
from prowler.providers.github.github_provider import GithubProvider
from prowler.providers.github.models import GithubIdentityInfo, GithubSession
@@ -7,16 +8,27 @@ ACCOUNT_NAME = "account-name"
ACCOUNT_ID = "account-id"
ACCOUNT_URL = "/user"
# GitHub Credentials
TOKEN = "github-token"
# Mocked GitHub Provider
def set_mocked_github_provider(
credentials:
) -> GithubProvider:
provider = MagicMock()
provider.type = "github"
provider.session = GithubSession()
provider.identity = GithubIdentityInfo(
auth_method: str = "personal_access_token",
credentials: GithubSession = GithubSession(token=TOKEN),
identity: GithubIdentityInfo = GithubIdentityInfo(
account_name=ACCOUNT_NAME,
account_id=ACCOUNT_ID,
account_url=ACCOUNT_URL,
)
return provider
),
audit_config: dict = None,
) -> GithubProvider:
provider = MagicMock()
provider.type = "github"
provider.auth_method = auth_method
provider.session = credentials
provider.identity = identity
provider.audit_config = audit_config
return provider