@@ -460,75 +460,84 @@ TEST_CASE("user profile C API", "[config][user_profile][c]") {
460460 CHECK (session::to_vector (std::span<const unsigned char >{pic.key , 32 }) ==
461461 " qwert\0 yuio1234567890123456789012" _bytes);
462462
463- // Reupload the "current" pic and confirm it gets returned
463+ // Ensure the timestamp doesn't get updated
464464 strcpy (p.url , " testUrl" );
465465 memcpy (p.key , " secret78901234567890123456789000" , 32 );
466466 CHECK (0 == user_profile_set_reupload_pic (conf, p));
467-
468- pic = user_profile_get_pic (conf);
469- REQUIRE (pic.url != " " s);
470- REQUIRE (pic.key != session::to_vector (" " ).data ());
471- CHECK (pic.url == " testUrl" sv);
472- CHECK (session::to_vector (std::span<const unsigned char >{pic.key , 32 }) ==
473- " secret78901234567890123456789000" _bytes);
474-
475- // Upload a "new" pic and it now gets returned
476- strcpy (p.url , " testNewUrl" );
477- memcpy (p.key , " secret78901234567890123456789111" , 32 );
478- CHECK (0 == user_profile_set_pic (conf, p));
479- pic = user_profile_get_pic (conf);
480- REQUIRE (pic.url != " " s);
481- REQUIRE (pic.key != session::to_vector (" " ).data ());
482- CHECK (pic.url == " testNewUrl" sv);
483- CHECK (session::to_vector (std::span<const unsigned char >{pic.key , 32 }) ==
484- " secret78901234567890123456789111" _bytes);
485-
486- // Ensure the timestamp for the last modified pic gets updated correctly when the name gets set
487- UserProfileTester::set_profile_updated (conf, std::chrono::sys_seconds{0s});
488- UserProfileTester::set_reupload_profile_updated (conf, std::chrono::sys_seconds{0s});
489-
490- CHECK (0 == user_profile_set_pic (conf, p));
491- UserProfileTester::set_profile_updated (conf, std::chrono::sys_seconds{123s});
492- user_profile_set_name (conf, " test1" );
493- CHECK (UserProfileTester::get_profile_updated_value (conf).time_since_epoch ().count () != 123 );
494- UserProfileTester::set_profile_updated (conf, std::chrono::sys_seconds{0s});
495-
496- UserProfileTester::set_reupload_profile_updated (conf, std::chrono::sys_seconds{124s});
497- CHECK (0 == user_profile_set_reupload_pic (conf, p));
498- user_profile_set_name (conf, " test2" );
499- CHECK (UserProfileTester::get_reupload_profile_updated_value (conf).time_since_epoch ().count () !=
500- 124 );
501-
502- // Ensure the timestamp for the last modified pic gets updated correctly when the blinded msgreq
503- // is set
504- UserProfileTester::set_profile_updated (conf, std::chrono::sys_seconds{0s});
505- UserProfileTester::set_reupload_profile_updated (conf, std::chrono::sys_seconds{0s});
506-
507467 CHECK (0 == user_profile_set_pic (conf, p));
508- UserProfileTester::set_profile_updated ( conf, std::chrono::sys_seconds{123s} );
468+ CHECK ( 0 == user_profile_set_name ( conf, " Test " ) );
509469 user_profile_set_blinded_msgreqs (conf, 1 );
510- CHECK (UserProfileTester::get_profile_updated_value (conf).time_since_epoch ().count () != 123 );
511- UserProfileTester::set_profile_updated (conf, std::chrono::sys_seconds{0s});
512-
513- UserProfileTester::set_reupload_profile_updated (conf, std::chrono::sys_seconds{124s});
514- CHECK (0 == user_profile_set_reupload_pic (conf, p));
515- user_profile_set_blinded_msgreqs (conf, 2 );
516- CHECK (UserProfileTester::get_reupload_profile_updated_value (conf).time_since_epoch ().count () !=
517- 124 );
518-
519- // Ensure the timestamp is stored in seconds seconds (was incorrectly stored as microseconds)
520- auto time_before_call = std::chrono::system_clock::now ();
521- CHECK (0 == user_profile_set_pic (conf, p));
522- auto time_after_call = std::chrono::system_clock::now ();
523- auto before_seconds =
524- std::chrono::duration_cast<std::chrono::seconds>(time_before_call.time_since_epoch ())
525- .count ();
526- auto after_seconds =
527- std::chrono::duration_cast<std::chrono::seconds>(time_before_call.time_since_epoch ())
528- .count ();
529-
530- auto raw_value = UserProfileTester::get_raw_profile_updated_value (conf);
531- INFO (" Checking if raw_value " << raw_value << " is within the range [" << before_seconds << " , "
532- << after_seconds << " ]" );
533- CHECK ((raw_value >= before_seconds && raw_value <= after_seconds));
470+ CHECK (user_profile_get_profile_updated (conf) == 0 );
471+
472+ // // Reupload the "current" pic and confirm it gets returned
473+ // strcpy(p.url, "testUrl");
474+ // memcpy(p.key, "secret78901234567890123456789000", 32);
475+ // CHECK(0 == user_profile_set_reupload_pic(conf, p));
476+
477+ // pic = user_profile_get_pic(conf);
478+ // REQUIRE(pic.url != ""s);
479+ // REQUIRE(pic.key != session::to_vector("").data());
480+ // CHECK(pic.url == "testUrl"sv);
481+ // CHECK(session::to_vector(std::span<const unsigned char>{pic.key, 32}) ==
482+ // "secret78901234567890123456789000"_bytes);
483+
484+ // // Upload a "new" pic and it now gets returned
485+ // strcpy(p.url, "testNewUrl");
486+ // memcpy(p.key, "secret78901234567890123456789111", 32);
487+ // CHECK(0 == user_profile_set_pic(conf, p));
488+ // pic = user_profile_get_pic(conf);
489+ // REQUIRE(pic.url != ""s);
490+ // REQUIRE(pic.key != session::to_vector("").data());
491+ // CHECK(pic.url == "testNewUrl"sv);
492+ // CHECK(session::to_vector(std::span<const unsigned char>{pic.key, 32}) ==
493+ // "secret78901234567890123456789111"_bytes);
494+
495+ // // Ensure the timestamp for the last modified pic gets updated correctly when the name gets set
496+ // UserProfileTester::set_profile_updated(conf, std::chrono::sys_seconds{0s});
497+ // UserProfileTester::set_reupload_profile_updated(conf, std::chrono::sys_seconds{0s});
498+
499+ // CHECK(0 == user_profile_set_pic(conf, p));
500+ // UserProfileTester::set_profile_updated(conf, std::chrono::sys_seconds{123s});
501+ // user_profile_set_name(conf, "test1");
502+ // CHECK(UserProfileTester::get_profile_updated_value(conf).time_since_epoch().count() != 123);
503+ // UserProfileTester::set_profile_updated(conf, std::chrono::sys_seconds{0s});
504+
505+ // UserProfileTester::set_reupload_profile_updated(conf, std::chrono::sys_seconds{124s});
506+ // CHECK(0 == user_profile_set_reupload_pic(conf, p));
507+ // user_profile_set_name(conf, "test2");
508+ // CHECK(UserProfileTester::get_reupload_profile_updated_value(conf).time_since_epoch().count() !=
509+ // 124);
510+
511+ // // Ensure the timestamp for the last modified pic gets updated correctly when the blinded msgreq
512+ // // is set
513+ // UserProfileTester::set_profile_updated(conf, std::chrono::sys_seconds{0s});
514+ // UserProfileTester::set_reupload_profile_updated(conf, std::chrono::sys_seconds{0s});
515+
516+ // CHECK(0 == user_profile_set_pic(conf, p));
517+ // UserProfileTester::set_profile_updated(conf, std::chrono::sys_seconds{123s});
518+ // user_profile_set_blinded_msgreqs(conf, 1);
519+ // CHECK(UserProfileTester::get_profile_updated_value(conf).time_since_epoch().count() != 123);
520+ // UserProfileTester::set_profile_updated(conf, std::chrono::sys_seconds{0s});
521+
522+ // UserProfileTester::set_reupload_profile_updated(conf, std::chrono::sys_seconds{124s});
523+ // CHECK(0 == user_profile_set_reupload_pic(conf, p));
524+ // user_profile_set_blinded_msgreqs(conf, 2);
525+ // CHECK(UserProfileTester::get_reupload_profile_updated_value(conf).time_since_epoch().count() !=
526+ // 124);
527+
528+ // // Ensure the timestamp is stored in seconds seconds (was incorrectly stored as microseconds)
529+ // auto time_before_call = std::chrono::system_clock::now();
530+ // CHECK(0 == user_profile_set_pic(conf, p));
531+ // auto time_after_call = std::chrono::system_clock::now();
532+ // auto before_seconds =
533+ // std::chrono::duration_cast<std::chrono::seconds>(time_before_call.time_since_epoch())
534+ // .count();
535+ // auto after_seconds =
536+ // std::chrono::duration_cast<std::chrono::seconds>(time_before_call.time_since_epoch())
537+ // .count();
538+
539+ // auto raw_value = UserProfileTester::get_raw_profile_updated_value(conf);
540+ // INFO("Checking if raw_value " << raw_value << " is within the range [" << before_seconds << ", "
541+ // << after_seconds << "]");
542+ // CHECK((raw_value >= before_seconds && raw_value <= after_seconds));
534543}
0 commit comments