~ubuntu-branches/ubuntu/raring/kdepimlibs/raring-proposed

« back to all changes in this revision

Viewing changes to kimap/tests/loginjobtest.cpp

  • Committer: Package Import Robot
  • Author(s): Philip Muškovac
  • Date: 2011-07-08 00:32:40 UTC
  • mto: (0.5.5 experimental) (1.1.93)
  • mto: This revision was merged to the branch mainline in revision 100.
  • Revision ID: package-import@ubuntu.com-20110708003240-no12z37io7q5nxwt
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
92
92
  delete session;
93
93
}
94
94
 
 
95
void shouldSaveServerGreeting_data()
 
96
{
 
97
  QTest::addColumn<QString>( "greeting" );
 
98
  QTest::addColumn< QList<QByteArray> >( "scenario" );
 
99
 
 
100
  QList<QByteArray> scenario;
 
101
  scenario << FakeServer::greeting()
 
102
           << "C: A000001 LOGIN \"user\" \"password\""
 
103
           << "S: A000001 OK Welcome John Smith";
 
104
 
 
105
  QTest::newRow( "greeting" ) << "Welcome John Smith" << scenario;
 
106
 
 
107
  scenario.clear();
 
108
  scenario << FakeServer::greeting()
 
109
           << "C: A000001 LOGIN \"user\" \"password\""
 
110
           << "S: A000001 OK Welcome John Smith (last login: Feb 21, 2010)";
 
111
 
 
112
  QTest::newRow( "greeting with parenthesis" ) << "Welcome John Smith (last login: Feb 21, 2010)" << scenario;
 
113
 
 
114
  scenario.clear();
 
115
  scenario << FakeServer::greeting()
 
116
           << "C: A000001 LOGIN \"user\" \"password\""
 
117
           << "S: A000001 OK";
 
118
 
 
119
  QTest::newRow( "no greeting" ) << "" << scenario;
 
120
 
 
121
  scenario.clear();
 
122
  scenario << FakeServer::greeting()
 
123
           << "C: A000001 LOGIN \"user\" \"password\""
 
124
           << "S: A000001 NO Login failed: authentication failure";
 
125
 
 
126
  QTest::newRow( "login failed" ) << "" << scenario;
 
127
}
 
128
 
 
129
void shouldSaveServerGreeting()
 
130
{
 
131
  QFETCH( QString, greeting );
 
132
  QFETCH( QList<QByteArray>, scenario );
 
133
 
 
134
  FakeServer fakeServer;
 
135
  fakeServer.setScenario( scenario );
 
136
  fakeServer.startAndWait();
 
137
 
 
138
  KIMAP::Session *session = new KIMAP::Session("127.0.0.1", 5989);
 
139
 
 
140
  KIMAP::LoginJob *login = new KIMAP::LoginJob(session);
 
141
  login->setUserName("user");
 
142
  login->setPassword("password");
 
143
  login->exec();
 
144
 
 
145
  QCOMPARE(login->serverGreeting(), greeting);
 
146
 
 
147
  fakeServer.quit();
 
148
  delete session;
 
149
}
95
150
};
96
151
 
97
152
QTEST_KDEMAIN_CORE( LoginJobTest )