azure csp unit tests WIP
This commit is contained in:
@@ -1,7 +1,14 @@
|
||||
import pytest
|
||||
|
||||
from atst.domain.csp import MockCloudProvider
|
||||
from atst.domain.csp.cloud.models import EnvironmentCSPPayload, EnvironmentCSPResult
|
||||
from atst.domain.csp.cloud.models import (
|
||||
EnvironmentCSPPayload,
|
||||
EnvironmentCSPResult,
|
||||
TenantCSPPayload,
|
||||
TenantCSPResult,
|
||||
BillingProfileCreationCSPPayload,
|
||||
BillingProfileCreationCSPResult,
|
||||
)
|
||||
|
||||
from tests.factories import EnvironmentFactory, EnvironmentRoleFactory, UserFactory
|
||||
|
||||
@@ -28,6 +35,44 @@ def test_create_environment(mock_csp: MockCloudProvider):
|
||||
assert isinstance(result, EnvironmentCSPResult)
|
||||
|
||||
|
||||
def test_create_tenant(mock_csp: MockCloudProvider):
|
||||
payload = TenantCSPPayload(
|
||||
**dict(
|
||||
user_id="admin",
|
||||
password="JediJan13$coot", # pragma: allowlist secret
|
||||
domain_name="jediccpospawnedtenant2",
|
||||
first_name="Tedry",
|
||||
last_name="Tenet",
|
||||
country_code="US",
|
||||
password_recovery_email_address="thomas@promptworks.com",
|
||||
|
||||
)
|
||||
)
|
||||
result = mock_csp.create_tenant(payload)
|
||||
assert isinstance(result, TenantCSPResult)
|
||||
|
||||
|
||||
def test_create_billing_profile_creation(mock_csp: MockCloudProvider):
|
||||
|
||||
payload = BillingProfileCreationCSPPayload(
|
||||
**dict(
|
||||
address=dict(
|
||||
address_line_1="123 S Broad Street, Suite 2400",
|
||||
company_name="Promptworks",
|
||||
city="Philadelphia",
|
||||
region="PA",
|
||||
country="US",
|
||||
postal_code="19109",
|
||||
),
|
||||
tenant_id="60ff9d34-82bf-4f21-b565-308ef0533435",
|
||||
billing_profile_display_name="Test Billing Profile",
|
||||
billing_account_name="123123",
|
||||
)
|
||||
)
|
||||
result = mock_csp.create_billing_profile_creation(payload)
|
||||
assert isinstance(result, BillingProfileCreationCSPResult)
|
||||
|
||||
|
||||
def test_create_or_update_user(mock_csp: MockCloudProvider):
|
||||
env_role = EnvironmentRoleFactory.create()
|
||||
csp_user_id = mock_csp.create_or_update_user(CREDENTIALS, env_role, "csp_role_id")
|
||||
|
Reference in New Issue
Block a user