about summary refs log tree commit diff stats
path: root/src/config/account.h
Commit message (Expand)AuthorAgeFilesLines
* Apply coding styleMichael Vetter2020-07-071-40/+41
* Revert "Apply coding style"Michael Vetter2020-07-071-41/+40
* Apply coding styleMichael Vetter2020-07-071-40/+41
* Add option for legacy authenticationDmitry Podgorny2020-06-051-1/+3
* Add vim modelineMichael Vetter2019-11-131-0/+1
* Add OMEMO policyPaul Fariello2019-04-171-1/+5
* Update copyright to include 2019Michael Vetter2019-01-221-1/+1
* Override account options with connect optionsDmitry Podgorny2018-11-071-0/+3
* Update copyrightJames Booth2018-01-211-1/+1
* Update CopyrightJames Booth2017-01-281-1/+1
* Allow clearing account resourceJames Booth2016-11-221-1/+1
* Make header defines consistentJames Booth2016-07-241-2/+2
* Update GPL link in headersJames Booth2016-07-241-1/+1
* Updated copyrightJames Booth2016-02-141-1/+1
* Added account theme propertyJames Booth2016-01-221-1/+2
* Applied coding style to account.hJames Booth2015-10-251-7/+7
* Force tls on all connections, add tls policy account propertyJames Booth2015-10-181-1/+3
* Add ability to script commands after connectJames Booth2015-10-151-1/+2
* Merge branch 'master' into pgpJames Booth2015-04-231-2/+1
|\
| * Tidied account loginJames Booth2015-04-231-2/+1
* | Added pgpkeyid account setting, send signed presenceJames Booth2015-03-231-1/+2
|/
* Updated copyrightJames Booth2015-02-101-1/+1
* Add support for evaluated passwordPeter Vilim2015-01-061-1/+2
* Added license exemption for OpenSSL to source headersJames Booth2014-08-241-0/+12
* Implemented per contact OTR policy settingJames Booth2014-05-111-1/+6
* Added OTR policy account preferenceJames Booth2014-05-111-1/+2
* Updated copyrightJames Booth2014-03-091-1/+1
* Refactored ProfAccount creationJames Booth2014-01-221-0/+58
+0100 committer James Booth <boothj5@gmail.com> 2015-06-18 01:34:27 +0100 Added initial /pgp start checks' href='/danisanti/profani-tty/commit/tests/unittests/test_cmd_pgp.c?id=ea99012d9bf1b8de356d3d9beb7cc45c3f456bad'>ea99012d ^
ea99012d ^
















ea99012d ^

ea99012d ^



3bb1f124 ^
ea99012d ^


81190251 ^
ea99012d ^
ea99012d ^











a952776b ^
ea99012d ^
a952776b ^
ea99012d ^











85cc5ab5 ^


85cc5ab5 ^



81190251 ^
85cc5ab5 ^
85cc5ab5 ^

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







                   
                   
 
                              
                      


                       

                      
                    

                                                   

                             
                                                    
 
                                                   
                        

 

                                                                                  



                                      
                                                    


                                                                       
                                                      
                        
















                                                                      

                                                                           



                                      
                                                         


                                                                                      
                                                      
                        











                                                                     
                                                                  
 
                                                                   











                                                                        


                                                             



                                                                                              
                                                   
                        

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

#include "config.h"

#include "command/cmd_funcs.h"
#include "xmpp/xmpp.h"

#include "ui/stub_ui.h"

#define CMD_PGP "/pgp"

#ifdef HAVE_LIBGPGME
void cmd_pgp_shows_usage_when_no_args(void **state)
{
    gchar *args[] = { NULL };

    expect_string(cons_bad_cmd_usage, cmd, CMD_PGP);

    gboolean result = cmd_pgp(NULL, CMD_PGP, args);
    assert_true(result);
}

void cmd_pgp_start_shows_message_when_connection(jabber_conn_status_t conn_status)
{
    gchar *args[] = { "start", NULL };
    ProfWin window;
    window.type = WIN_CHAT;

    will_return(connection_get_status, conn_status);

    expect_cons_show("You must be connected to start PGP encrpytion.");

    gboolean result = cmd_pgp(&window, CMD_PGP, args);
    assert_true(result);
}

void cmd_pgp_start_shows_message_when_disconnected(void **state)
{
    cmd_pgp_start_shows_message_when_connection(JABBER_DISCONNECTED);
}

void cmd_pgp_start_shows_message_when_disconnecting(void **state)
{
    cmd_pgp_start_shows_message_when_connection(JABBER_DISCONNECTING);
}

void cmd_pgp_start_shows_message_when_connecting(void **state)
{
    cmd_pgp_start_shows_message_when_connection(JABBER_CONNECTING);
}

void cmd_pgp_start_shows_message_when_no_arg_in_wintype(win_type_t wintype)
{
    gchar *args[] = { "start", NULL };
    ProfWin window;
    window.type = wintype;

    will_return(connection_get_status, JABBER_CONNECTED);

    expect_cons_show("You must be in a regular chat window to start PGP encrpytion.");

    gboolean result = cmd_pgp(&window, CMD_PGP, args);
    assert_true(result);
}

void cmd_pgp_start_shows_message_when_no_arg_in_console(void **state)
{
    cmd_pgp_start_shows_message_when_no_arg_in_wintype(WIN_CONSOLE);
}

void cmd_pgp_start_shows_message_when_no_arg_in_muc(void **state)
{
    cmd_pgp_start_shows_message_when_no_arg_in_wintype(WIN_MUC);
}

void cmd_pgp_start_shows_message_when_no_arg_in_conf(void **state)
{
    cmd_pgp_start_shows_message_when_no_arg_in_wintype(WIN_CONFIG);
}

void cmd_pgp_start_shows_message_when_no_arg_in_private(void **state)
{
    cmd_pgp_start_shows_message_when_no_arg_in_wintype(WIN_PRIVATE);
}

void cmd_pgp_start_shows_message_when_no_arg_in_xmlconsole(void **state)
{
    cmd_pgp_start_shows_message_when_no_arg_in_wintype(WIN_XML);
}

#else
void cmd_pgp_shows_message_when_pgp_unsupported(void **state)
{
    gchar *args[] = { "gen", NULL };

    expect_cons_show("This version of Profanity has not been built with PGP support enabled");

    gboolean result = cmd_pgp(NULL, CMD_PGP, args);
    assert_true(result);
}
#endif