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.

(cherry picked from commit 461d0b2005)
This commit is contained in:
Vadim Zeitlin
2016-09-25 01:19:53 +02:00
parent 59ef01d95c
commit 7f6d9166a2

View File

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