Add typed SSH remote endpoints
This commit is contained in:
@@ -339,20 +339,21 @@ fn git_account_status_and_removal_never_expose_the_token() -> TestResult {
|
||||
"personal-git",
|
||||
"ironstorage-mobile",
|
||||
)?;
|
||||
let (server_id, application_id) = remote.https_credentials().expect("HTTPS credentials");
|
||||
store.unlock()?;
|
||||
store.store_https_git_credential(
|
||||
remote.server_id(),
|
||||
remote.application_id(),
|
||||
server_id,
|
||||
application_id,
|
||||
"alice",
|
||||
SecretBytes::new(b"private-token".to_vec()),
|
||||
)?;
|
||||
assert_eq!(
|
||||
store.https_git_credential_account(remote.server_id(), remote.application_id())?,
|
||||
store.https_git_credential_account(server_id, application_id)?,
|
||||
"alice"
|
||||
);
|
||||
store.delete_https_git_credential(remote.server_id(), remote.application_id())?;
|
||||
store.delete_https_git_credential(server_id, application_id)?;
|
||||
assert!(matches!(
|
||||
store.https_git_credential_account(remote.server_id(), remote.application_id()),
|
||||
store.https_git_credential_account(server_id, application_id),
|
||||
Err(SecretStoreError::Missing)
|
||||
));
|
||||
assert!(!format!("{store:?}").contains("private-token"));
|
||||
@@ -396,28 +397,29 @@ fn one_unlocked_provider_supplies_openpgp_and_https_git_secrets() -> TestResult
|
||||
let config = ConfigLoader::new(temporary.path().to_owned(), temporary.path().join("native"))
|
||||
.load(Some(&temporary.path().join("config.toml")))?;
|
||||
let remote = &config.git_remotes()[0];
|
||||
let (server_id, application_id) = remote.https_credentials().expect("HTTPS credentials");
|
||||
backend.fail_next(SecretStoreError::Cancelled);
|
||||
assert!(matches!(
|
||||
store.credential(remote.server_id(), remote.application_id()),
|
||||
store.credential(server_id, application_id),
|
||||
Err(GitError::CredentialCancelled)
|
||||
));
|
||||
backend.fail_next(SecretStoreError::Denied);
|
||||
assert!(matches!(
|
||||
store.credential(remote.server_id(), remote.application_id()),
|
||||
store.credential(server_id, application_id),
|
||||
Err(GitError::CredentialAccessDenied)
|
||||
));
|
||||
let git = SecretReference::https_git_credential(
|
||||
remote.server_id().as_str(),
|
||||
remote.application_id().as_str(),
|
||||
server_id.as_str(),
|
||||
application_id.as_str(),
|
||||
"alice",
|
||||
)?;
|
||||
store.create(&git, SecretBytes::new(b"https-token".to_vec()))?;
|
||||
let credential = store.credential(remote.server_id(), remote.application_id())?;
|
||||
let credential = store.credential(server_id, application_id)?;
|
||||
assert_eq!(credential.username(), "alice");
|
||||
assert_eq!(credential.password(), b"https-token");
|
||||
store.store_https_git_credential(
|
||||
remote.server_id(),
|
||||
remote.application_id(),
|
||||
server_id,
|
||||
application_id,
|
||||
"bob",
|
||||
SecretBytes::new(b"replacement-token".to_vec()),
|
||||
)?;
|
||||
@@ -425,7 +427,7 @@ fn one_unlocked_provider_supplies_openpgp_and_https_git_secrets() -> TestResult
|
||||
store.retrieve(&git),
|
||||
Err(SecretStoreError::Missing)
|
||||
));
|
||||
let credential = store.credential(remote.server_id(), remote.application_id())?;
|
||||
let credential = store.credential(server_id, application_id)?;
|
||||
assert_eq!(credential.username(), "bob");
|
||||
assert_eq!(credential.password(), b"replacement-token");
|
||||
assert!(
|
||||
|
||||
Reference in New Issue
Block a user