Commit 4323218 1 parent 9ce668b commit 4323218 Copy full SHA for 4323218
File tree 1 file changed +17
-0
lines changed
1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,23 @@ def test_list_user_credentials(self):
39
39
assert len (list_user_credentials ) == 1
40
40
assert list_user_credentials [0 ]["source_id" ] == source_id
41
41
42
+ def test_other_users_cannot_list_credentials (self ):
43
+ source_id = f"test_others_cant_list_credentials_{ uuid4 ()} "
44
+ payload = self ._build_credentials_payload (source_id = source_id )
45
+ self ._provide_user_credentials (payload )
46
+
47
+ response = self ._get (f"/api/users/current/credentials?source_type=tool&source_id={ source_id } " )
48
+ self ._assert_status_code_is (response , 200 )
49
+ list_user_credentials = response .json ()
50
+ assert len (list_user_credentials ) == 1
51
+ assert list_user_credentials [0 ]["source_id" ] == source_id
52
+
53
+ with self ._different_user ():
54
+ response = self ._get (f"/api/users/current/credentials?source_type=tool&source_id={ source_id } " )
55
+ self ._assert_status_code_is (response , 200 )
56
+ list_user_credentials = response .json ()
57
+ assert len (list_user_credentials ) == 0
58
+
42
59
def test_list_by_source_id_requires_source_type (self ):
43
60
response = self ._get ("/api/users/current/credentials?source_id=test_tool" )
44
61
self ._assert_status_code_is (response , 400 )
You can’t perform that action at this time.
0 commit comments