summaryrefslogtreecommitdiff
path: root/server/common/src/tests.rs
diff options
context:
space:
mode:
Diffstat (limited to 'server/common/src/tests.rs')
-rw-r--r--server/common/src/tests.rs19
1 files changed, 18 insertions, 1 deletions
diff --git a/server/common/src/tests.rs b/server/common/src/tests.rs
index f08ca44..41f44fe 100644
--- a/server/common/src/tests.rs
+++ b/server/common/src/tests.rs
@@ -202,7 +202,7 @@ async fn git_get_author_commiter(repo: &git::Repository) {
assert!(repo.get_author("<invalid>").await.is_err());
}
-async fn git_fetch(bare: bool) {
+async fn git_fetch(bare: bool) -> git::Repository {
let path = testdir!().join("repo");
let remote_path = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("src/testdata/bare");
let remote = remote_path.to_string_lossy().into_owned();
@@ -231,6 +231,7 @@ async fn git_fetch(bare: bool) {
branch.unwrap();
other.unwrap();
}
+ repo
}
#[tokio::test]
@@ -266,3 +267,19 @@ async fn test_git_fetch() {
async fn test_git_bare_fetch() {
git_fetch(true).await;
}
+
+#[tokio::test]
+async fn test_git_delete_branch() {
+ // Using git_fetch as we need a writeable git repo
+ let repo = git_fetch(false).await;
+ assert!(repo.delete_branch("other").await.is_ok());
+ assert!(repo.delete_branch("does-not-exist").await.is_err());
+}
+
+#[tokio::test]
+async fn test_git_bare_delete_branch() {
+ // Using git_fetch as we need a writeable git repo
+ let repo = git_fetch(true).await;
+ assert!(repo.delete_branch("other").await.is_ok());
+ assert!(repo.delete_branch("does-not-exist").await.is_err());
+}