Connect to the FTP server in a single place in wxFTP unit test

As all tests need a valid connection, just do it once in the test set up
instead of duplicating the call to Connect() in all tests.

No real changes.
This commit is contained in:
Vadim Zeitlin
2016-09-25 01:19:53 +02:00
parent 9b19a6e529
commit 461d0b2005

View File

@@ -94,6 +94,8 @@ void FTPTestCase::setUp()
m_ftp->SetUser(user);
m_ftp->SetPassword(password);
#endif // FTP_ANONYMOUS/!FTP_ANONYMOUS
CPPUNIT_ASSERT( m_ftp->Connect(hostname) );
}
void FTPTestCase::tearDown()
@@ -105,8 +107,6 @@ void FTPTestCase::tearDown()
void FTPTestCase::List()
{
CPPUNIT_ASSERT( m_ftp->Connect(hostname) );
// test CWD
CPPUNIT_ASSERT( m_ftp->ChDir(directory) );
@@ -120,7 +120,6 @@ void FTPTestCase::List()
void FTPTestCase::Download()
{
CPPUNIT_ASSERT( m_ftp->Connect(hostname) );
CPPUNIT_ASSERT( m_ftp->ChDir(directory) );
// test RETR
@@ -141,8 +140,6 @@ void FTPTestCase::Download()
void FTPTestCase::FileSize()
{
CPPUNIT_ASSERT( m_ftp->Connect(hostname) );
CPPUNIT_ASSERT( m_ftp->ChDir(directory) );
CPPUNIT_ASSERT( m_ftp->FileExists(valid_filename) );
@@ -153,7 +150,6 @@ void FTPTestCase::FileSize()
void FTPTestCase::Misc()
{
CPPUNIT_ASSERT( m_ftp->Connect(hostname) );
CPPUNIT_ASSERT( m_ftp->SendCommand(wxT("STAT")) == '2' );
CPPUNIT_ASSERT( m_ftp->SendCommand(wxT("HELP SITE")) == '2' );
@@ -162,8 +158,6 @@ void FTPTestCase::Misc()
#ifndef FTP_ANONYMOUS
void FTPTestCase::Upload()
{
CPPUNIT_ASSERT( m_ftp->Connect(hostname) );
// upload a file
static const wxChar *file1 = wxT("test1");
wxOutputStream *out = m_ftp->GetOutputStream(file1);