summary refs log tree commit diff stats
Commit message (Collapse)AuthorAgeFilesLines
* moved/fixed testshut2009-12-117-1/+1
|
* moved commands from fm.py to actions.py, cleanupshut2009-12-117-194/+213
|
* Restructurationhut2009-12-1037-199/+302
|
* random stuffhut2009-12-063-0/+23
|
* jungle color schemehut2009-12-061-0/+50
|
* Renamed / added colorschemeshut2009-12-063-38/+58
| | | | | Renamed Snow to Default Added a new black/white colorscheme which deserves the name Snow more.
* fix/clean ranger.helperhut2009-12-061-21/+23
|
* fixed directory testhut2009-12-062-21/+2
|
* "SettingsAware", random cleanupshut2009-12-0614-83/+115
|
* changing implementation of optionshut2009-12-0615-15/+118
|
* integrated history into environment classhut2009-12-051-30/+6
|
* History Object + Test Casehut2009-12-052-0/+94
|
* implemented searchinghut2009-12-045-1/+49
|
* fixed colorschemehut2009-12-041-1/+2
|
* improve bookmarks (delete, reload_if_outdated)hut2009-12-043-5/+72
|
* implemented Bookmarkshut2009-12-044-4/+99
|
* "openwith_quick" console mode addedhut2009-12-048-53/+317
|
* mime type support, integrated into colorschemeshut2009-12-035-6/+62
|
* translated mime type db generator into pythonhut2009-12-033-21/+16
|
* implemented a console (without commands)hut2009-12-028-67/+246
|
* reduce ESCDELAYhut2009-12-021-0/+4
|
* fixed non-accessible directorieshut2009-12-024-9/+13
|
* historyhut2009-12-024-2/+50
|
* scrollinghut2009-12-014-1/+34
|
* renamed api to helperhut2009-12-014-3/+3
| | | | since it had nothing to do with an api
* structural improvementshut2009-12-019-88/+148
|
* clean uphut2009-11-291-66/+0
|
* uml stuff (?_?)hut2009-11-294-42/+252
|
* mouse supporthut2009-11-298-16/+91
|
* random improvementshut2009-11-299-39/+107
|
* implemented colorschemes.hut2009-11-298-85/+151
|
* started to implement colorschemeshut2009-11-299-54/+83
|
* restructurationhut2009-11-2821-208/+133
|
* blubhut2009-11-2813-38/+264
|
* embedded wrapper.sh into ranger.pyhut2009-11-272-16/+12
|
* good thingshut2009-11-276-45/+76
|
* rename WStatusBar to WTitleBarhut2009-11-272-5/+5
|
* cd-after-exithut2009-11-272-4/+33
|
* scrolling & stuffhut2009-11-278-38/+150
|
* general improvementhut2009-11-2710-43/+125
|
* updated uml diagramshut2009-11-274-68/+1257
|
* more VROOMhut2009-11-2727-193/+475
|
* implemented more stuffhut2009-11-2513-75/+287
|
* added Bouml project (UML)hut2009-11-2412-0/+1563
|
* corrected test, added some stuffhut2009-11-245-14/+74
|
* stuffhut2009-11-246-9/+30
|
* tweakshut2009-11-245-20/+38
|
* better implementation of directories/fileshut2009-11-247-67/+157
|
* set the mtime of the directory after readinghut2009-11-231-1/+2
|
* test cases for directory.pyhut2009-11-233-0/+68
|
id=6a8656a06b209e7e181ad8670fe50b7e6fe89572'>^
406b821b ^

7f98e013 ^

406b821b ^










ac3e7dd9 ^
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
160
161
162
163
164
165
166

















                                           
                                                                          



                                       
                                                                              

                                                    


                                                             
               
       






                                             
                                                                          



                                       
                                                                              

                                        

                                                                                                             






                                                            


                                                                        
 





                                                       
                                                                          



                                       
                                                                              

                                        



                                                                                                            




                                                    
                                                                                          
 






                                                                  
                                                                   



                                       
                                                                     

                                        

                                                                                               






                                                            









                                                                         
                                                                          



                                       
                                                                              











                                                                              
                                                                          



                                       
                                                                              


                              
                                                                                                   


                                           
                                                       

                                        

                                                                                                             










                                                                        
 
#include <glib.h>
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
#include <cmocka.h>
#include <stdlib.h>
#include <string.h>

#include <stabber.h>
#include <expect.h>

#include "proftest.h"

void
send_software_version_request(void **state)
{
    prof_connect();
    stbbr_send(
        "<presence to='stabber@localhost' from='buddy1@localhost/mobile'>"
            "<priority>10</priority>"
            "<status>I'm here</status>"
        "</presence>"
    );
    assert_true(prof_output_exact("Buddy1 (mobile) is online, \"I'm here\""));
    prof_input("/software buddy1@localhost/mobile");

    assert_true(stbbr_received(
        "<iq id='*' to='buddy1@localhost/mobile' type='get'>"
            "<query xmlns='jabber:iq:version'/>"
        "</iq>"
    ));
}

