mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-10-24 12:24:17 +00:00
feat: added testing
Added testing classes for provider, new service and check and corrected minor issues.
This commit is contained in:
10 files changed
+334
-17
No files matched your search
@@ -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
|
||||
Reference in new issue
Block a user