Skip to content

Commit

Permalink
fix role edit/role delete unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
braindigitalis committed Nov 16, 2024
1 parent d4a3195 commit 80144d1
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/unittest/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2248,14 +2248,17 @@ Markdown lol \\|\\|spoiler\\|\\| \\~\\~strikethrough\\~\\~ \\`small \\*code\\* b
return;
}
dpp::role createdRole = std::get<dpp::role>(cc.value);
createdRole.guild_id = TEST_GUILD_ID;
if (createdRole.name == r.name &&
createdRole.has_move_members() &&
createdRole.flags & dpp::r_mentionable &&
createdRole.colour == r.colour) {
createdRole.name = "Test-Role-Edited";
set_test(ROLE_CREATE, true);
bot.role_edit(createdRole, [&bot, createdRole](const auto& e) {
if (e.is_error()) {
set_test(ROLE_EDIT, false);
set_test(ROLE_EDIT, false);
set_test(ROLE_DELETE, false);
return;
}
dpp::role edited = std::get<dpp::role>(e.value);
Expand All @@ -2264,6 +2267,10 @@ Markdown lol \\|\\|spoiler\\|\\| \\~\\~strikethrough\\~\\~ \\`small \\*code\\* b
set_test(ROLE_DELETE, !e.is_error());
});
});
} else {
set_test(ROLE_CREATE, false);
set_test(ROLE_EDIT, false);
set_test(ROLE_DELETE, false);
}
});
}
Expand All @@ -2272,7 +2279,7 @@ Markdown lol \\|\\|spoiler\\|\\| \\~\\~strikethrough\\~\\~ \\`small \\*code\\* b
set_test(BOTSTART, false);
try {
if (!offline) {
bot.start(true);
bot.start(dpp::st_return);
set_test(BOTSTART, true);
}
}
Expand Down Expand Up @@ -2323,7 +2330,7 @@ Markdown lol \\|\\|spoiler\\|\\| \\~\\~strikethrough\\~\\~ \\`small \\*code\\* b
dpp::https_client c2(&bot, "dl.dpp.dev", 443, "/cookietest.php", "GET", "", {}, true, 5, "1.1", [](dpp::https_client* c2) {
size_t count = c2->get_header_count("set-cookie");
size_t count_list = c2->get_header_list("set-cookie").size();
// Google sets a bunch of cookies when we start accessing it.
// This test script sets a bunch of cookies when we request it.
set_test(MULTIHEADER, c2->get_status() == 200 && count > 1 && count == count_list);
});
std::this_thread::sleep_for(std::chrono::seconds(6));
Expand Down

0 comments on commit 80144d1

Please sign in to comment.