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.
2
26
#
3
27
# Licensed under the Apache License, Version 2.0 (the "License");
4
28
# you may not use this file except in compliance with the License.
26
50
27
51
import json
28
52
import os
29
- import uuid
30
-
31
53
import unittest
54
+ import uuid
32
55
33
56
from fusionauth .fusionauth_client import FusionAuthClient
34
57
@@ -51,7 +74,8 @@ def runTest(self):
51
74
def test_retrieve_applications (self ):
52
75
client_response = self .client .retrieve_applications ()
53
76
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 )
55
79
56
80
def test_create_user_retrieve_user (self ):
57
81
# Check if the user already exists.
@@ -84,6 +108,25 @@ def test_create_user_retrieve_user(self):
84
108
self .assertFalse ('password' in get_user_response .success_response ['user' ])
85
109
self .assertFalse ('salt' in get_user_response .success_response ['user' ])
86
110
111
+ # Retrieve the user via loginId
112
+ get_user_response = self .
client .
retrieve_user_by_login_id (
'[email protected] ' )
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' ],
'[email protected] ' )
117
+
118
+ # Explicit loginIdType
119
+ get_user_response = self .
client .
retrieve_user_by_login_id_with_login_id_types (
'[email protected] ' , [
'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' ],
'[email protected] ' )
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('[email protected] ', ['phoneNumber'])
128
+ # self.assertEqual(get_user_response.status, 404)
129
+
87
130
def test_retrieve_user_missing (self ):
88
131
user_id = uuid .uuid4 ()
89
132
client_response = self .client .retrieve_user (user_id )
0 commit comments