summaryrefslogtreecommitdiffstats
path: root/kopete/plugins/smpppdcs/unittest/clienttest.cpp
blob: 7e19290d5c9bd64bc9f5988977ce1ac23fbb6c2c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/*
	clienttest.cpp
 
	Copyright (c) 2006      by Heiko Schaefer        <heiko@rangun.de>
 
	Kopete    (c) 2002-2006 by the Kopete developers <kopete-devel@kde.org>
 
	*************************************************************************
	*                                                                       *
	* This program is free software; you can redistribute it and/or modify  *
	* it under the terms of the GNU General Public License as published by  *
	* the Free Software Foundation; version 2 of the License.               *
	*                                                                       *
	*************************************************************************
*/

#include "smpppdclient.h"

#include "clienttest.h"

ClientTest::ClientTest(const char * name)
        : KUnitTest::SlotTester(name) {}

ClientTest::~ClientTest() {}

void ClientTest::testInitIsReady() {
    SMPPPD::Client c;
    CHECK(c.isReady(), false);
}

void ClientTest::testAfterConnectIsReady() {
    SMPPPD::Client c;
    if(c.connect("warwar", 3185)) {
        CHECK(c.isReady(), true);
    } else {
        SKIP("Test skipped because no smpppd at warwar:3185");
    }
}

void ClientTest::testConnect() {
    SMPPPD::Client c;
    CHECK(c.connect("warwar", 3185), true);
    CHECK(c.connect("localhost", 3185), false);
}

void ClientTest::testCommunicationBeforeConnect() {
    SMPPPD::Client c;
    TQStringList l = c.getInterfaceConfigurations();

    CHECK(l.count() == 0, true);
    CHECK(c.statusInterface("ifcfg0"), false);
}

void ClientTest::testServerIDBeforeConnect() {
    SMPPPD::Client c;
    CHECK(c.serverID(), TQString());
}

void ClientTest::testServerVersionBeforeConnect() {
    SMPPPD::Client c;
    CHECK(c.serverVersion(), TQString());
}

void ClientTest::testCommunicationAfterConnect() {
    SMPPPD::Client c;
    if(c.connect("warwar", 3185)) {
        CHECK(c.getInterfaceConfigurations().count() > 0, true);
    } else {
        SKIP("Test skipped because no smpppd at warwar:3185");
    }
}

void ClientTest::testServerIDAfterConnect() {
    SMPPPD::Client c;
    if(c.connect("warwar", 3185)) {
        CHECK(c.serverID().isEmpty(), false);
    } else {
        SKIP("Test skipped because no smpppd at warwar:3185");
    }
}

void ClientTest::testServerVersionAfterConnect() {
    SMPPPD::Client c;
    if(c.connect("warwar", 3185)) {
        CHECK(c.serverVersion().isEmpty(), false);
    } else {
        SKIP("Test skipped because no smpppd at warwar:3185");
    }
}

void ClientTest::testCommunicationAfterDisconnect() {
    SMPPPD::Client c;
    if(c.connect("warwar", 3185)) {
        c.disconnect();
        CHECK(c.getInterfaceConfigurations().count() == 0, true);
    } else {
        SKIP("Test skipped because no smpppd at warwar:3185");
    }
}

void ClientTest::testServerIDAfterDisconnect() {
    SMPPPD::Client c;
    if(c.connect("warwar", 3185)) {
        c.disconnect();
        CHECK(c.serverID(), TQString());
    } else {
        SKIP("Test skipped because no smpppd at warwar:3185");
    }
}

void ClientTest::testServerVersionAfterDisconnect() {
    SMPPPD::Client c;
    if(c.connect("warwar", 3185)) {
        c.disconnect();
        CHECK(c.serverVersion(), TQString());
    } else {
        SKIP("Test skipped because no smpppd at warwar:3185");
    }
}

#include "clienttest.moc"