mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-12 07:14:38 +00:00
sign: move TestSigningBackend to lib
We need to make `TestSigningBackend` available for cli tests, as we are implementing the `jj sign` command in following changes.
This commit is contained in:
parent
b0eb7764d4
commit
332902e5fe
5 changed files with 26 additions and 3 deletions
|
@ -75,7 +75,6 @@ pub mod repo_path;
|
|||
pub mod revset;
|
||||
mod revset_parser;
|
||||
pub mod rewrite;
|
||||
#[cfg(feature = "testing")]
|
||||
pub mod secret_backend;
|
||||
pub mod settings;
|
||||
pub mod signing;
|
||||
|
@ -86,6 +85,8 @@ pub mod stacked_table;
|
|||
pub mod store;
|
||||
pub mod str_util;
|
||||
pub mod submodule_store;
|
||||
#[cfg(feature = "testing")]
|
||||
pub mod test_signing_backend;
|
||||
pub mod time_util;
|
||||
pub mod transaction;
|
||||
pub mod tree;
|
||||
|
|
|
@ -25,6 +25,7 @@ use crate::backend::CommitId;
|
|||
use crate::gpg_signing::GpgBackend;
|
||||
use crate::settings::UserSettings;
|
||||
use crate::ssh_signing::SshBackend;
|
||||
use crate::test_signing_backend::TestSigningBackend;
|
||||
|
||||
/// A status of the signature, part of the [Verification] type.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
|
@ -167,6 +168,10 @@ impl Signer {
|
|||
// Box::new(X509Backend::from_settings(settings)?) as Box<dyn SigningBackend>,
|
||||
];
|
||||
|
||||
if cfg!(feature = "testing") {
|
||||
backends.push(Box::new(TestSigningBackend) as Box<dyn SigningBackend>);
|
||||
}
|
||||
|
||||
let main_backend = settings
|
||||
.signing_backend()
|
||||
.map(|backend| {
|
||||
|
|
|
@ -1,3 +1,20 @@
|
|||
// Copyright 2023 The Jujutsu Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! Generic APIs to work with cryptographic signatures created and verified by
|
||||
//! various backends.
|
||||
|
||||
use hex::ToHex;
|
||||
use jj_lib::content_hash::blake2b_hash;
|
||||
use jj_lib::signing::SigStatus;
|
||||
|
@ -6,6 +23,7 @@ use jj_lib::signing::SignResult;
|
|||
use jj_lib::signing::SigningBackend;
|
||||
use jj_lib::signing::Verification;
|
||||
|
||||
/// A test signing backend that uses a simple hash-based signature format.
|
||||
#[derive(Debug)]
|
||||
pub struct TestSigningBackend;
|
||||
|
|
@ -7,9 +7,9 @@ use jj_lib::signing::SigStatus;
|
|||
use jj_lib::signing::SignBehavior;
|
||||
use jj_lib::signing::Signer;
|
||||
use jj_lib::signing::Verification;
|
||||
use jj_lib::test_signing_backend::TestSigningBackend;
|
||||
use test_case::test_case;
|
||||
use testutils::create_random_commit;
|
||||
use testutils::test_signing_backend::TestSigningBackend;
|
||||
use testutils::write_random_commit;
|
||||
use testutils::TestRepoBackend;
|
||||
use testutils::TestWorkspace;
|
||||
|
|
|
@ -64,7 +64,6 @@ use tempfile::TempDir;
|
|||
use crate::test_backend::TestBackendFactory;
|
||||
|
||||
pub mod test_backend;
|
||||
pub mod test_signing_backend;
|
||||
|
||||
pub fn hermetic_libgit2() {
|
||||
// libgit2 respects init.defaultBranch (and possibly other config
|
||||
|
|
Loading…
Reference in a new issue