1- # Copyright (c) 2024, FusionAuth, All Rights Reserved
1+ # Copyright (c) 2024-2025, FusionAuth, All Rights Reserved
2+ #
3+ # Licensed under the Apache License, Version 2.0 (the "License");
4+ # you may not use this file except in compliance with the License.
5+ # You may obtain a copy of the License at
6+ #
7+ # http://www.apache.org/licenses/LICENSE-2.0
8+ #
9+ # Unless required by applicable law or agreed to in writing,
10+ # software distributed under the License is distributed on an
11+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
12+ # either express or implied. See the License for the specific
13+ # language governing permissions and limitations under the License.
14+ #
15+ # Licensed under the Apache License, Version 2.0 (the "License");
16+ # you may not use this file except in compliance with the License.
17+ # You may obtain a copy of the License at
18+ #
19+ # http://www.apache.org/licenses/LICENSE-2.0
20+ #
21+ # Unless required by applicable law or agreed to in writing,
22+ # software distributed under the License is distributed on an
23+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
24+ # either express or implied. See the License for the specific
25+ # language governing permissions and limitations under the License.
226#
327# Licensed under the Apache License, Version 2.0 (the "License");
428# you may not use this file except in compliance with the License.
2650
2751import json
2852import os
29- import uuid
30-
3153import unittest
54+ import uuid
3255
3356from fusionauth .fusionauth_client import FusionAuthClient
3457
@@ -51,7 +74,8 @@ def runTest(self):
5174 def test_retrieve_applications (self ):
5275 client_response = self .client .retrieve_applications ()
5376 self .assertEqual (client_response .status , 200 )
54- self .assertEqual (len (client_response .success_response ['applications' ]), 2 )
77+ # tnent manager is 1 application, admin is another, Pied piper in the kickstart is the 3rd.
78+ self .assertEqual (len (client_response .success_response ['applications' ]), 3 )
5579
5680 def test_create_user_retrieve_user (self ):
5781 # Check if the user already exists.
@@ -84,6 +108,25 @@ def test_create_user_retrieve_user(self):
84108 self .assertFalse ('password' in get_user_response .success_response ['user' ])
85109 self .assertFalse ('salt' in get_user_response .success_response ['user' ])
86110
111+ # Retrieve the user via loginId
112+ get_user_response = self .client .retrieve_user_by_login_id ('user@example.com' )
113+ self .assertEqual (get_user_response .status , 200 )
114+ self .assertIsNotNone (get_user_response .success_response )
115+ self .assertIsNone (get_user_response .error_response )
116+ self .assertEqual (get_user_response .success_response ['user' ]['email' ], 'user@example.com' )
117+
118+ # Explicit loginIdType
119+ get_user_response = self .client .retrieve_user_by_login_id_with_login_id_types ('user@example.com' , ['email' ])
120+ self .assertEqual (get_user_response .status , 200 )
121+ self .assertIsNotNone (get_user_response .success_response )
122+ self .assertIsNone (get_user_response .error_response )
123+ self .assertEqual (get_user_response .success_response ['user' ]['email' ], 'user@example.com' )
124+
125+ # TODO: Once issue 1 is released, this test should pass
126+ # # wrong loginIdType
127+ # get_user_response = self.client.retrieve_user_by_login_id_with_login_id_types('user@example.com', ['phoneNumber'])
128+ # self.assertEqual(get_user_response.status, 404)
129+
87130 def test_retrieve_user_missing (self ):
88131 user_id = uuid .uuid4 ()
89132 client_response = self .client .retrieve_user (user_id )
0 commit comments