Skip to content

Commit c46ff0c

Browse files
committed
CIAM end-to-end test cases based on new lab API
1 parent 6bae812 commit c46ff0c

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

tests/test_e2e.py

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -897,6 +897,57 @@ def test_b2c_allows_using_client_id_as_scope(self):
897897
)
898898

899899

900+
class CiamTestCase(LabBasedTestCase):
901+
# Test cases below show you what scenarios need to be covered for CIAM.
902+
# Detail test behaviors have already been implemented in preexisting helpers.
903+
904+
@classmethod
905+
def setUpClass(cls):
906+
super(CiamTestCase, cls).setUpClass()
907+
cls.user = cls.get_lab_user(
908+
federationProvider="ciam", signinAudience="azureadmyorg", publicClient="No")
909+
# FYI: Only single- or multi-tenant CIAM app can have other-than-OIDC
910+
# delegated permissions on Microsoft Graph.
911+
cls.app_config = cls.get_lab_app_object(cls.user["client_id"])
912+
913+
def test_ciam_acquire_token_interactive(self):
914+
self._test_acquire_token_interactive(
915+
authority=self.app_config["authority"],
916+
client_id=self.app_config["appId"],
917+
scope=self.app_config["scopes"],
918+
username=self.user["username"],
919+
lab_name=self.user["lab_name"],
920+
)
921+
922+
def test_ciam_acquire_token_for_client(self):
923+
self._test_acquire_token_by_client_secret(
924+
client_id=self.app_config["appId"],
925+
client_secret=self.get_lab_user_secret(
926+
self.app_config["clientSecret"].split("=")[-1]),
927+
authority=self.app_config["authority"],
928+
scope=["{}/.default".format(self.app_config["appId"])], # App permission
929+
)
930+
931+
def test_ciam_acquire_token_by_ropc(self):
932+
# Somehow, this would only work after creating a secret for the test app
933+
# and enabling "Allow public client flows".
934+
# Otherwise it would hit AADSTS7000218.
935+
self._test_username_password(
936+
authority=self.app_config["authority"],
937+
client_id=self.app_config["appId"],
938+
username=self.user["username"],
939+
password=self.get_lab_user_secret(self.user["lab_name"]),
940+
scope=self.app_config["scopes"],
941+
)
942+
943+
def test_ciam_device_flow(self):
944+
self._test_device_flow(
945+
authority=self.app_config["authority"],
946+
client_id=self.app_config["appId"],
947+
scope=self.app_config["scopes"],
948+
)
949+
950+
900951
class WorldWideRegionalEndpointTestCase(LabBasedTestCase):
901952
region = "westus"
902953
timeout = 2 # Short timeout makes this test case responsive on non-VM

0 commit comments

Comments
 (0)