EnterDeviceGroup tests, plus a couple of output tweaks to decrease spam. sync
authorKrista 'DarthMama' Bennett <krista@pep.foundation>
Wed, 03 Apr 2019 17:15:17 +0200
branchsync
changeset 3436bf27fae218c5
parent 3435 a6075bb685f2
child 3437 50ec7a39e522
EnterDeviceGroup tests, plus a couple of output tweaks to decrease spam.
src/pEpEngine.c
test/Makefile
test/include/EnterLeaveDeviceGroupTests.h
test/src/EngineTestSuite.cc
test/src/engine_tests/BloblistTests.cc
test/src/engine_tests/EnterLeaveDeviceGroupTests.cc
test/src/pEpTestOutput.cc
     1.1 --- a/src/pEpEngine.c	Tue Apr 02 18:01:01 2019 +0200
     1.2 +++ b/src/pEpEngine.c	Wed Apr 03 17:15:17 2019 +0200
     1.3 @@ -1800,7 +1800,10 @@
     1.4          const char *comment
     1.5      )
     1.6  {
     1.7 -#ifndef NDEBUG
     1.8 +
     1.9 +// N.B. If testing (so NDEBUG not defined) but this message is spam,
    1.10 +//      put -D_PEP_SERVICE_LOG_OFF into CFLAGS/CXXFLAGS     
    1.11 +#if !defined(NDEBUG) && !defined(_PEP_SERVICE_LOG_OFF)
    1.12      fprintf(stdout, "\n*** %s %s %s %s\n", title, entity, description, comment);
    1.13      session->service_log = true;
    1.14  #endif
     2.1 --- a/test/Makefile	Tue Apr 02 18:01:01 2019 +0200
     2.2 +++ b/test/Makefile	Wed Apr 03 17:15:17 2019 +0200
     2.3 @@ -130,7 +130,7 @@
     2.4  
     2.5  .PHONY: clean
     2.6  clean:
     2.7 -	$(RM) $(TARGET) $(TARGET).o $(OBJS) $(notdir $(basename $(OBJS))) $(DEPS)
     2.8 +	$(RM) $(TARGET) $(TARGET).o $(TARGET).d $(OBJS) $(notdir $(basename $(OBJS))) $(DEPS)
     2.9  	$(RM) $(HERE)/*Tests msg_2.0.asc $(HERE)/pEp_test_home
    2.10  
    2.11  # If only the goal 'clean' is given, do not generate and include the '%.d' files.¬
     3.1 --- a/test/include/EnterLeaveDeviceGroupTests.h	Tue Apr 02 18:01:01 2019 +0200
     3.2 +++ b/test/include/EnterLeaveDeviceGroupTests.h	Wed Apr 03 17:15:17 2019 +0200
     3.3 @@ -16,10 +16,11 @@
     3.4          void check_enter_device_group_no_own();    
     3.5          void check_enter_device_group_one_own_empty();    
     3.6          void check_enter_device_group_one_own_one();    
     3.7 -        void check_enter_device_group_one_own_many();    
     3.8 +        void check_enter_device_group_one_reversed_by_many();    
     3.9          void check_enter_device_group_one_own_single_not_me();    
    3.10          void check_enter_device_group_one_own_single_many_w_not_me();    
    3.11          void check_enter_device_group_many_empty();    
    3.12 +        void check_enter_device_group_many_own_add_explicit();
    3.13          void check_enter_device_group_many_own_one();    
    3.14          void check_enter_device_group_many_own_many();    
    3.15          void check_enter_device_group_many_own_many_w_not_me();    
     4.1 --- a/test/src/EngineTestSuite.cc	Tue Apr 02 18:01:01 2019 +0200
     4.2 +++ b/test/src/EngineTestSuite.cc	Wed Apr 03 17:15:17 2019 +0200
     4.3 @@ -9,6 +9,7 @@
     4.4  #include <iostream>
     4.5  #include <sys/types.h>
     4.6  #include <sys/stat.h>
     4.7 +#include <cpptest.h>
     4.8  
     4.9  #include <string>
    4.10  #include <vector>
    4.11 @@ -224,7 +225,7 @@
    4.12      success = system("gpgconf --create-socketdir");
    4.13      if (success != 0)
    4.14          throw std::runtime_error("RESTORE: Error when executing 'gpgconf --create-socketdir'.");        
    4.15 -    system("gpg-connect-agent /bye");   // Just in case - otherwise, we die on MacOS sometimes. Is this enough??
    4.16 +    system("gpg-connect-agent /bye 2>/dev/null");   // Just in case - otherwise, we die on MacOS sometimes. Is this enough??
    4.17  #endif
    4.18  #endif
    4.19  
     5.1 --- a/test/src/engine_tests/BloblistTests.cc	Tue Apr 02 18:01:01 2019 +0200
     5.2 +++ b/test/src/engine_tests/BloblistTests.cc	Wed Apr 03 17:15:17 2019 +0200
     5.3 @@ -7,6 +7,7 @@
     5.4  #include <iostream>
     5.5  #include <fstream>
     5.6  #include <assert.h>
     5.7 +#include <cpptest.h>
     5.8  
     5.9  #include "bloblist.h"
    5.10  #include "TestConstants.h"
     6.1 --- a/test/src/engine_tests/EnterLeaveDeviceGroupTests.cc	Tue Apr 02 18:01:01 2019 +0200
     6.2 +++ b/test/src/engine_tests/EnterLeaveDeviceGroupTests.cc	Wed Apr 03 17:15:17 2019 +0200
     6.3 @@ -23,14 +23,16 @@
     6.4                                                                        static_cast<Func>(&EnterLeaveDeviceGroupTests::check_enter_device_group_one_own_empty)));
     6.5      add_test_to_suite(std::pair<std::string, void (Test::Suite::*)()>(string("EnterLeaveDeviceGroupTests::check_enter_device_group_one_own_one"),
     6.6                                                                        static_cast<Func>(&EnterLeaveDeviceGroupTests::check_enter_device_group_one_own_one)));
     6.7 -    add_test_to_suite(std::pair<std::string, void (Test::Suite::*)()>(string("EnterLeaveDeviceGroupTests::check_enter_device_group_one_own_many"),
     6.8 -                                                                      static_cast<Func>(&EnterLeaveDeviceGroupTests::check_enter_device_group_one_own_many)));
     6.9 +    add_test_to_suite(std::pair<std::string, void (Test::Suite::*)()>(string("EnterLeaveDeviceGroupTests::check_enter_device_group_one_reversed_by_many"),
    6.10 +                                                                      static_cast<Func>(&EnterLeaveDeviceGroupTests::check_enter_device_group_one_reversed_by_many)));
    6.11      add_test_to_suite(std::pair<std::string, void (Test::Suite::*)()>(string("EnterLeaveDeviceGroupTests::check_enter_device_group_one_own_single_not_me"),
    6.12                                                                        static_cast<Func>(&EnterLeaveDeviceGroupTests::check_enter_device_group_one_own_single_not_me)));
    6.13      add_test_to_suite(std::pair<std::string, void (Test::Suite::*)()>(string("EnterLeaveDeviceGroupTests::check_enter_device_group_one_own_single_many_w_not_me"),
    6.14                                                                        static_cast<Func>(&EnterLeaveDeviceGroupTests::check_enter_device_group_one_own_single_many_w_not_me)));
    6.15      add_test_to_suite(std::pair<std::string, void (Test::Suite::*)()>(string("EnterLeaveDeviceGroupTests::check_enter_device_group_many_empty"),
    6.16                                                                        static_cast<Func>(&EnterLeaveDeviceGroupTests::check_enter_device_group_many_empty)));
    6.17 +    add_test_to_suite(std::pair<std::string, void (Test::Suite::*)()>(string("EnterLeaveDeviceGroupTests::check_enter_device_group_many_own_add_explicit"),
    6.18 +                                                                      static_cast<Func>(&EnterLeaveDeviceGroupTests::check_enter_device_group_many_own_add_explicit)));
    6.19      add_test_to_suite(std::pair<std::string, void (Test::Suite::*)()>(string("EnterLeaveDeviceGroupTests::check_enter_device_group_many_own_one"),
    6.20                                                                        static_cast<Func>(&EnterLeaveDeviceGroupTests::check_enter_device_group_many_own_one)));
    6.21      add_test_to_suite(std::pair<std::string, void (Test::Suite::*)()>(string("EnterLeaveDeviceGroupTests::check_enter_device_group_many_own_many"),
    6.22 @@ -54,7 +56,8 @@
    6.23      
    6.24      status = update_identity(session, alice_id);
    6.25      TEST_ASSERT(!(alice_id->flags & PEP_idf_devicegroup));
    6.26 -
    6.27 +    
    6.28 +    free_identity(alice_id);
    6.29      TEST_ASSERT(true);
    6.30  }
    6.31  
    6.32 @@ -69,16 +72,31 @@
    6.33  
    6.34      TEST_ASSERT_MSG(status == PEP_STATUS_OK, tl_status_string(status));
    6.35      status = myself(session, alice_id);
    6.36 -
    6.37 +    TEST_ASSERT(status == PEP_STATUS_OK);
    6.38      TEST_ASSERT(alice_id->me);
    6.39      TEST_ASSERT(strcmp(alice_id->fpr, "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97") == 0);
    6.40 +
    6.41 +    pEp_identity* bob_id = NULL;
    6.42 +    status = set_up_ident_from_scratch(session,
    6.43 +                                "test_keys/pub/pep-test-bob-0xC9C2EE39_pub.asc",
    6.44 +                                "pep.test.bob@pep-project.org", "BFCDB7F301DEEEBBF947F29659BFF488C9C2EE39", 
    6.45 +                                "BOB", "Bob is not Alice", &bob_id, false
    6.46 +                        );    
    6.47 +    status = update_identity(session, bob_id);
    6.48 +    TEST_ASSERT(status == PEP_STATUS_OK);    
    6.49 +
    6.50      status = enter_device_group(session, NULL);
    6.51      TEST_ASSERT_MSG(status == PEP_STATUS_OK, tl_status_string(status));
    6.52      
    6.53      status = myself(session, alice_id);
    6.54      TEST_ASSERT(status == PEP_STATUS_OK);    
    6.55      TEST_ASSERT_MSG(alice_id->flags & PEP_idf_devicegroup, tl_ident_flags_String(alice_id->flags).c_str());
    6.56 -                        
    6.57 +
    6.58 +    status = update_identity(session, bob_id);
    6.59 +    TEST_ASSERT_MSG(!(bob_id->flags & PEP_idf_devicegroup), tl_ident_flags_String(alice_id->flags).c_str());
    6.60 +
    6.61 +    free_identity(alice_id);
    6.62 +    free_identity(bob_id);
    6.63      TEST_ASSERT(true);
    6.64  }
    6.65  
    6.66 @@ -104,33 +122,625 @@
    6.67      TEST_ASSERT(status == PEP_STATUS_OK);    
    6.68      TEST_ASSERT_MSG(alice_id->flags & PEP_idf_devicegroup, tl_ident_flags_String(alice_id->flags).c_str());
    6.69                          
    6.70 -    TEST_ASSERT(true);
    6.71 +    free_identity(alice_id);                        
    6.72  }
    6.73  
    6.74 -void EnterLeaveDeviceGroupTests::check_enter_device_group_one_own_many() {    
    6.75 -    TEST_ASSERT(true);
    6.76 +void EnterLeaveDeviceGroupTests::check_enter_device_group_one_reversed_by_many() {    
    6.77 +    pEp_identity* alice_id = NULL;
    6.78 +    TEST_ASSERT(slurp_and_import_key(session, "test_keys/pub/pep-test-alice-0x6FF00E97_pub.asc"));    
    6.79 +    PEP_STATUS status = set_up_ident_from_scratch(session,
    6.80 +                                "test_keys/priv/pep-test-alice-0x6FF00E97_priv.asc",
    6.81 +                                "pep.test.alice@pep-project.org", "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97", 
    6.82 +                                "ALICE", "Alice in Wonderland", &alice_id, true
    6.83 +                        );    
    6.84 +
    6.85 +    TEST_ASSERT_MSG(status == PEP_STATUS_OK, tl_status_string(status));
    6.86 +    status = myself(session, alice_id);
    6.87 +
    6.88 +    pEp_identity* alice_id2 = NULL;
    6.89 +    status = set_up_ident_from_scratch(session,
    6.90 +                                "test_keys/priv/pep-test-alice-0x6FF00E97_priv.asc",
    6.91 +                                "pep.test.alice_2@pep-project.org", "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97", 
    6.92 +                                "ALICE", "Bob is Alice", &alice_id2, true
    6.93 +                        );    
    6.94 +
    6.95 +    pEp_identity* alice_id3 = NULL;
    6.96 +    status = set_up_ident_from_scratch(session,
    6.97 +                                "test_keys/priv/pep-test-alice-0x6FF00E97_priv.asc",
    6.98 +                                "pep.test.alice_3@pep-project.org", "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97", 
    6.99 +                                "ALICE", "Carol is Alice", &alice_id3, true
   6.100 +                        );    
   6.101 +
   6.102 +    // First, add Alice to device group and ensure the other two are not added
   6.103 +    identity_list* ids_to_group = new_identity_list(alice_id);
   6.104 +    status = enter_device_group(session, ids_to_group);
   6.105 +    TEST_ASSERT_MSG(status == PEP_STATUS_OK, tl_status_string(status));
   6.106 +
   6.107 +    status = myself(session, alice_id);
   6.108 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.109 +    TEST_ASSERT_MSG(alice_id->flags & PEP_idf_devicegroup, tl_ident_flags_String(alice_id->flags).c_str());
   6.110 +    
   6.111 +    status = myself(session, alice_id2);
   6.112 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.113 +    TEST_ASSERT_MSG(!(alice_id2->flags & PEP_idf_devicegroup), tl_ident_flags_String(alice_id2->flags).c_str());
   6.114 +
   6.115 +    status = myself(session, alice_id3);
   6.116 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.117 +    TEST_ASSERT_MSG(!(alice_id3->flags & PEP_idf_devicegroup), tl_ident_flags_String(alice_id3->flags).c_str());
   6.118 +
   6.119 +    // Note: this is a shortcut to omit alice_id from ident list
   6.120 +    ids_to_group->ident = alice_id2;
   6.121 +    
   6.122 +    identity_list_add(ids_to_group, alice_id3);
   6.123 +    
   6.124 +    // Add 2 and 3 to device group (hopefully removing alice_id)
   6.125 +    status = enter_device_group(session, ids_to_group);
   6.126 +    TEST_ASSERT_MSG(status == PEP_STATUS_OK, tl_status_string(status));
   6.127 +
   6.128 +    // Is alice_id in? (shouldn't be)
   6.129 +    status = myself(session, alice_id);
   6.130 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.131 +    TEST_ASSERT_MSG(!(alice_id->flags & PEP_idf_devicegroup), tl_ident_flags_String(alice_id->flags).c_str());
   6.132 +    
   6.133 +    // are 2 and 3 in? (should be)
   6.134 +    status = myself(session, alice_id2);
   6.135 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.136 +    TEST_ASSERT_MSG(alice_id2->flags & PEP_idf_devicegroup, tl_ident_flags_String(alice_id2->flags).c_str());
   6.137 +
   6.138 +    status = myself(session, alice_id3);
   6.139 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.140 +    TEST_ASSERT_MSG(alice_id3->flags & PEP_idf_devicegroup, tl_ident_flags_String(alice_id3->flags).c_str());
   6.141 +                        
   6.142 +    free_identity_list(ids_to_group);
   6.143 +    free_identity(alice_id);
   6.144  }
   6.145  
   6.146  void EnterLeaveDeviceGroupTests::check_enter_device_group_one_own_single_not_me() {    
   6.147 -    TEST_ASSERT(true);
   6.148 +    pEp_identity* alice_id = NULL;
   6.149 +    TEST_ASSERT(slurp_and_import_key(session, "test_keys/pub/pep-test-alice-0x6FF00E97_pub.asc"));    
   6.150 +    PEP_STATUS status = set_up_ident_from_scratch(session,
   6.151 +                                "test_keys/priv/pep-test-alice-0x6FF00E97_priv.asc",
   6.152 +                                "pep.test.alice@pep-project.org", "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97", 
   6.153 +                                "ALICE", "Alice in Wonderland", &alice_id, true
   6.154 +                        );    
   6.155 +
   6.156 +    TEST_ASSERT_MSG(status == PEP_STATUS_OK, tl_status_string(status));
   6.157 +    status = myself(session, alice_id);
   6.158 +
   6.159 +    TEST_ASSERT(alice_id->me);
   6.160 +    TEST_ASSERT(strcmp(alice_id->fpr, "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97") == 0);
   6.161 +    identity_list* ids_to_group = new_identity_list(alice_id);
   6.162 +    status = enter_device_group(session, ids_to_group);
   6.163 +    TEST_ASSERT_MSG(status == PEP_STATUS_OK, tl_status_string(status));
   6.164 +    
   6.165 +    status = myself(session, alice_id);
   6.166 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.167 +    TEST_ASSERT_MSG(alice_id->flags & PEP_idf_devicegroup, tl_ident_flags_String(alice_id->flags).c_str());
   6.168 +
   6.169 +    pEp_identity* bob_id = NULL;
   6.170 +    status = set_up_ident_from_scratch(session,
   6.171 +                                "test_keys/pub/pep-test-bob-0xC9C2EE39_pub.asc",
   6.172 +                                "pep.test.bob@pep-project.org", "BFCDB7F301DEEEBBF947F29659BFF488C9C2EE39", 
   6.173 +                                "BOB", "Bob is not Alice", &bob_id, false
   6.174 +                        );    
   6.175 +
   6.176 +    ids_to_group->ident = bob_id;
   6.177 +    status = enter_device_group(session, ids_to_group);
   6.178 +    TEST_ASSERT_MSG(status != PEP_STATUS_OK, tl_status_string(status));
   6.179 +    status = update_identity(session, bob_id);
   6.180 +    TEST_ASSERT_MSG(!(bob_id->flags & PEP_idf_devicegroup), tl_ident_flags_String(alice_id->flags).c_str());
   6.181 +
   6.182 +    status = myself(session, alice_id);    
   6.183 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.184 +    TEST_ASSERT_MSG(alice_id->flags & PEP_idf_devicegroup, tl_ident_flags_String(alice_id->flags).c_str());
   6.185 +                        
   6.186 +    free_identity(alice_id);                        
   6.187 +    free_identity_list(ids_to_group);
   6.188  }
   6.189  
   6.190  void EnterLeaveDeviceGroupTests::check_enter_device_group_one_own_single_many_w_not_me() {    
   6.191 -    TEST_ASSERT(true);
   6.192 +    pEp_identity* alice_id = NULL;
   6.193 +    TEST_ASSERT(slurp_and_import_key(session, "test_keys/pub/pep-test-alice-0x6FF00E97_pub.asc"));    
   6.194 +    PEP_STATUS status = set_up_ident_from_scratch(session,
   6.195 +                                "test_keys/priv/pep-test-alice-0x6FF00E97_priv.asc",
   6.196 +                                "pep.test.alice@pep-project.org", "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97", 
   6.197 +                                "ALICE", "Alice in Wonderland", &alice_id, true
   6.198 +                        );    
   6.199 +
   6.200 +    TEST_ASSERT_MSG(status == PEP_STATUS_OK, tl_status_string(status));
   6.201 +    status = myself(session, alice_id);
   6.202 +
   6.203 +    TEST_ASSERT(alice_id->me);
   6.204 +    TEST_ASSERT(strcmp(alice_id->fpr, "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97") == 0);
   6.205 +    identity_list* ids_to_group = new_identity_list(alice_id);
   6.206 +    status = enter_device_group(session, ids_to_group);
   6.207 +    TEST_ASSERT_MSG(status == PEP_STATUS_OK, tl_status_string(status));
   6.208 +    
   6.209 +    status = myself(session, alice_id);
   6.210 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.211 +    TEST_ASSERT_MSG(alice_id->flags & PEP_idf_devicegroup, tl_ident_flags_String(alice_id->flags).c_str());
   6.212 +
   6.213 +    pEp_identity* alice_id2 = NULL;
   6.214 +    status = set_up_ident_from_scratch(session,
   6.215 +                                "test_keys/priv/pep-test-alice-0x6FF00E97_priv.asc",
   6.216 +                                "pep.test.alice_2@pep-project.org", "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97", 
   6.217 +                                "ALICE", "Barbara is Alice", &alice_id2, true
   6.218 +                        );    
   6.219 +
   6.220 +    pEp_identity* alice_id3 = NULL;
   6.221 +    status = set_up_ident_from_scratch(session,
   6.222 +                                "test_keys/priv/pep-test-alice-0x6FF00E97_priv.asc",
   6.223 +                                "pep.test.alice_3@pep-project.org", "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97", 
   6.224 +                                "ALICE", "Carol is Alice", &alice_id3, true
   6.225 +                        );    
   6.226 +
   6.227 +    pEp_identity* bob_id = NULL;
   6.228 +    status = set_up_ident_from_scratch(session,
   6.229 +                                "test_keys/pub/pep-test-bob-0xC9C2EE39_pub.asc",
   6.230 +                                "pep.test.bob@pep-project.org", "BFCDB7F301DEEEBBF947F29659BFF488C9C2EE39", 
   6.231 +                                "BOB", "Bob is not Alice", &bob_id, false
   6.232 +                        );    
   6.233 +
   6.234 +    ids_to_group->ident = alice_id2;
   6.235 +    identity_list_add(ids_to_group, bob_id);
   6.236 +    identity_list_add(ids_to_group, alice_id3);
   6.237 +    status = enter_device_group(session, ids_to_group);
   6.238 +    TEST_ASSERT_MSG(status != PEP_STATUS_OK, tl_status_string(status));
   6.239 +    status = update_identity(session, bob_id);
   6.240 +    TEST_ASSERT_MSG(!(bob_id->flags & PEP_idf_devicegroup), tl_ident_flags_String(alice_id->flags).c_str());
   6.241 +
   6.242 +    status = myself(session, alice_id);    
   6.243 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.244 +    TEST_ASSERT_MSG(alice_id->flags & PEP_idf_devicegroup, tl_ident_flags_String(alice_id->flags).c_str());
   6.245 +
   6.246 +    status = myself(session, alice_id2);
   6.247 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.248 +    TEST_ASSERT_MSG(!(alice_id2->flags & PEP_idf_devicegroup), tl_ident_flags_String(alice_id2->flags).c_str());
   6.249 +
   6.250 +    status = myself(session, alice_id3);
   6.251 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.252 +    TEST_ASSERT_MSG(!(alice_id3->flags & PEP_idf_devicegroup), tl_ident_flags_String(alice_id3->flags).c_str());
   6.253 +                        
   6.254 +    free_identity(alice_id);                        
   6.255 +    free_identity_list(ids_to_group);
   6.256 +}
   6.257 +void EnterLeaveDeviceGroupTests::check_enter_device_group_many_own_add_explicit() {    
   6.258 +    pEp_identity* alice_id = NULL;
   6.259 +    TEST_ASSERT(slurp_and_import_key(session, "test_keys/pub/pep-test-alice-0x6FF00E97_pub.asc"));    
   6.260 +    PEP_STATUS status = set_up_ident_from_scratch(session,
   6.261 +                                "test_keys/priv/pep-test-alice-0x6FF00E97_priv.asc",
   6.262 +                                "pep.test.alice@pep-project.org", "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97", 
   6.263 +                                "ALICE", "Alice in Wonderland", &alice_id, true
   6.264 +                        );    
   6.265 +
   6.266 +    pEp_identity* alice_id2 = NULL;
   6.267 +    status = set_up_ident_from_scratch(session,
   6.268 +                                "test_keys/priv/pep-test-alice-0x6FF00E97_priv.asc",
   6.269 +                                "pep.test.alice_2@pep-project.org", "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97", 
   6.270 +                                "ALICE", "Barbara is Alice", &alice_id2, true
   6.271 +                        );    
   6.272 +
   6.273 +    pEp_identity* alice_id3 = NULL;
   6.274 +    status = set_up_ident_from_scratch(session,
   6.275 +                                "test_keys/priv/pep-test-alice-0x6FF00E97_priv.asc",
   6.276 +                                "pep.test.alice_3@pep-project.org", "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97", 
   6.277 +                                "ALICE", "Carol is Alice", &alice_id3, true
   6.278 +                        );    
   6.279 +
   6.280 +    status = myself(session, alice_id);
   6.281 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.282 +
   6.283 +    status = myself(session, alice_id2);
   6.284 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.285 +
   6.286 +    status = myself(session, alice_id3);
   6.287 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.288 +
   6.289 +    identity_list* ids_to_group = new_identity_list(alice_id);
   6.290 +    identity_list_add(ids_to_group, alice_id2);
   6.291 +    identity_list_add(ids_to_group, alice_id3);
   6.292 +    status = enter_device_group(session, ids_to_group);
   6.293 +    TEST_ASSERT_MSG(status == PEP_STATUS_OK, tl_status_string(status));
   6.294 +    
   6.295 +    status = myself(session, alice_id);
   6.296 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.297 +    TEST_ASSERT_MSG(alice_id->flags & PEP_idf_devicegroup, tl_ident_flags_String(alice_id->flags).c_str());
   6.298 +
   6.299 +    status = enter_device_group(session, ids_to_group);
   6.300 +    TEST_ASSERT_MSG(status == PEP_STATUS_OK, tl_status_string(status));
   6.301 +
   6.302 +    status = myself(session, alice_id);    
   6.303 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.304 +    TEST_ASSERT_MSG(alice_id->flags & PEP_idf_devicegroup, tl_ident_flags_String(alice_id->flags).c_str());
   6.305 +
   6.306 +    status = myself(session, alice_id2);
   6.307 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.308 +    TEST_ASSERT_MSG(alice_id2->flags & PEP_idf_devicegroup, tl_ident_flags_String(alice_id2->flags).c_str());
   6.309 +
   6.310 +    status = myself(session, alice_id3);
   6.311 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.312 +    TEST_ASSERT_MSG(alice_id3->flags & PEP_idf_devicegroup, tl_ident_flags_String(alice_id3->flags).c_str());
   6.313 +                        
   6.314 +    free_identity_list(ids_to_group);
   6.315  }
   6.316  
   6.317  void EnterLeaveDeviceGroupTests::check_enter_device_group_many_empty() {    
   6.318 -    TEST_ASSERT(true);
   6.319 +    pEp_identity* alice_id = NULL;
   6.320 +    TEST_ASSERT(slurp_and_import_key(session, "test_keys/pub/pep-test-alice-0x6FF00E97_pub.asc"));    
   6.321 +    PEP_STATUS status = set_up_ident_from_scratch(session,
   6.322 +                                "test_keys/priv/pep-test-alice-0x6FF00E97_priv.asc",
   6.323 +                                "pep.test.alice@pep-project.org", "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97", 
   6.324 +                                "ALICE", "Alice in Wonderland", &alice_id, true
   6.325 +                        );    
   6.326 +
   6.327 +    pEp_identity* alice_id2 = NULL;
   6.328 +    status = set_up_ident_from_scratch(session,
   6.329 +                                "test_keys/priv/pep-test-alice-0x6FF00E97_priv.asc",
   6.330 +                                "pep.test.alice_2@pep-project.org", "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97", 
   6.331 +                                "ALICE", "Barbara is Alice", &alice_id2, true
   6.332 +                        );    
   6.333 +
   6.334 +    pEp_identity* alice_id3 = NULL;
   6.335 +    status = set_up_ident_from_scratch(session,
   6.336 +                                "test_keys/priv/pep-test-alice-0x6FF00E97_priv.asc",
   6.337 +                                "pep.test.alice_3@pep-project.org", "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97", 
   6.338 +                                "ALICE", "Carol is Alice", &alice_id3, true
   6.339 +                        );    
   6.340 +
   6.341 +    status = myself(session, alice_id);
   6.342 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.343 +
   6.344 +    status = myself(session, alice_id2);
   6.345 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.346 +
   6.347 +    status = myself(session, alice_id3);
   6.348 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.349 +
   6.350 +    status = enter_device_group(session, NULL);
   6.351 +    TEST_ASSERT_MSG(status == PEP_STATUS_OK, tl_status_string(status));
   6.352 +    
   6.353 +    status = myself(session, alice_id);
   6.354 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.355 +    TEST_ASSERT_MSG(alice_id->flags & PEP_idf_devicegroup, tl_ident_flags_String(alice_id->flags).c_str());
   6.356 +
   6.357 +    status = myself(session, alice_id2);
   6.358 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.359 +    TEST_ASSERT_MSG(alice_id2->flags & PEP_idf_devicegroup, tl_ident_flags_String(alice_id2->flags).c_str());
   6.360 +
   6.361 +    status = myself(session, alice_id3);
   6.362 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.363 +    TEST_ASSERT_MSG(alice_id3->flags & PEP_idf_devicegroup, tl_ident_flags_String(alice_id3->flags).c_str());
   6.364 +                        
   6.365 +    free_identity(alice_id);         
   6.366 +    free_identity(alice_id2);
   6.367 +    free_identity(alice_id3);               
   6.368  }
   6.369  
   6.370  void EnterLeaveDeviceGroupTests::check_enter_device_group_many_own_one() {    
   6.371 -    TEST_ASSERT(true);
   6.372 +    pEp_identity* alice_id = NULL;
   6.373 +    TEST_ASSERT(slurp_and_import_key(session, "test_keys/pub/pep-test-alice-0x6FF00E97_pub.asc"));    
   6.374 +    PEP_STATUS status = set_up_ident_from_scratch(session,
   6.375 +                                "test_keys/priv/pep-test-alice-0x6FF00E97_priv.asc",
   6.376 +                                "pep.test.alice@pep-project.org", "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97", 
   6.377 +                                "ALICE", "Alice in Wonderland", &alice_id, true
   6.378 +                        );    
   6.379 +
   6.380 +    pEp_identity* alice_id2 = NULL;
   6.381 +    status = set_up_ident_from_scratch(session,
   6.382 +                                "test_keys/priv/pep-test-alice-0x6FF00E97_priv.asc",
   6.383 +                                "pep.test.alice_2@pep-project.org", "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97", 
   6.384 +                                "ALICE", "Barbara is Alice", &alice_id2, true
   6.385 +                        );    
   6.386 +
   6.387 +    pEp_identity* alice_id3 = NULL;
   6.388 +    status = set_up_ident_from_scratch(session,
   6.389 +                                "test_keys/priv/pep-test-alice-0x6FF00E97_priv.asc",
   6.390 +                                "pep.test.alice_3@pep-project.org", "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97", 
   6.391 +                                "ALICE", "Carol is Alice", &alice_id3, true
   6.392 +                        );    
   6.393 +
   6.394 +    status = myself(session, alice_id);
   6.395 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.396 +
   6.397 +    status = myself(session, alice_id2);
   6.398 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.399 +
   6.400 +    status = myself(session, alice_id3);
   6.401 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.402 +
   6.403 +    identity_list* ids_to_group = new_identity_list(alice_id2);
   6.404 +    identity_list_add(ids_to_group, alice_id3);
   6.405 +    
   6.406 +    status = enter_device_group(session, ids_to_group);
   6.407 +    TEST_ASSERT_MSG(status == PEP_STATUS_OK, tl_status_string(status));
   6.408 +    
   6.409 +    status = myself(session, alice_id);
   6.410 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.411 +    TEST_ASSERT_MSG(!(alice_id->flags & PEP_idf_devicegroup), tl_ident_flags_String(alice_id->flags).c_str());
   6.412 +
   6.413 +    status = myself(session, alice_id2);
   6.414 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.415 +    TEST_ASSERT_MSG(alice_id2->flags & PEP_idf_devicegroup, tl_ident_flags_String(alice_id2->flags).c_str());
   6.416 +
   6.417 +    status = myself(session, alice_id3);
   6.418 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.419 +    TEST_ASSERT_MSG(alice_id3->flags & PEP_idf_devicegroup, tl_ident_flags_String(alice_id3->flags).c_str());
   6.420 +
   6.421 +    identity_list* tmp = ids_to_group->next;
   6.422 +    ids_to_group->next = NULL;
   6.423 +    tmp->ident = NULL;
   6.424 +    free_identity_list(tmp);
   6.425 +
   6.426 +    ids_to_group->ident = alice_id;
   6.427 +
   6.428 +    status = enter_device_group(session, ids_to_group);
   6.429 +    TEST_ASSERT_MSG(status == PEP_STATUS_OK, tl_status_string(status));
   6.430 +    
   6.431 +    status = myself(session, alice_id);
   6.432 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.433 +    TEST_ASSERT_MSG(alice_id->flags & PEP_idf_devicegroup, tl_ident_flags_String(alice_id->flags).c_str());
   6.434 +
   6.435 +    status = myself(session, alice_id2);
   6.436 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.437 +    TEST_ASSERT_MSG(!(alice_id2->flags & PEP_idf_devicegroup), tl_ident_flags_String(alice_id2->flags).c_str());
   6.438 +
   6.439 +    status = myself(session, alice_id3);
   6.440 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.441 +    TEST_ASSERT_MSG(!(alice_id3->flags & PEP_idf_devicegroup), tl_ident_flags_String(alice_id3->flags).c_str());
   6.442 +                        
   6.443 +    free_identity_list(ids_to_group);         
   6.444 +    free_identity(alice_id2);
   6.445 +    free_identity(alice_id3);               
   6.446  }
   6.447  
   6.448  void EnterLeaveDeviceGroupTests::check_enter_device_group_many_own_many() {    
   6.449 -    TEST_ASSERT(true);
   6.450 +    pEp_identity* alice_id = NULL;
   6.451 +    TEST_ASSERT(slurp_and_import_key(session, "test_keys/pub/pep-test-alice-0x6FF00E97_pub.asc"));    
   6.452 +    PEP_STATUS status = set_up_ident_from_scratch(session,
   6.453 +                                "test_keys/priv/pep-test-alice-0x6FF00E97_priv.asc",
   6.454 +                                "pep.test.alice@pep-project.org", "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97", 
   6.455 +                                "ALICE", "Alice in Wonderland", &alice_id, true
   6.456 +                        );    
   6.457 +
   6.458 +    pEp_identity* alice_id2 = NULL;
   6.459 +    status = set_up_ident_from_scratch(session,
   6.460 +                                "test_keys/priv/pep-test-alice-0x6FF00E97_priv.asc",
   6.461 +                                "pep.test.alice_2@pep-project.org", "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97", 
   6.462 +                                "ALICE", "Barbara is Alice", &alice_id2, true
   6.463 +                        );    
   6.464 +
   6.465 +    pEp_identity* alice_id3 = NULL;
   6.466 +    status = set_up_ident_from_scratch(session,
   6.467 +                                "test_keys/priv/pep-test-alice-0x6FF00E97_priv.asc",
   6.468 +                                "pep.test.alice_3@pep-project.org", "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97", 
   6.469 +                                "ALICE", "Carol is Alice", &alice_id3, true
   6.470 +                        );    
   6.471 +
   6.472 +    pEp_identity* alice_id4 = NULL;
   6.473 +    status = set_up_ident_from_scratch(session,
   6.474 +                                "test_keys/priv/pep-test-alice-0x6FF00E97_priv.asc",
   6.475 +                                "pep.test.alice_4@pep-project.org", "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97", 
   6.476 +                                "ALICE", "Dave is Alice", &alice_id4, true
   6.477 +                        );    
   6.478 +
   6.479 +    pEp_identity* alice_id5 = NULL;
   6.480 +    status = set_up_ident_from_scratch(session,
   6.481 +                                "test_keys/priv/pep-test-alice-0x6FF00E97_priv.asc",
   6.482 +                                "pep.test.alice_5@pep-project.org", "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97", 
   6.483 +                                "ALICE", "Eustace is Alice", &alice_id5, true
   6.484 +                        );    
   6.485 +
   6.486 +    pEp_identity* alice_id6 = NULL;
   6.487 +    status = set_up_ident_from_scratch(session,
   6.488 +                                "test_keys/priv/pep-test-alice-0x6FF00E97_priv.asc",
   6.489 +                                "pep.test.alice_6@pep-project.org", "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97", 
   6.490 +                                "ALICE", "Francesca is Alice", &alice_id6, true
   6.491 +                        );    
   6.492 +
   6.493 +
   6.494 +    status = myself(session, alice_id);
   6.495 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.496 +
   6.497 +    status = myself(session, alice_id2);
   6.498 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.499 +
   6.500 +    status = myself(session, alice_id3);
   6.501 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.502 +
   6.503 +    status = myself(session, alice_id4);
   6.504 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.505 +
   6.506 +    status = myself(session, alice_id5);
   6.507 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.508 +
   6.509 +    status = myself(session, alice_id6);
   6.510 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.511 +
   6.512 +    identity_list* ids_to_group = new_identity_list(alice_id);
   6.513 +    identity_list_add(ids_to_group, alice_id2);
   6.514 +    identity_list_add(ids_to_group, alice_id3);
   6.515 +    
   6.516 +    status = enter_device_group(session, ids_to_group);
   6.517 +    TEST_ASSERT_MSG(status == PEP_STATUS_OK, tl_status_string(status));
   6.518 +    
   6.519 +    status = myself(session, alice_id);
   6.520 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.521 +    TEST_ASSERT_MSG(alice_id->flags & PEP_idf_devicegroup, tl_ident_flags_String(alice_id->flags).c_str());
   6.522 +
   6.523 +    status = myself(session, alice_id2);
   6.524 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.525 +    TEST_ASSERT_MSG(alice_id2->flags & PEP_idf_devicegroup, tl_ident_flags_String(alice_id2->flags).c_str());
   6.526 +
   6.527 +    status = myself(session, alice_id3);
   6.528 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.529 +    TEST_ASSERT_MSG(alice_id3->flags & PEP_idf_devicegroup, tl_ident_flags_String(alice_id3->flags).c_str());
   6.530 +
   6.531 +    ids_to_group->ident = alice_id4;
   6.532 +    ids_to_group->next->ident = alice_id5;
   6.533 +    ids_to_group->next->next->ident = alice_id6;
   6.534 +
   6.535 +    status = enter_device_group(session, ids_to_group);
   6.536 +    TEST_ASSERT_MSG(status == PEP_STATUS_OK, tl_status_string(status));
   6.537 +    
   6.538 +    status = myself(session, alice_id);
   6.539 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.540 +    TEST_ASSERT_MSG(!(alice_id->flags & PEP_idf_devicegroup), tl_ident_flags_String(alice_id->flags).c_str());
   6.541 +
   6.542 +    status = myself(session, alice_id2);
   6.543 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.544 +    TEST_ASSERT_MSG(!(alice_id2->flags & PEP_idf_devicegroup), tl_ident_flags_String(alice_id2->flags).c_str());
   6.545 +
   6.546 +    status = myself(session, alice_id3);
   6.547 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.548 +    TEST_ASSERT_MSG(!(alice_id3->flags & PEP_idf_devicegroup), tl_ident_flags_String(alice_id3->flags).c_str());
   6.549 +
   6.550 +    status = myself(session, alice_id4);
   6.551 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.552 +    TEST_ASSERT_MSG(alice_id4->flags & PEP_idf_devicegroup, tl_ident_flags_String(alice_id4->flags).c_str());
   6.553 +
   6.554 +    status = myself(session, alice_id5);
   6.555 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.556 +    TEST_ASSERT_MSG(alice_id5->flags & PEP_idf_devicegroup, tl_ident_flags_String(alice_id5->flags).c_str());
   6.557 +
   6.558 +    status = myself(session, alice_id6);
   6.559 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.560 +    TEST_ASSERT_MSG(alice_id6->flags & PEP_idf_devicegroup, tl_ident_flags_String(alice_id6->flags).c_str());
   6.561 +                        
   6.562 +    free_identity_list(ids_to_group);         
   6.563 +    free_identity(alice_id);
   6.564 +    free_identity(alice_id2);
   6.565 +    free_identity(alice_id3);               
   6.566  }
   6.567  
   6.568  void EnterLeaveDeviceGroupTests::check_enter_device_group_many_own_many_w_not_me() {    
   6.569 -    TEST_ASSERT(true);
   6.570 +    pEp_identity* alice_id = NULL;
   6.571 +    TEST_ASSERT(slurp_and_import_key(session, "test_keys/pub/pep-test-alice-0x6FF00E97_pub.asc"));    
   6.572 +    PEP_STATUS status = set_up_ident_from_scratch(session,
   6.573 +                                "test_keys/priv/pep-test-alice-0x6FF00E97_priv.asc",
   6.574 +                                "pep.test.alice@pep-project.org", "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97", 
   6.575 +                                "ALICE", "Alice in Wonderland", &alice_id, true
   6.576 +                        );    
   6.577 +
   6.578 +    pEp_identity* alice_id2 = NULL;
   6.579 +    status = set_up_ident_from_scratch(session,
   6.580 +                                "test_keys/priv/pep-test-alice-0x6FF00E97_priv.asc",
   6.581 +                                "pep.test.alice_2@pep-project.org", "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97", 
   6.582 +                                "ALICE", "Barbara is Alice", &alice_id2, true
   6.583 +                        );    
   6.584 +
   6.585 +    pEp_identity* alice_id3 = NULL;
   6.586 +    status = set_up_ident_from_scratch(session,
   6.587 +                                "test_keys/priv/pep-test-alice-0x6FF00E97_priv.asc",
   6.588 +                                "pep.test.alice_3@pep-project.org", "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97", 
   6.589 +                                "ALICE", "Carol is Alice", &alice_id3, true
   6.590 +                        );    
   6.591 +
   6.592 +    pEp_identity* alice_id4 = NULL;
   6.593 +    status = set_up_ident_from_scratch(session,
   6.594 +                                "test_keys/priv/pep-test-alice-0x6FF00E97_priv.asc",
   6.595 +                                "pep.test.alice_4@pep-project.org", "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97", 
   6.596 +                                "ALICE", "Dave is Alice", &alice_id4, true
   6.597 +                        );    
   6.598 +
   6.599 +    pEp_identity* alice_id5 = NULL;
   6.600 +    status = set_up_ident_from_scratch(session,
   6.601 +                                "test_keys/priv/pep-test-alice-0x6FF00E97_priv.asc",
   6.602 +                                "pep.test.alice_5@pep-project.org", "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97", 
   6.603 +                                "ALICE", "Eustace is Alice", &alice_id5, true
   6.604 +                        );    
   6.605 +
   6.606 +    pEp_identity* alice_id6 = NULL;
   6.607 +    status = set_up_ident_from_scratch(session,
   6.608 +                                "test_keys/priv/pep-test-alice-0x6FF00E97_priv.asc",
   6.609 +                                "pep.test.alice_6@pep-project.org", "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97", 
   6.610 +                                "ALICE", "Francesca is Alice", &alice_id6, true
   6.611 +                        );    
   6.612 +
   6.613 +    pEp_identity* bob_id = NULL;
   6.614 +    status = set_up_ident_from_scratch(session,
   6.615 +                                "test_keys/pub/pep-test-bob-0xC9C2EE39_pub.asc",
   6.616 +                                "pep.test.bob@pep-project.org", "BFCDB7F301DEEEBBF947F29659BFF488C9C2EE39", 
   6.617 +                                "BOB", "Bob is not Alice", &bob_id, false
   6.618 +                        );    
   6.619 +
   6.620 +    status = update_identity(session, bob_id);
   6.621 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.622 +
   6.623 +    status = myself(session, alice_id);
   6.624 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.625 +
   6.626 +    status = myself(session, alice_id2);
   6.627 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.628 +
   6.629 +    status = myself(session, alice_id3);
   6.630 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.631 +
   6.632 +    status = myself(session, alice_id4);
   6.633 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.634 +
   6.635 +    status = myself(session, alice_id5);
   6.636 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.637 +
   6.638 +    status = myself(session, alice_id6);
   6.639 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.640 +
   6.641 +    identity_list* ids_to_group = new_identity_list(alice_id);
   6.642 +    identity_list_add(ids_to_group, alice_id2);
   6.643 +    identity_list_add(ids_to_group, alice_id3);
   6.644 +    
   6.645 +    status = enter_device_group(session, ids_to_group);
   6.646 +    TEST_ASSERT_MSG(status == PEP_STATUS_OK, tl_status_string(status));
   6.647 +    
   6.648 +    status = myself(session, alice_id);
   6.649 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.650 +    TEST_ASSERT_MSG(alice_id->flags & PEP_idf_devicegroup, tl_ident_flags_String(alice_id->flags).c_str());
   6.651 +
   6.652 +    status = myself(session, alice_id2);
   6.653 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.654 +    TEST_ASSERT_MSG(alice_id2->flags & PEP_idf_devicegroup, tl_ident_flags_String(alice_id2->flags).c_str());
   6.655 +
   6.656 +    status = myself(session, alice_id3);
   6.657 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.658 +    TEST_ASSERT_MSG(alice_id3->flags & PEP_idf_devicegroup, tl_ident_flags_String(alice_id3->flags).c_str());
   6.659 +
   6.660 +    ids_to_group->ident = alice_id4;
   6.661 +    ids_to_group->next->ident = alice_id5;
   6.662 +    ids_to_group->next->next->ident = alice_id6;
   6.663 +    ids_to_group->next->next->next = new_identity_list(bob_id);
   6.664 +
   6.665 +    status = enter_device_group(session, ids_to_group);
   6.666 +    TEST_ASSERT_MSG(status == PEP_ILLEGAL_VALUE, tl_status_string(status));
   6.667 +    
   6.668 +    status = myself(session, alice_id);
   6.669 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.670 +    TEST_ASSERT_MSG(alice_id->flags & PEP_idf_devicegroup, tl_ident_flags_String(alice_id->flags).c_str());
   6.671 +
   6.672 +    status = myself(session, alice_id2);
   6.673 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.674 +    TEST_ASSERT_MSG(alice_id2->flags & PEP_idf_devicegroup, tl_ident_flags_String(alice_id2->flags).c_str());
   6.675 +
   6.676 +    status = myself(session, alice_id3);
   6.677 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.678 +    TEST_ASSERT_MSG(alice_id3->flags & PEP_idf_devicegroup, tl_ident_flags_String(alice_id3->flags).c_str());
   6.679 +
   6.680 +    status = myself(session, alice_id4);
   6.681 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.682 +    TEST_ASSERT_MSG(!(alice_id4->flags & PEP_idf_devicegroup), tl_ident_flags_String(alice_id4->flags).c_str());
   6.683 +
   6.684 +    status = myself(session, alice_id5);
   6.685 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.686 +    TEST_ASSERT_MSG(!(alice_id5->flags & PEP_idf_devicegroup), tl_ident_flags_String(alice_id5->flags).c_str());
   6.687 +
   6.688 +    status = myself(session, alice_id6);
   6.689 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.690 +    TEST_ASSERT_MSG(!(alice_id6->flags & PEP_idf_devicegroup), tl_ident_flags_String(alice_id6->flags).c_str());
   6.691 +    
   6.692 +    status = update_identity(session, bob_id);
   6.693 +    TEST_ASSERT(status == PEP_STATUS_OK);    
   6.694 +    TEST_ASSERT_MSG(!(bob_id->flags & PEP_idf_devicegroup), tl_ident_flags_String(bob_id->flags).c_str());
   6.695 +    
   6.696 +    free_identity_list(ids_to_group);         
   6.697 +    free_identity(alice_id);
   6.698 +    free_identity(alice_id2);
   6.699 +    free_identity(alice_id3);               
   6.700  }
     7.1 --- a/test/src/pEpTestOutput.cc	Tue Apr 02 18:01:01 2019 +0200
     7.2 +++ b/test/src/pEpTestOutput.cc	Wed Apr 03 17:15:17 2019 +0200
     7.3 @@ -1,4 +1,6 @@
     7.4  #include <cpptest.h>
     7.5 +#include <cpptest-suite.h>
     7.6 +#include <cpptest-output.h>
     7.7  #include <iostream>
     7.8  #include <iomanip>
     7.9  #include <vector>