-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from VincenzoLaSpesa/master
Resolved login issues. Test routines added
- Loading branch information
Showing
3 changed files
with
233 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package goftp | ||
|
||
import "testing" | ||
|
||
//import "fmt" | ||
|
||
var goodServer string | ||
var uglyServer string | ||
var badServer string | ||
|
||
func init() { | ||
//ProFTPD 1.3.5 Server (Debian) | ||
goodServer = "bo.mirror.garr.it:21" | ||
|
||
//Symantec EMEA FTP Server | ||
badServer = "ftp.packardbell.com:21" | ||
|
||
//Unknown server | ||
uglyServer = "ftp.musicbrainz.org:21" | ||
} | ||
|
||
func standard(host string) (msg string) { | ||
var err error | ||
var connection *FTP | ||
|
||
if connection, err = Connect(host); err != nil { | ||
return "Can't connect ->" + err.Error() | ||
} | ||
if err = connection.Login("anonymous", "anonymous"); err != nil { | ||
return "Can't login ->" + err.Error() | ||
} | ||
if _, err = connection.List(""); err != nil { | ||
return "Can't list ->" + err.Error() | ||
} | ||
connection.Close() | ||
return "" | ||
} | ||
|
||
func TestLogin_good(t *testing.T) { | ||
str := standard(goodServer) | ||
if len(str) > 0 { | ||
t.Error(str) | ||
} | ||
} | ||
|
||
func TestLogin_bad(t *testing.T) { | ||
str := standard(badServer) | ||
if len(str) > 0 { | ||
t.Error(str) | ||
} | ||
} | ||
|
||
func TestLogin_ugly(t *testing.T) { | ||
str := standard(uglyServer) | ||
if len(str) > 0 { | ||
t.Error(str) | ||
} | ||
} |