diff --git a/atst/domain/csp/cloud/azure_cloud_provider.py b/atst/domain/csp/cloud/azure_cloud_provider.py index b0e2de86..a83bef10 100644 --- a/atst/domain/csp/cloud/azure_cloud_provider.py +++ b/atst/domain/csp/cloud/azure_cloud_provider.py @@ -497,9 +497,7 @@ class AzureCloudProvider(CloudProviderInterface): else: return self._error(result.json()) - def create_product_purchase( - self, payload: ProductPurchaseCSPPayload - ): + def create_product_purchase(self, payload: ProductPurchaseCSPPayload): sp_token = self._get_sp_token(payload.creds) if sp_token is None: raise AuthenticationException( @@ -508,11 +506,13 @@ class AzureCloudProvider(CloudProviderInterface): payload_as_dict = payload.dict(by_alias=True) - create_product_purchase_body = { + create_product_purchase_body = { "type": "AADPremium", "sku": "AADP1", "productProperties": { - "beneficiaryTenantId": payload_as_dict["productProperties"]["beneficiaryTenantId"], + "beneficiaryTenantId": payload_as_dict["productProperties"][ + "beneficiaryTenantId" + ], }, "quantity": payload_as_dict.get("quantity"), } @@ -537,7 +537,6 @@ class AzureCloudProvider(CloudProviderInterface): else: return self._error(result.json()) - def create_product_purchase_verification( self, payload: ProductPurchaseVerificationCSPPayload ): @@ -560,11 +559,14 @@ class AzureCloudProvider(CloudProviderInterface): # 202 has location/retry after headers return self._ok(ProductPurchaseCSPResult(**result.headers)) elif result.status_code == 200: - return self._ok(ProductPurchaseVerificationCSPResult(premium_purchase_date=premium_purchase_date)) + return self._ok( + ProductPurchaseVerificationCSPResult( + premium_purchase_date=premium_purchase_date + ) + ) else: return self._error(result.json()) - def create_remote_admin(self, creds, tenant_details): # create app/service principal within tenant, with name constructed from tenant details # assign principal global admin diff --git a/atst/domain/csp/cloud/mock_cloud_provider.py b/atst/domain/csp/cloud/mock_cloud_provider.py index 4ef72fb9..ddb856dd 100644 --- a/atst/domain/csp/cloud/mock_cloud_provider.py +++ b/atst/domain/csp/cloud/mock_cloud_provider.py @@ -281,10 +281,7 @@ class MockCloudProvider(CloudProviderInterface): } ) - - def create_product_purchase( - self, payload: ProductPurchaseCSPPayload - ): + def create_product_purchase(self, payload: ProductPurchaseCSPPayload): self._maybe_raise(self.NETWORK_FAILURE_PCT, self.NETWORK_EXCEPTION) self._maybe_raise(self.SERVER_FAILURE_PCT, self.SERVER_EXCEPTION) self._maybe_raise(self.UNAUTHORIZED_RATE, self.AUTHORIZATION_EXCEPTION) @@ -296,8 +293,6 @@ class MockCloudProvider(CloudProviderInterface): ) ) - - def create_product_purchase_verification( self, payload: ProductPurchaseVerificationCSPPayload ):