Browse Source

Tests: update because of Utils moved

LIB-11
heck 4 years ago
parent
commit
2702f621f5
  1. 31
      test/test_group.cc
  2. 5
      test/test_listmanager_dummy.cc
  3. 3
      test/test_pEpSQLite.cc

31
test/test_group.cc

@ -7,6 +7,7 @@
//#include <iostream> //#include <iostream>
#include "../src/Adapter.hh" #include "../src/Adapter.hh"
#include "../src/utils.hh"
#include "../src/grp_update_interface.hh" #include "../src/grp_update_interface.hh"
#include "../src/grp_update_drv_engine.hh" #include "../src/grp_update_drv_engine.hh"
@ -46,8 +47,8 @@ GroupUpdateInterface* gu = nullptr;
::PEP_STATUS test_notifyHandshake(::pEp_identity* _me, ::pEp_identity* _partner, sync_handshake_signal signal) ::PEP_STATUS test_notifyHandshake(::pEp_identity* _me, ::pEp_identity* _partner, sync_handshake_signal signal)
{ {
log("called"); log("called");
log("me: " + Test::Utils::to_string(_me, false)); log("me: " + pEp::Utils::to_string(_me, false));
log("partner: " + Test::Utils::to_string(_partner, false)); log("partner: " + pEp::Utils::to_string(_partner, false));
log("Signal: " + string{ ::sync_handshake_signal_to_string(signal) }); log("Signal: " + string{ ::sync_handshake_signal_to_string(signal) });
return PEP_STATUS_OK; return PEP_STATUS_OK;
@ -68,7 +69,7 @@ void test_create_alice_me()
status = ::myself(Adapter::session(), alice); status = ::myself(Adapter::session(), alice);
log("STATUS: " + status_to_string(status)); log("STATUS: " + status_to_string(status));
assert(!status); assert(!status);
log("Alice:" + Test::Utils::to_string(alice, debug_info_full)); log("Alice:" + pEp::Utils::to_string(alice, debug_info_full));
} }
void test_create_bob_partner() void test_create_bob_partner()
@ -81,7 +82,7 @@ void test_create_bob_partner()
status = ::update_identity(Adapter::session(), bob); status = ::update_identity(Adapter::session(), bob);
log("STATUS: " + status_to_string(status)); log("STATUS: " + status_to_string(status));
assert(!status); assert(!status);
log("Bob:" + Test::Utils::to_string(bob, debug_info_full)); log("Bob:" + pEp::Utils::to_string(bob, debug_info_full));
} }
void test_create_carol_partner() void test_create_carol_partner()
@ -94,7 +95,7 @@ void test_create_carol_partner()
status = ::update_identity(Adapter::session(), carol); status = ::update_identity(Adapter::session(), carol);
log("STATUS: " + status_to_string(status)); log("STATUS: " + status_to_string(status));
assert(!status); assert(!status);
log("Carol:" + Test::Utils::to_string(carol, debug_info_full)); log("Carol:" + pEp::Utils::to_string(carol, debug_info_full));
} }
void test_setup_and_start_sync() void test_setup_and_start_sync()
@ -106,7 +107,7 @@ void test_setup_and_start_sync()
void test_group_create(::identity_list& idl) void test_group_create(::identity_list& idl)
{ {
logH2("test_group_create"); logH2("test_group_create");
log("IDL: " + Test::Utils::to_string(&idl, debug_info_full)); log("IDL: " + pEp::Utils::to_string(&idl, debug_info_full));
log("create group identity"); log("create group identity");
grp_ident = ::new_identity("group1@peptest.ch", NULL, "432", "group1"); grp_ident = ::new_identity("group1@peptest.ch", NULL, "432", "group1");
@ -114,7 +115,7 @@ void test_group_create(::identity_list& idl)
status = ::myself(Adapter::session(), grp_ident); status = ::myself(Adapter::session(), grp_ident);
log("STATUS: " + status_to_string(status)); log("STATUS: " + status_to_string(status));
assert(!status); assert(!status);
log("grp_ident:" + Test::Utils::to_string(grp_ident, debug_info_full)); log("grp_ident:" + pEp::Utils::to_string(grp_ident, debug_info_full));
log("adapter_group_create()"); log("adapter_group_create()");
status = gu->adapter_group_create(Adapter::session(), grp_ident, alice, &idl); status = gu->adapter_group_create(Adapter::session(), grp_ident, alice, &idl);
@ -131,13 +132,13 @@ void test_group_invite_member(::pEp_identity& ident)
assert(!status); assert(!status);
} }
void test_group_join(::pEp_identity& ident) //void test_group_join(::pEp_identity& ident)
{ //{
logH2("test_group_join"); // logH2("test_group_join");
status = gu->adapter_group_join(Adapter::session(), grp_ident, &ident); // status = gu->adapter_group_join(Adapter::session(), grp_ident, &ident);
log("STATUS: " + status_to_string(status)); // log("STATUS: " + status_to_string(status));
assert(!status); // assert(!status);
} //}
void test_group_remove_member(::pEp_identity& ident) void test_group_remove_member(::pEp_identity& ident)
{ {
@ -210,7 +211,7 @@ int main(int argc, char** argv)
// Setup Test Context // Setup Test Context
test_create_alice_me(); test_create_alice_me();
log("PERUSERDIR: " + string(::per_user_directory())); log("PERUSERDIR: " + string(::per_user_directory()));
// Test::Utils::file_delete(::per_user_directory()); // pEp::Utils::file_delete(::per_user_directory());
// cin >> dummy_in; // cin >> dummy_in;
test_create_alice_me(); test_create_alice_me();

5
test/test_listmanager_dummy.cc

@ -1,4 +1,5 @@
#include "../src/listmanager_dummy.hh" #include "../src/listmanager_dummy.hh"
#include "../src/utils.hh"
#include "framework/utils.hh" #include "framework/utils.hh"
#include <iostream> #include <iostream>
#include <exception> #include <exception>
@ -8,7 +9,7 @@
using namespace std; using namespace std;
using namespace pEp; using namespace pEp;
using namespace pEp::Adapter::pEpLog; using namespace pEp::Adapter::pEpLog;
using namespace pEp::Test::Utils; using namespace pEp::Utils;
struct lm_list { struct lm_list {
string addr; string addr;
@ -256,7 +257,7 @@ int main(int argc, char* argv[])
} }
} }
{ {
logH2("Testing member_remove() not existing group - DoesNotExistException"); logH2("Testing member_remove() not existing list - DoesNotExistException");
model_test_lmd model = create_default_model(); model_test_lmd model = create_default_model();
ListManagerDummy lmd(model.db_path); ListManagerDummy lmd(model.db_path);
recreate_apply_and_verify_model(lmd, model); recreate_apply_and_verify_model(lmd, model);

3
test/test_pEpSQLite.cc

@ -1,5 +1,6 @@
#include "test_pEpSQLite.hh" #include "test_pEpSQLite.hh"
#include "../src/pEpSQLite.hh" #include "../src/pEpSQLite.hh"
#include "../src/utils.hh"
#include "framework/utils.hh" #include "framework/utils.hh"
#include <fstream> #include <fstream>
@ -7,7 +8,7 @@
using namespace std; using namespace std;
using namespace pEp; using namespace pEp;
using namespace pEp::Test; using namespace pEp::Test;
using namespace pEp::Test::Utils; using namespace pEp::Utils;
namespace pEp { namespace pEp {
namespace Test { namespace Test {

Loading…
Cancel
Save