@@ -735,7 +735,7 @@ def test_credentialed(self):
735735 # Sign the dua and get file again
736736 response = self .client .post (reverse ('sign_dua' ,
737737 args = (project .slug , project .version ,)),
738- data = {'agree' : '' , 'full_name ' : 'Roger Greenwood Mark ' })
738+ data = {'agree' : '' , 'initials ' : 'RGM ' })
739739 response = self .client .get (reverse (
740740 'serve_published_project_file' ,
741741 args = (project .slug , project .version , 'SHA256SUMS.txt' )))
@@ -952,7 +952,7 @@ def test_serve_file(self):
952952 self .client .login (username = 'rgmark@mit.edu' , password = 'Tester11!' )
953953 response = self .client .post (
954954 reverse ('sign_dua' , args = (project .slug , project .version ,)),
955- data = {'agree' : '' , 'full_name ' : 'Roger Greenwood Mark ' })
955+ data = {'agree' : '' , 'initials ' : 'RGM ' })
956956
957957 response = self .client .get (url + 'foo/' )
958958 self .assertEqual (response .status_code , 200 )
@@ -967,46 +967,46 @@ def test_serve_file(self):
967967
968968class TestDUASignatureValidation (TestMixin ):
969969 """
970- Test DUA signing with full name validation.
970+ Test DUA signing with initials validation.
971971 """
972972
973- def test_sign_dua_with_correct_name (self ):
974- """User can sign DUA when typing their correct full name ."""
973+ def test_sign_dua_with_correct_initials (self ):
974+ """User can sign DUA when typing their correct initials ."""
975975 project = PublishedProject .objects .get (slug = 'demoeicu' , version = '2.0.0' )
976976 self .client .login (username = 'rgmark@mit.edu' , password = 'Tester11!' )
977977
978978 response = self .client .post (
979979 reverse ('sign_dua' , args = (project .slug , project .version )),
980- data = {'agree' : '' , 'full_name ' : 'Roger Greenwood Mark ' }
980+ data = {'agree' : '' , 'initials ' : 'RGM ' }
981981 )
982982 self .assertEqual (response .status_code , 200 )
983983 self .assertTrue (DUASignature .objects .filter (
984984 user__email = 'rgmark@mit.edu' , project = project
985985 ).exists ())
986986
987- def test_sign_dua_with_wrong_name (self ):
988- """User cannot sign DUA when typing wrong name ."""
987+ def test_sign_dua_with_wrong_initials (self ):
988+ """User cannot sign DUA when typing wrong initials ."""
989989 project = PublishedProject .objects .get (slug = 'demoeicu' , version = '2.0.0' )
990990 self .client .login (username = 'rgmark@mit.edu' , password = 'Tester11!' )
991991
992992 response = self .client .post (
993993 reverse ('sign_dua' , args = (project .slug , project .version )),
994- data = {'agree' : '' , 'full_name ' : 'Wrong Name ' }
994+ data = {'agree' : '' , 'initials ' : 'XYZ ' }
995995 )
996996 self .assertEqual (response .status_code , 200 )
997997 self .assertFalse (DUASignature .objects .filter (
998998 user__email = 'rgmark@mit.edu' , project = project
999999 ).exists ())
1000- self .assertContains (response , 'does not match your profile name ' )
1000+ self .assertContains (response , 'do not match' )
10011001
1002- def test_sign_dua_with_empty_name (self ):
1003- """User cannot sign DUA without entering their name ."""
1002+ def test_sign_dua_with_empty_initials (self ):
1003+ """User cannot sign DUA without entering their initials ."""
10041004 project = PublishedProject .objects .get (slug = 'demoeicu' , version = '2.0.0' )
10051005 self .client .login (username = 'rgmark@mit.edu' , password = 'Tester11!' )
10061006
10071007 response = self .client .post (
10081008 reverse ('sign_dua' , args = (project .slug , project .version )),
1009- data = {'agree' : '' , 'full_name ' : '' }
1009+ data = {'agree' : '' , 'initials ' : '' }
10101010 )
10111011 self .assertEqual (response .status_code , 200 )
10121012 self .assertFalse (DUASignature .objects .filter (
@@ -1015,20 +1015,40 @@ def test_sign_dua_with_empty_name(self):
10151015 self .assertContains (response , 'This field is required' )
10161016
10171017 def test_sign_dua_case_insensitive (self ):
1018- """Name validation is case-insensitive."""
1018+ """Initials validation is case-insensitive."""
10191019 project = PublishedProject .objects .get (slug = 'demoeicu' , version = '2.0.0' )
10201020 self .client .login (username = 'rgmark@mit.edu' , password = 'Tester11!' )
10211021
10221022 response = self .client .post (
10231023 reverse ('sign_dua' , args = (project .slug , project .version )),
1024- data = {'agree' : '' , 'full_name ' : 'roger greenwood mark ' }
1024+ data = {'agree' : '' , 'initials ' : 'rgm ' }
10251025 )
10261026 self .assertEqual (response .status_code , 200 )
10271027 self .assertTrue (DUASignature .objects .filter (
10281028 user__email = 'rgmark@mit.edu' , project = project
10291029 ).exists ())
10301030
10311031
1032+ class TestDUASignatureNormalization (TestCase ):
1033+ """
1034+ Test Unicode normalization for initials comparison.
1035+ """
1036+
1037+ def test_normalize_for_comparison (self ):
1038+ """Test that normalize_for_comparison handles Unicode properly."""
1039+ normalize = DUASignature .normalize_for_comparison
1040+
1041+ # Case insensitivity
1042+ self .assertEqual (normalize ('ABC' ), normalize ('abc' ))
1043+
1044+ # German sharp S (ß) casefolds to 'ss'
1045+ self .assertEqual (normalize ('ß' ), normalize ('ss' ))
1046+
1047+ # Different Unicode representations of same character
1048+ # é as single character vs e + combining acute accent
1049+ self .assertEqual (normalize ('é' ), normalize ('é' ))
1050+
1051+
10321052class TestState (TestMixin ):
10331053 """
10341054 Test that all objects are in their intended states, during and
0 commit comments