File tree Expand file tree Collapse file tree
aws_lambda_powertools/utilities/data_classes
tests/unit/data_classes/required_dependencies Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ def _build_authentication_response(
6767 raise ValueError (f"Invalid home_directory_type: { home_directory_type } " )
6868
6969 if user_uid is not None :
70- response ["PosixProfile" ] = {"Gid" : user_gid , "Uid" : user_gid }
70+ response ["PosixProfile" ] = {"Gid" : user_gid , "Uid" : user_uid }
7171
7272 if policy :
7373 response ["Policy" ] = policy
Original file line number Diff line number Diff line change @@ -90,6 +90,22 @@ def test_build_authentication_response_efs(home_directory_type):
9090 assert "HomeDirectory" not in response
9191
9292
93+ def test_build_authentication_response_efs_posix_profile ():
94+ # GIVEN a Authorizer response
95+ response = TransferFamilyAuthorizerResponse ()
96+
97+ # WHEN building an authentication response for EFS with different uid and gid
98+ response = response .build_authentication_response_efs (
99+ role_arn = "arn:aws:iam::123456789012:role/EFSAccess" ,
100+ home_directory = "/fs-12345678/user" ,
101+ user_gid = 1000 ,
102+ user_uid = 1001 ,
103+ )
104+
105+ # THEN the PosixProfile uses the uid and gid that were passed
106+ assert response .get ("PosixProfile" ) == {"Gid" : 1000 , "Uid" : 1001 }
107+
108+
93109def test_build_authentication_missing_home_directory ():
94110 # GIVEN a Authorizer response
95111 response = TransferFamilyAuthorizerResponse ()
You can’t perform that action at this time.
0 commit comments