This commit is contained in:
Mateusz Gruszczyński committed 2026-10-05 09:30:21 +02:00
1 parent 1dea7f55c8
commit c819f0a335
151 files changed
+7610 -4264

No files matched your search

+6 -5
View File
@@ -53,7 +53,8 @@ impl Store {
)
.bind(revision_i64)
.fetch_optional(&self.pool)
.await? else {
.await?
else {
return Ok(None);
};
let document: String = row.try_get("document")?;
@@ -75,9 +76,10 @@ impl Store {
);
(
Some(previous.try_get::<i64, _>("revision")?.try_into()?),
Some(serde_json::from_str(&previous_document).context(
"invalid previous configuration history document",
)?),
Some(
serde_json::from_str(&previous_document)
.context("invalid previous configuration history document")?,
),
)
} else {
(None, None)
@@ -92,5 +94,4 @@ impl Store {
previous_config,
}))
}
}
+13 -8
View File
@@ -105,12 +105,7 @@ mod tests {
let token = "b".repeat(64);
let hash = crate::auth::secret_hash(&token);
let saved = store
.upsert_certificate_api_credential(
"certbot-main",
&hash,
"production certbot",
"owner",
)
.upsert_certificate_api_credential("certbot-main", &hash, "production certbot", "owner")
.await
.unwrap();
assert_eq!(saved.key_id, "certbot-main");
@@ -171,8 +166,18 @@ mod tests {
let remaining = store.certificate_api_credentials().await.unwrap();
assert_eq!(remaining.len(), 1);
assert_eq!(remaining[0].key_id, "deploy-hook");
assert_eq!(store.revoke_all_certificate_api_credentials("owner").await.unwrap(), 1);
assert!(store.certificate_api_credentials().await.unwrap().is_empty());
assert_eq!(
store
.revoke_all_certificate_api_credentials("owner")
.await
.unwrap(),
1
);
assert!(store
.certificate_api_credentials()
.await
.unwrap()
.is_empty());
store.close().await;
}