void
display_software_version_result(void **state)
{
    prof_connect();
    stbbr_send(
        "<presence to='stabber@localhost' from='buddy1@localhost/mobile'>"
            "<priority>10</priority>"
            "<status>I'm here</status>"
        "</presence>"
    );
    assert_true(prof_output_exact("Buddy1 (mobile) is online, \"I'm here\""));

    stbbr_for_query("jabber:iq:version",
        "<iq id='*' type='result' lang='en' to='stabber@localhost/profanity' from='buddy1@localhost/mobile'>"
            "<query xmlns='jabber:iq:version'>"
                "<name>Profanity</name>"
                "<version>0.4.7dev.master.2cb2f83</version>"
            "</query>"
        "</iq>"
    );
    prof_input("/software buddy1@localhost/mobile");

//    assert_true(prof_output_exact("buddy1@localhost/mobile:"));
//    assert_true(prof_output_exact("Name    : Profanity"));
    assert_true(prof_output_exact("Version : 0.4.7dev.master.2cb2f83"));
}

void
shows_message_when_software_version_error(void **state)
{
    prof_connect();
    stbbr_send(
        "<presence to='stabber@localhost' from='buddy1@localhost/mobile'>"
            "<priority>10</priority>"
            "<status>I'm here</status>"
        "</presence>"
    );
    assert_true(prof_output_exact("Buddy1 (mobile) is online, \"I'm here\""));

    stbbr_for_query("jabber:iq:version",
        "<iq id='*' lang='en' type='error' to='stabber@localhost/profanity' from='buddy1@localhost/laptop'>"
            "<query xmlns='jabber:iq:version'/>"
            "<error code='503' type='cancel'>"
                "<service-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>"
            "</error>"
        "</iq>"
    );
    prof_input("/software buddy1@localhost/laptop");

    assert_true(prof_output_exact("Could not get software version: service-unavailable"));
}

// Typical use case for gateways that don't support resources
void
display_software_version_result_when_from_domainpart(void **state)
{
    prof_connect();
    stbbr_send(
        "<presence to='stabber@localhost' from='buddy1@localhost'>"
            "<priority>10</priority>"
            "<status>I'm here</status>"
        "</presence>"
    );
    assert_true(prof_output_exact("Buddy1 is online, \"I'm here\""));

    stbbr_for_query("jabber:iq:version",
        "<iq id='*' type='result' lang='en' to='stabber@localhost/profanity' from='localhost'>"
            "<query xmlns='jabber:iq:version'>"
                "<name>Some Gateway</name>"
                "<version>1.0</version>"
            "</query>"
        "</iq>"
    );
    prof_input("/software buddy1@localhost/__prof_default");

//    assert_true(prof_output_exact("buddy1@localhost/__prof_default:"));
//    assert_true(prof_output_exact("Name    : Some Gateway"));
    assert_true(prof_output_exact("Version : 1.0"));
}

void
show_message_in_chat_window_when_no_resource(void **state)
{
    prof_connect();
    stbbr_send(
        "<presence to='stabber@localhost' from='buddy1@localhost/mobile'>"
            "<priority>10</priority>"
            "<status>I'm here</status>"
        "</presence>"
    );
    assert_true(prof_output_exact("Buddy1 (mobile) is online, \"I'm here\""));

    prof_input("/msg Buddy1");
    prof_input("/software");

    assert_true(prof_output_exact("Unknown resource for /software command."));
}

void
display_software_version_result_in_chat(void **state)
{
    prof_connect();
    stbbr_send(
        "<presence to='stabber@localhost' from='buddy1@localhost/mobile'>"
            "<priority>10</priority>"
            "<status>I'm here</status>"
        "</presence>"
    );
    assert_true(prof_output_exact("Buddy1 (mobile) is online, \"I'm here\""));
    prof_input("/msg Buddy1");

    stbbr_send(
        "<message id='message1' to='stabber@localhost' from='buddy1@localhost/mobile' type='chat'>"
            "<body>Here's a message</body>"
        "</message>"
    );
    assert_true(prof_output_exact("Here's a message"));

    stbbr_for_query("jabber:iq:version",
        "<iq id='*' type='result' lang='en' to='stabber@localhost/profanity' from='buddy1@localhost/mobile'>"
            "<query xmlns='jabber:iq:version'>"
                "<name>Profanity</name>"
                "<version>0.4.7dev.master.2cb2f83</version>"
            "</query>"
        "</iq>"
    );

    prof_input("/software");

//    assert_true(prof_output_exact("buddy1@localhost/mobile:"));
//    assert_true(prof_output_exact("Name    : Profanity"));
    assert_true(prof_output_exact("Version : 0.4.7dev.master.2cb2f83"));
}