diff options
Diffstat (limited to 'tests/test-commit-sign-sh-ext.c')
-rw-r--r-- | tests/test-commit-sign-sh-ext.c | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/tests/test-commit-sign-sh-ext.c b/tests/test-commit-sign-sh-ext.c index c11bd0f1..3469471d 100644 --- a/tests/test-commit-sign-sh-ext.c +++ b/tests/test-commit-sign-sh-ext.c @@ -52,7 +52,7 @@ corrupt (GBytes *input) static gboolean run (GError **error) { - g_autoptr(OstreeRepo) repo = ostree_repo_open_at (AT_FDCWD, "repo", NULL, error); + g_autoptr (OstreeRepo) repo = ostree_repo_open_at (AT_FDCWD, "repo", NULL, error); if (!repo) return FALSE; @@ -60,45 +60,46 @@ run (GError **error) if (!ostree_repo_resolve_rev (repo, "origin:main", FALSE, &rev, error)) return FALSE; g_assert (rev); - g_autoptr(GVariant) commit = NULL; + g_autoptr (GVariant) commit = NULL; if (!ostree_repo_load_variant (repo, OSTREE_OBJECT_TYPE_COMMIT, rev, &commit, error)) return FALSE; g_assert (commit); - g_autoptr(GVariant) detached_meta = NULL; + g_autoptr (GVariant) detached_meta = NULL; if (!ostree_repo_read_commit_detached_metadata (repo, rev, &detached_meta, NULL, error)) return FALSE; g_assert (detached_meta); - g_autoptr(GBytes) commit_bytes = g_variant_get_data_as_bytes (commit); - g_autoptr(GBytes) detached_meta_bytes = g_variant_get_data_as_bytes (detached_meta); + g_autoptr (GBytes) commit_bytes = g_variant_get_data_as_bytes (commit); + g_autoptr (GBytes) detached_meta_bytes = g_variant_get_data_as_bytes (detached_meta); g_autofree char *verify_report = NULL; - if (!ostree_repo_signature_verify_commit_data (repo, "origin", commit_bytes, detached_meta_bytes, 0, - &verify_report, error)) + if (!ostree_repo_signature_verify_commit_data (repo, "origin", commit_bytes, detached_meta_bytes, + 0, &verify_report, error)) return FALSE; if (ostree_repo_signature_verify_commit_data (repo, "origin", commit_bytes, detached_meta_bytes, - OSTREE_REPO_VERIFY_FLAGS_NO_GPG | OSTREE_REPO_VERIFY_FLAGS_NO_SIGNAPI, + OSTREE_REPO_VERIFY_FLAGS_NO_GPG + | OSTREE_REPO_VERIFY_FLAGS_NO_SIGNAPI, &verify_report, error)) return glnx_throw (error, "Should not have validated"); assert_error_contains (error, "No commit verification types enabled"); // No signatures - g_autoptr(GBytes) empty = g_bytes_new_static ("", 0); + g_autoptr (GBytes) empty = g_bytes_new_static ("", 0); if (ostree_repo_signature_verify_commit_data (repo, "origin", commit_bytes, empty, 0, - &verify_report, error)) + &verify_report, error)) return glnx_throw (error, "Should not have validated"); assert_error_contains (error, "no signatures found"); // No such remote - if (ostree_repo_signature_verify_commit_data (repo, "nosuchremote", commit_bytes, detached_meta_bytes, 0, - &verify_report, error)) + if (ostree_repo_signature_verify_commit_data (repo, "nosuchremote", commit_bytes, + detached_meta_bytes, 0, &verify_report, error)) return glnx_throw (error, "Should not have validated"); assert_error_contains (error, "Remote \"nosuchremote\" not found"); // Corrupted commit - g_autoptr(GBytes) corrupted_commit = corrupt (commit_bytes); - if (ostree_repo_signature_verify_commit_data (repo, "origin", corrupted_commit, detached_meta_bytes, 0, - &verify_report, error)) + g_autoptr (GBytes) corrupted_commit = corrupt (commit_bytes); + if (ostree_repo_signature_verify_commit_data (repo, "origin", corrupted_commit, + detached_meta_bytes, 0, &verify_report, error)) return glnx_throw (error, "Should not have validated"); assert_error_contains (error, "BAD signature"); @@ -108,7 +109,7 @@ run (GError **error) int main (int argc, char **argv) { - g_autoptr(GError) error = NULL; + g_autoptr (GError) error = NULL; if (!run (&error)) { g_printerr ("error: %s\n", error->message); |