~ubuntu-branches/ubuntu/oneiric/psi/oneiric

« back to all changes in this revision

Viewing changes to iris/src/xmpp/sasl/unittest/plainmessagetest.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jan Niehusmann
  • Date: 2009-09-25 17:49:51 UTC
  • mfrom: (6.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20090925174951-lvm7kdap82o8xhn3
Tags: 0.13-1
* Updated to upstream version 0.13
* Set Standards-Version to 3.8.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2008  Remko Troncon
 
3
 * See COPYING for license details.
 
4
 */
 
5
 
 
6
#include <QObject>
 
7
#include <QtTest/QtTest>
 
8
 
 
9
#include "xmpp/sasl/plainmessage.h"
 
10
#include "qttestutil/qttestutil.h"
 
11
 
 
12
using namespace XMPP;
 
13
 
 
14
class PlainMessageTest : public QObject
 
15
{
 
16
                Q_OBJECT
 
17
 
 
18
        private slots:
 
19
                void testConstructor_WithoutAuthzID() {
 
20
                        PLAINMessage message("", QString("user"), "pass");
 
21
                        QCOMPARE(message.getValue(), QByteArray("\0user\0pass", 10));
 
22
                }
 
23
 
 
24
                void testConstructor_WithAuthzID() {
 
25
                        PLAINMessage message(QString("authz"), QString("user"), "pass");
 
26
                        QCOMPARE(message.getValue(), QByteArray("authz\0user\0pass", 15));
 
27
                }
 
28
 
 
29
                void testConstructor_WithNonASCIICharacters() {
 
30
                        PLAINMessage message(QString("authz") + QChar(0x03A8) /* psi */, QString("user") + QChar(0x03A8) /* psi */, "pass");
 
31
                        QCOMPARE(message.getValue(), QByteArray("authz\xCE\xA8\0user\xCE\xA8\0pass", 19));
 
32
                }
 
33
};
 
34
 
 
35
QTTESTUTIL_REGISTER_TEST(PlainMessageTest);
 
36
#include "plainmessagetest.moc"