feat(registry,cli): RFC 7232 conditional requests; require trusted verify keys
This commit is contained in:
1 parent
27d909fdad
commit
ea6ac852e7
9 files changed
+138
-6
No files matched your search
+26
-3
@@ -2237,9 +2237,21 @@ void build(Void::Build::Project &project) {
|
||||
Void::Testing::expect(std::filesystem::exists(str_field(*installed, "manifest")));
|
||||
const auto installed_files = string_array_field(*installed, "installed_files");
|
||||
Void::Testing::require(!installed_files.empty());
|
||||
Void::Testing::expect(std::filesystem::exists(installed_files.front()));
|
||||
Void::Testing::expect(installed_files.size() <=
|
||||
static_cast<std::size_t>(int_field(*installed, "files")));
|
||||
Void::Testing::expect_eq(installed_files.size(),
|
||||
static_cast<std::size_t>(int_field(*installed, "files")));
|
||||
Void::Testing::expect(!bool_field(*installed, "installed_files_truncated"));
|
||||
const auto prefix_abs = std::filesystem::weakly_canonical(prefix);
|
||||
for (const auto &file : installed_files) {
|
||||
const std::filesystem::path path{file};
|
||||
Void::Testing::expect(!file.empty());
|
||||
Void::Testing::expect(path.is_absolute());
|
||||
Void::Testing::expect(std::filesystem::is_regular_file(path));
|
||||
const auto relative = path.lexically_relative(prefix_abs);
|
||||
Void::Testing::expect(!relative.empty());
|
||||
if (!relative.empty()) {
|
||||
Void::Testing::expect(relative.native().rfind("..", 0) != 0);
|
||||
}
|
||||
}
|
||||
Void::Testing::require(missing_prefix.has_value());
|
||||
Void::Testing::expect(!bool_field(*missing_prefix, "ok", true));
|
||||
|
||||
@@ -2254,6 +2266,14 @@ void build(Void::Build::Project &project) {
|
||||
Void::Testing::expect(bool_field(*installed_no_cmake, "ok"));
|
||||
Void::Testing::expect(int_field(*installed_no_cmake, "files") >= 1);
|
||||
Void::Testing::expect(std::filesystem::exists(prefix_no_cmake / "bin" / "app"));
|
||||
const auto installed_files_no_cmake =
|
||||
string_array_field(*installed_no_cmake, "installed_files");
|
||||
Void::Testing::require(!installed_files_no_cmake.empty());
|
||||
for (const auto &file : installed_files_no_cmake) {
|
||||
Void::Testing::expect(std::filesystem::exists(file));
|
||||
Void::Testing::expect(!file.ends_with("Config.cmake"));
|
||||
Void::Testing::expect(!file.ends_with("Targets.cmake"));
|
||||
}
|
||||
bool has_cmake_config = false;
|
||||
for (const auto &entry : std::filesystem::recursive_directory_iterator(prefix_no_cmake)) {
|
||||
if (entry.is_regular_file() && entry.path().filename().string().ends_with("Config.cmake")) {
|
||||
@@ -2295,6 +2315,9 @@ void build(Void::Build::Project &project) {
|
||||
Void::Testing::expect(bool_field(*uninstalled, "ok"));
|
||||
Void::Testing::expect(int_field(*uninstalled, "removed") >= 1);
|
||||
Void::Testing::expect(!std::filesystem::exists(prefix / "bin" / "app"));
|
||||
for (const auto &file : installed_files) {
|
||||
Void::Testing::expect(!std::filesystem::exists(file));
|
||||
}
|
||||
}
|
||||
|
||||
VOID_TEST(Daemon, install_request_component_filters_installed_files) {
|
||||
|
||||
Reference in new issue
Block a user