about summary refs log tree commit diff stats
path: root/stabbertests
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-05-17 22:05:43 +0100
committerJames Booth <boothj5@gmail.com>2015-05-17 22:05:43 +0100
commit2c5b44421e1b3a163ce33249f9d0b1567d411b16 (patch)
tree5ba771ddcc003ef7d86e9585c87dd4b11af44f5a /stabbertests
parent97c5072f56b992d3bf2e4c3550a8010f9638b80a (diff)
downloadprofani-tty-2c5b44421e1b3a163ce33249f9d0b1567d411b16.tar.gz
Added initial stabber test
Diffstat (limited to 'stabbertests')
-rw-r--r--stabbertests/proftest.c11
-rw-r--r--stabbertests/proftest.h1
-rw-r--r--stabbertests/test_connect.c31
-rw-r--r--stabbertests/test_connect.h2
-rw-r--r--stabbertests/testsuite.c2
5 files changed, 42 insertions, 5 deletions
diff --git a/stabbertests/proftest.c b/stabbertests/proftest.c
index d15b9cbf..d5fdeb0a 100644
--- a/stabbertests/proftest.c
+++ b/stabbertests/proftest.c
@@ -25,10 +25,19 @@
 #include "otr/otr.h"
 #endif
 
-
 #define XDG_CONFIG_HOME "./stabbertests/files/xdg_config_home"
 #define XDG_DATA_HOME   "./stabbertests/files/xdg_data_home"
 
+void
+prof_process_xmpp(void)
+{
+    int i = 0;
+    while (i < 20) {
+        jabber_process_events(10);
+        i++;
+    }
+}
+
 gboolean
 _create_dir(char *name)
 {
diff --git a/stabbertests/proftest.h b/stabbertests/proftest.h
index d35daae4..e0b6dded 100644
--- a/stabbertests/proftest.h
+++ b/stabbertests/proftest.h
@@ -1,2 +1,3 @@
 void init_prof_test(void **state);
 void close_prof_test(void **state);
+void prof_process_xmpp(void);
diff --git a/stabbertests/test_connect.c b/stabbertests/test_connect.c
index 1ddc9849..7a5c464a 100644
--- a/stabbertests/test_connect.c
+++ b/stabbertests/test_connect.c
@@ -4,9 +4,36 @@
 #include <setjmp.h>
 #include <cmocka.h>
 #include <stdlib.h>
+#include <string.h>
+
+#include <stabber.h>
+
+#include "proftest.h"
+#include "xmpp/xmpp.h"
+#include "ui/stub_ui.h"
+#include "command/command.h"
 
 void
-connect_with_no_jid(void **state)
+connect_with_jid(void **state)
 {
-    assert_true(1);
+    char *connect = "/connect stabber@localhost port 5230";
+    char *password = "password";
+
+    if (stbbr_start(5230) != 0) {
+        assert_true(FALSE);
+        return;
+    }
+
+    stbbr_auth_passwd(password);
+    will_return(ui_ask_password, strdup(password));
+
+    expect_cons_show("Connecting as stabber@localhost");
+
+    cmd_process_input(strdup(connect));
+    prof_process_xmpp();
+
+    jabber_conn_status_t status = jabber_get_connection_status();
+    assert_true(status == JABBER_CONNECTED);
+
+    stbbr_stop();
 }
diff --git a/stabbertests/test_connect.h b/stabbertests/test_connect.h
index 887cec73..9716c6a9 100644
--- a/stabbertests/test_connect.h
+++ b/stabbertests/test_connect.h
@@ -1 +1 @@
-void connect_with_no_jid(void **state);
+void connect_with_jid(void **state);
diff --git a/stabbertests/testsuite.c b/stabbertests/testsuite.c
index e4a220d7..467884ff 100644
--- a/stabbertests/testsuite.c
+++ b/stabbertests/testsuite.c
@@ -15,7 +15,7 @@
 int main(int argc, char* argv[]) {
 
     const UnitTest all_tests[] = {
-        unit_test_setup_teardown(connect_with_no_jid,
+        unit_test_setup_teardown(connect_with_jid,
             init_prof_test,
             close_prof_test),
     };
an> ^
ee9a9237 ^
33352536 ^
6030d7e2 ^
261b1b80 ^
6030d7e2 ^
ee9a9237 ^
33352536 ^







bfcc0f85 ^
33352536 ^
bfcc0f85 ^
9d27e966 ^
33352536 ^
bfcc0f85 ^
33352536 ^

9d27e966 ^
33352536 ^

ee9a9237 ^
6030d7e2 ^
ee9a9237 ^
33352536 ^


ee9a9237 ^
33352536 ^



b8475380 ^
7a583220 ^
33352536 ^

6030d7e2 ^
3d6450f2 ^
3d6450f2 ^
6030d7e2 ^
ee9a9237 ^
6030d7e2 ^
ee9a9237 ^
6030d7e2 ^
ee9a9237 ^
33352536 ^
6030d7e2 ^
ee9a9237 ^
6030d7e2 ^

ee9a9237 ^
6030d7e2 ^
ee9a9237 ^
33352536 ^
6030d7e2 ^
ee9a9237 ^
6030d7e2 ^

9d27e966 ^
33352536 ^

ee9a9237 ^
6030d7e2 ^
ee9a9237 ^
33352536 ^
6030d7e2 ^

3d6450f2 ^

6030d7e2 ^
ee9a9237 ^
6030d7e2 ^
ee9a9237 ^
6030d7e2 ^
ee9a9237 ^
33352536 ^
6030d7e2 ^
ee9a9237 ^
6030d7e2 ^

ee9a9237 ^
6030d7e2 ^
ee9a9237 ^
33352536 ^
6030d7e2 ^
ee9a9237 ^
6030d7e2 ^

ee9a9237 ^
6030d7e2 ^
ee9a9237 ^
33352536 ^
6030d7e2 ^
ee9a9237 ^
6030d7e2 ^

9d27e966 ^
33352536 ^

ee9a9237 ^
6030d7e2 ^
ee9a9237 ^
33352536 ^
6030d7e2 ^

b31455f8 ^


f1eade72 ^
6030d7e2 ^
9b16f190 ^
6030d7e2 ^
9b16f190 ^
bfcc0f85 ^
438e5a0d ^



6ee77ba7 ^
ee9a9237 ^
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159