@@ -631,22 +631,32 @@ def connect_ftp(self, user, passwd, host, port, dirs,
631631 h = NullFTPHandler (data )
632632 o = h .parent = MockOpener ()
633633
634- for url , host , port , type_ , dirs , filename , mimetype in [
634+ for url , host , port , user , passwd , type_ , dirs , filename , mimetype in [
635635 ("ftp://localhost/foo/bar/baz.html" ,
636- "localhost" , ftplib .FTP_PORT , "I" ,
636+ "localhost" , ftplib .FTP_PORT , "" , "" , "I" ,
637+ ["foo" , "bar" ], "baz.html" , "text/html" ),
638+ ("ftp://parrot@localhost/foo/bar/baz.html" ,
639+ "localhost" , ftplib .FTP_PORT , "parrot" , "" , "I" ,
640+ ["foo" , "bar" ], "baz.html" , "text/html" ),
641+ ("ftp://%25parrot@localhost/foo/bar/baz.html" ,
642+ "localhost" , ftplib .FTP_PORT , "%parrot" , "" , "I" ,
643+ ["foo" , "bar" ], "baz.html" , "text/html" ),
644+ ("ftp://%2542parrot@localhost/foo/bar/baz.html" ,
645+ "localhost" , ftplib .FTP_PORT , "%42parrot" , "" , "I" ,
637646 ["foo" , "bar" ], "baz.html" , "text/html" ),
638647 ("ftp://localhost:80/foo/bar/" ,
639- "localhost" , 80 , "D" ,
648+ "localhost" , 80 , "" , "" , " D" ,
640649 ["foo" , "bar" ], "" , None ),
641650 ("ftp://localhost/baz.gif;type=a" ,
642- "localhost" , ftplib .FTP_PORT , "A" ,
651+ "localhost" , ftplib .FTP_PORT , "" , "" , " A" ,
643652 [], "baz.gif" , None ), # XXX really this should guess image/gif
644653 ]:
645654 req = Request (url )
646655 req .timeout = None
647656 r = h .ftp_open (req )
648657 # ftp authentication not yet implemented by FTPHandler
649- self .assertTrue (h .user == h .passwd == "" )
658+ self .assertEqual (h .user , user )
659+ self .assertEqual (h .passwd , passwd )
650660 self .assertEqual (h .host , socket .gethostbyname (host ))
651661 self .assertEqual (h .port , port )
652662 self .assertEqual (h .dirs , dirs )
0 commit comments